Skip to content

Commit

Permalink
Merge pull request #1666 from josephschorr/observable-proxy
Browse files Browse the repository at this point in the history
Don't call ObserveDuration more than one in the observable proxy
  • Loading branch information
vroldanbet authored Nov 28, 2023
2 parents 688ee40 + 7dae9b3 commit 6e1677c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/datastore/proxy/observable.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,14 @@ func (rwt *observableRWT) BulkLoad(ctx context.Context, iter datastore.BulkWrite
func observe(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, func()) {
ctx, span := tracer.Start(ctx, name, opts...)
timer := prometheus.NewTimer(queryLatency.WithLabelValues(name))
closed := false

return ctx, func() {
if closed {
return
}

closed = true
timer.ObserveDuration()
span.End()
}
Expand Down

0 comments on commit 6e1677c

Please sign in to comment.