diff options
author | Jakob Borg <jakob@kastelo.net> | 2023-11-14 09:31:53 +0100 |
---|---|---|
committer | Jakob Borg <jakob@kastelo.net> | 2023-11-14 09:31:53 +0100 |
commit | aaee0c126b8aef480489f157eab34bdacaf92499 (patch) | |
tree | 04e61d1894c4ce1623e23358e0ca5421908d7871 /cmd | |
parent | f3bd4d71ded0a6ba9e492bea9002c4603c36e0ff (diff) | |
download | syncthing-aaee0c126b8aef480489f157eab34bdacaf92499.tar.gz syncthing-aaee0c126b8aef480489f157eab34bdacaf92499.zip |
cmd/stdiscorv: Expose build info in metrics
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/stdiscosrv/main.go | 3 | ||||
-rw-r--r-- | cmd/stdiscosrv/stats.go | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/cmd/stdiscosrv/main.go b/cmd/stdiscosrv/main.go index 79a63d63a..f7f968c86 100644 --- a/cmd/stdiscosrv/main.go +++ b/cmd/stdiscosrv/main.go @@ -14,6 +14,7 @@ import ( "net" "net/http" "os" + "runtime" "strings" "time" @@ -102,6 +103,8 @@ func main() { return } + buildInfo.WithLabelValues(build.Version, runtime.Version(), build.User, build.Date.UTC().Format("2006-01-02T15:04:05Z")).Set(1) + if largeDB { levelDBOptions.BlockCacheCapacity = 64 << 20 levelDBOptions.BlockSize = 64 << 10 diff --git a/cmd/stdiscosrv/stats.go b/cmd/stdiscosrv/stats.go index c466e09d2..949a369eb 100644 --- a/cmd/stdiscosrv/stats.go +++ b/cmd/stdiscosrv/stats.go @@ -14,6 +14,14 @@ import ( ) var ( + buildInfo = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Namespace: "syncthing", + Subsystem: "discovery", + Name: "build_info", + Help: "A metric with a constant '1' value labeled by version, goversion, builduser and builddate from which stdiscosrv was built.", + }, []string{"version", "goversion", "builduser", "builddate"}) + apiRequestsTotal = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: "syncthing", @@ -112,7 +120,8 @@ const ( ) func init() { - prometheus.MustRegister(apiRequestsTotal, apiRequestsSeconds, + prometheus.MustRegister(buildInfo, + apiRequestsTotal, apiRequestsSeconds, lookupRequestsTotal, announceRequestsTotal, replicationSendsTotal, replicationRecvsTotal, databaseKeys, databaseStatisticsSeconds, |