File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
1010 "fmt"
1111 "sync"
1212
13+ "github.com/gofrs/uuid/v5"
1314 "github.com/prometheus/client_golang/prometheus"
1415 "github.com/prometheus/client_golang/prometheus/promhttp"
1516 "github.com/rs/zerolog"
5556// metrics must be explicitly exposed with a call to InitMetrics
5657// FIXME we have global metrics but an internal and external API; this may lead to some confusion.
5758func init () {
58- err := report .SetupMetrics (logger .NewZapStub ("instance-metrics" ), build .ServiceName , version .DefaultVersion )
59+ // maintain original behaviour from deprecated report.SetupMetrics
60+ ephemeralID , _ := uuid .NewV4 ()
61+ err := report .SetupMetricsOptions (report.MetricOptions {
62+ Name : build .ServiceName ,
63+ Version : version .DefaultVersion ,
64+ EphemeralID : ephemeralID .String (),
65+ Logger : logger .NewZapStub ("instance-metrics" ),
66+ SystemMetrics : monitoring .Default .GetOrCreateRegistry ("system" ),
67+ ProcessMetrics : monitoring .Default .GetOrCreateRegistry ("beat" ),
68+ })
69+
5970 if err != nil {
6071 zerolog .Ctx (context .TODO ()).Error ().Err (err ).Msg ("unable to initialize metrics" ) // TODO is used because this may logged during the package load
6172 }
You can’t perform that action at this time.
0 commit comments