mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-19 05:36:58 +00:00
Export start_time_seconds metrics on both master & volume servers. (#9046)
These are to be used to track uptimes. See https://github.com/seaweedfs/seaweedfs/issues/8535 for details. Co-authored-by: Lisandro Pin <lisandro.pin@proton.ch>
This commit is contained in:
co-authored by
Lisandro Pin
parent
80db692728
commit
67a2810d2d
@@ -204,6 +204,7 @@ func NewMasterServer(r *mux.Router, option *MasterOption, peers map[string]pb.Se
|
||||
ms.startAdminScripts()
|
||||
}
|
||||
|
||||
stats.MasterStartTimeSeconds.Set(float64(time.Now().Unix()))
|
||||
return ms
|
||||
}
|
||||
|
||||
|
||||
@@ -142,6 +142,7 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
|
||||
|
||||
stats.VolumeServerConcurrentDownloadLimit.Set(float64(vs.concurrentDownloadLimit))
|
||||
stats.VolumeServerConcurrentUploadLimit.Set(float64(vs.concurrentUploadLimit))
|
||||
stats.VolumeServerStartTimeSeconds.Set(float64(time.Now().Unix()))
|
||||
|
||||
go vs.heartbeat()
|
||||
go stats.LoopPushingMetric("volumeServer", util.JoinHostPort(ip, port), vs.metricsAddress, vs.metricsIntervalSec)
|
||||
|
||||
@@ -54,6 +54,14 @@ var (
|
||||
Help: "A metric with a constant '1' value labeled by version, commit, sizelimit, goos, and goarch from which SeaweedFS was built.",
|
||||
}, []string{"version", "commit", "sizelimit", "goos", "goarch"})
|
||||
|
||||
MasterStartTimeSeconds = prometheus.NewGauge(
|
||||
prometheus.GaugeOpts{
|
||||
Namespace: Namespace,
|
||||
Subsystem: "master",
|
||||
Name: "start_time_seconds",
|
||||
Help: "Start time of the master, as seconds since UNIX epoch.",
|
||||
})
|
||||
|
||||
MasterClientConnectCounter = prometheus.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
Namespace: Namespace,
|
||||
@@ -216,6 +224,14 @@ var (
|
||||
Help: "The offset of the filer synchronization service.",
|
||||
}, []string{"sourceFiler", "targetFiler", "clientName", "path"})
|
||||
|
||||
VolumeServerStartTimeSeconds = prometheus.NewGauge(
|
||||
prometheus.GaugeOpts{
|
||||
Namespace: Namespace,
|
||||
Subsystem: "volumeServer",
|
||||
Name: "start_time_seconds",
|
||||
Help: "Start time of the volume server, as seconds since UNIX epoch.",
|
||||
})
|
||||
|
||||
VolumeServerRequestCounter = prometheus.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
Namespace: Namespace,
|
||||
@@ -470,6 +486,7 @@ var (
|
||||
func init() {
|
||||
Gather.MustRegister(BuildInfo)
|
||||
|
||||
Gather.MustRegister(MasterStartTimeSeconds)
|
||||
Gather.MustRegister(MasterClientConnectCounter)
|
||||
Gather.MustRegister(MasterRaftIsleader)
|
||||
Gather.MustRegister(MasterAdminLock)
|
||||
@@ -494,6 +511,7 @@ func init() {
|
||||
Gather.MustRegister(collectors.NewGoCollector())
|
||||
Gather.MustRegister(collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}))
|
||||
|
||||
Gather.MustRegister(VolumeServerStartTimeSeconds)
|
||||
Gather.MustRegister(VolumeServerRequestCounter)
|
||||
Gather.MustRegister(VolumeServerHandlerCounter)
|
||||
Gather.MustRegister(VolumeServerRequestHistogram)
|
||||
|
||||
Reference in New Issue
Block a user