Skip to content

Commit

Permalink
Fix panic instruments creation when setting meter provider (#5758)
Browse files Browse the repository at this point in the history
Related #5757. This is a quick fix.
  • Loading branch information
XSAM authored Sep 1, 2024
1 parent e47618f commit 932a4d8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Fixed

- Fix memory leak in the global `MeterProvider` when identical instruments are repeatedly created. (#5754)
- Fix panic instruments creation when setting meter provider. (#5758)

### Removed

Expand Down
2 changes: 1 addition & 1 deletion internal/global/meter.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (m *meter) setDelegate(provider metric.MeterProvider) {
m.registry.Remove(e)
}

m.instruments = nil
clear(m.instruments)
m.registry.Init()
}

Expand Down

0 comments on commit 932a4d8

Please sign in to comment.