Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Adds all go metrics to Prometheus instrumentation #598

Merged
merged 2 commits into from
Mar 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pkg/phlare/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
grpcgw "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors"
"github.com/prometheus/common/version"
"github.com/thanos-io/thanos/pkg/discovery/dns"
"github.com/weaveworks/common/middleware"
Expand Down Expand Up @@ -372,7 +373,12 @@ func (f *Phlare) initIngester() (_ services.Service, err error) {
}

func (f *Phlare) initServer() (services.Service, error) {
prometheus.MustRegister(version.NewCollector("phlare"))
f.reg.MustRegister(version.NewCollector("phlare"))
f.reg.Unregister(collectors.NewGoCollector())
// register collector with additional metrics
f.reg.MustRegister(collectors.NewGoCollector(
collectors.WithGoCollectorRuntimeMetrics(collectors.MetricsAll),
))
DisableSignalHandling(&f.Cfg.Server)
f.Cfg.Server.Registerer = prometheus.WrapRegistererWithPrefix("phlare_", f.reg)
// Not all default middleware works with http2 so we'll add then manually.
Expand Down