Skip to content

Commit

Permalink
Merge pull request #155 from kaleido-io/metric-collector
Browse files Browse the repository at this point in the history
[pkg/metric] - Add the ability to register a new metrics collector to the registry
  • Loading branch information
peterbroadhurst authored Oct 24, 2024
2 parents 0bd135d + 04b5501 commit 851eeb4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/metric/metric.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2023 Kaleido, Inc.
// Copyright © 2024 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -58,6 +58,8 @@ type MetricsRegistry interface {
NewHTTPMetricsInstrumentationsForSubsystem(ctx context.Context, subsystem string, useRouteTemplate bool, reqDurationBuckets []float64, labels map[string]string) error
// GetHTTPMetricsInstrumentationsMiddlewareForSubsystem returns the HTTP middleware of a subsystem that used predefined HTTP metrics
GetHTTPMetricsInstrumentationsMiddlewareForSubsystem(ctx context.Context, subsystem string) (func(next http.Handler) http.Handler, error)

MustRegisterCollector(collector prometheus.Collector)
}

type FireflyDefaultLabels struct {
Expand Down Expand Up @@ -185,3 +187,7 @@ func (pmr *prometheusMetricsRegistry) GetHTTPMetricsInstrumentationsMiddlewareFo
}
return httpInstrumentation.Middleware, nil
}

func (pmr *prometheusMetricsRegistry) MustRegisterCollector(collector prometheus.Collector) {
pmr.registerer.MustRegister(collector)
}

0 comments on commit 851eeb4

Please sign in to comment.