@@ -505,23 +505,21 @@ func Server(vip *viper.Viper, newAPI func(context.Context, *coderd.Options) (*co
505
505
defer serveHandler (ctx , logger , nil , cfg .Pprof .Address .Value , "pprof" )()
506
506
}
507
507
if cfg .Prometheus .Enable .Value {
508
- options .PrometheusRegistry = prometheus .NewRegistry ()
509
- closeUsersFunc , err := prometheusmetrics .ActiveUsers (ctx , options .PrometheusRegistry , options .Database , 0 )
508
+ options .PrometheusRegisterer = prometheus .DefaultRegisterer
509
+ closeUsersFunc , err := prometheusmetrics .ActiveUsers (ctx , options .PrometheusRegisterer , options .Database , 0 )
510
510
if err != nil {
511
511
return xerrors .Errorf ("register active users prometheus metric: %w" , err )
512
512
}
513
513
defer closeUsersFunc ()
514
514
515
- closeWorkspacesFunc , err := prometheusmetrics .Workspaces (ctx , options .PrometheusRegistry , options .Database , 0 )
515
+ closeWorkspacesFunc , err := prometheusmetrics .Workspaces (ctx , options .PrometheusRegisterer , options .Database , 0 )
516
516
if err != nil {
517
517
return xerrors .Errorf ("register workspaces prometheus metric: %w" , err )
518
518
}
519
519
defer closeWorkspacesFunc ()
520
520
521
521
//nolint:revive
522
- defer serveHandler (ctx , logger , promhttp .InstrumentMetricHandler (
523
- options .PrometheusRegistry , promhttp .HandlerFor (options .PrometheusRegistry , promhttp.HandlerOpts {}),
524
- ), cfg .Prometheus .Address .Value , "prometheus" )()
522
+ defer serveHandler (ctx , logger , promhttp .Handler (), cfg .Prometheus .Address .Value , "prometheus" )()
525
523
}
526
524
527
525
// We use a separate coderAPICloser so the Enterprise API
0 commit comments