Skip to content

Commit

Permalink
fix: closer
Browse files Browse the repository at this point in the history
  • Loading branch information
rbarabas committed Sep 24, 2024
1 parent a5dde50 commit a845e57
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ func (mp *MetricProvider) ServeHttp() {
}

func (mp *MetricProvider) Close() {
mp.reporter.Close()
mp.reporter.closer.Close()
}
6 changes: 4 additions & 2 deletions reporter/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ func NewReporter() *Reporter {
promreporter.Options{Registerer: reg},
),
}
r.scopes = make(map[string]tally.Scope)

// Create root scope
scope, closer := tally.NewRootScope(tally.ScopeOptions{
Expand All @@ -72,9 +71,12 @@ func NewReporter() *Reporter {
Separator: promreporter.DefaultSeparator,
OmitCardinalityMetrics: true,
}, 1*time.Second)
defer closer.Close()

// Add closer to reporter
r.closer = closer

// Add root scope to reporter
r.scopes = make(map[string]tally.Scope)
r.scopes["root"] = scope

// Add prometheus prefix for root scope
Expand Down

0 comments on commit a845e57

Please sign in to comment.