Skip to content

Commit

Permalink
add nil guard
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh-Bharadwaj committed Nov 26, 2024
1 parent 04deaf0 commit 1f069a4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions flow/otel_metrics/otel_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ func getOrInitMetric[M any, O any](
name string,
opts ...O,
) (M, error) {
if cache == nil {
cache = make(map[string]M)
}
gauge, ok := cache[name]
if !ok {
var err error
Expand Down

0 comments on commit 1f069a4

Please sign in to comment.