diff --git a/sync/metrics.go b/sync/metrics.go index eca2e9c0..e2d75024 100644 --- a/sync/metrics.go +++ b/sync/metrics.go @@ -166,11 +166,13 @@ func (m *metrics) subjectiveInitialization(ctx context.Context) { } func (m *metrics) getRangeRequestTime(ctx context.Context, duration time.Duration, amount int, failed bool) { - m.requestRangeTimeHist.Record(ctx, duration.Seconds(), - metric.WithAttributes( - attribute.Int("headers amount", amount), - attribute.Bool("request failed", failed), - )) + m.observe(ctx, func(ctx context.Context) { + m.requestRangeTimeHist.Record(ctx, duration.Seconds(), + metric.WithAttributes( + attribute.Int("headers amount", amount), + attribute.Bool("request failed", failed), + )) + }) } func (m *metrics) newSubjectiveHead(ctx context.Context, height uint64, timestamp time.Time) {