diff options
author | Till <2353100+S7evinK@users.noreply.github.com> | 2023-07-11 13:56:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-11 13:56:25 +0200 |
commit | 99f94fc73513ca9a9eccd859ce61487f7379a7b1 (patch) | |
tree | 49656aa527bea1ba31d063a4203f5a44d508c0f0 /cmd | |
parent | 69b2069dea160faff6b2b13bb3d660037f12649d (diff) |
Add revision to version string (#3147)
Since the removal of `build.sh`, we don't include any information about
the revision Dendrite was build from. Since go1.18, the revision a
binary was build from is automatically included, so we can try to get
that instead.
This also adds a `dendrite_up` metric showing the current version
(`dendrite_up{version="0.13.1+c796f20"} 1`)
Closes #2993
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/dendrite/main.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cmd/dendrite/main.go b/cmd/dendrite/main.go index 66eb88f8..7b2bebc0 100644 --- a/cmd/dendrite/main.go +++ b/cmd/dendrite/main.go @@ -26,6 +26,7 @@ import ( "github.com/matrix-org/dendrite/setup/jetstream" "github.com/matrix-org/dendrite/setup/process" "github.com/matrix-org/gomatrixserverlib/fclient" + "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" "github.com/matrix-org/dendrite/appservice" @@ -187,6 +188,16 @@ func main() { } } + upCounter := prometheus.NewCounter(prometheus.CounterOpts{ + Namespace: "dendrite", + Name: "up", + ConstLabels: map[string]string{ + "version": internal.VersionString(), + }, + }) + upCounter.Add(1) + prometheus.MustRegister(upCounter) + // Expose the matrix APIs directly rather than putting them under a /api path. go func() { basepkg.SetupAndServeHTTP(processCtx, cfg, routers, httpAddr, nil, nil) |