Skip to content

Commit

Permalink
Fix InitializeMetrics signature to allow use with xds.GRPCServer
Browse files Browse the repository at this point in the history
  • Loading branch information
bozaro committed Jan 25, 2024
1 parent 71d7422 commit b6347ff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion providers/prometheus/server_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors"
"github.com/prometheus/client_golang/prometheus"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
)

// ServerMetrics represents a collection of metrics to be registered on a
Expand Down Expand Up @@ -81,7 +82,7 @@ func (m *ServerMetrics) Collect(ch chan<- prometheus.Metric) {
// value, for all gRPC methods registered on a gRPC server. This is useful, to
// ensure that all metrics exist when collecting and querying.
// NOTE: This might add significant cardinality and might not be needed in future version of Prometheus (created timestamp).
func (m *ServerMetrics) InitializeMetrics(server *grpc.Server) {
func (m *ServerMetrics) InitializeMetrics(server reflection.ServiceInfoProvider) {
serviceInfo := server.GetServiceInfo()
for serviceName, info := range serviceInfo {
for _, mInfo := range info.Methods {
Expand Down

0 comments on commit b6347ff

Please sign in to comment.