Skip to content

Commit

Permalink
fix getAccessorTime incorrect meter
Browse files Browse the repository at this point in the history
  • Loading branch information
walldiss committed Aug 4, 2023
1 parent fd3bd85 commit bc6a05b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion share/eds/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type metrics struct {
getTime metric.Float64Histogram
hasTime metric.Float64Histogram
listTime metric.Float64Histogram
getAccessorTime metric.Float64Histogram

longOpTime metric.Float64Histogram
gcTime metric.Float64Histogram
Expand Down Expand Up @@ -97,6 +98,12 @@ func (s *Store) WithMetrics() error {
return err
}

getAccessorTime, err := meter.Float64Histogram("eds_store_get_accessor_time_histogram",
metric.WithDescription("eds store get accessor time histogram(s)"))
if err != nil {
return err
}

longOpTime, err := meter.Float64Histogram("eds_store_long_operation_time_histogram",
metric.WithDescription("eds store long operation time histogram(s)"))
if err != nil {
Expand All @@ -118,6 +125,7 @@ func (s *Store) WithMetrics() error {
getTime: getTime,
hasTime: hasTime,
listTime: listTime,
getAccessorTime: getAccessorTime,
longOpTime: longOpTime,
gcTime: gcTime,
}
Expand Down Expand Up @@ -253,7 +261,7 @@ func (m *metrics) observeGetAccessor(ctx context.Context, dur time.Duration, cac
ctx = context.Background()
}

m.listTime.Record(ctx, dur.Seconds(), metric.WithAttributes(
m.getAccessorTime.Record(ctx, dur.Seconds(), metric.WithAttributes(
attribute.Bool(cachedKey, cached),
attribute.Bool(failedKey, failed)))
}

0 comments on commit bc6a05b

Please sign in to comment.