@@ -20,13 +20,13 @@ type Histogram[T n64] interface {
2020 // that records the time elapsed since the starting point. The returned
2121 // function may also receive record options to further support information
2222 // that may vary along a given procedure.
23- Measure (transform timeTransform [T ], opts ... metric.RecordOption ) func (opts ... metric.RecordOption )
23+ Measure (sub timeSub [T ], opts ... metric.RecordOption ) func (opts ... metric.RecordOption )
2424
2525 // MeasureCtx creates a starting point using time.Now and returns a function
2626 // that records the time elapsed since the starting point. The returned
2727 // function may also receive record options to further support information
2828 // that may vary along a given procedure.
29- MeasureCtx (ctx context.Context , transform timeTransform [T ], opts ... metric.RecordOption ) func (opts ... metric.RecordOption )
29+ MeasureCtx (ctx context.Context , sub timeSub [T ], opts ... metric.RecordOption ) func (opts ... metric.RecordOption )
3030}
3131
3232type histogram [T n64 ] struct {
@@ -42,15 +42,15 @@ func (h *histogram[T]) RecordCtx(ctx context.Context, n T, opts ...metric.Record
4242 h .baseRecord .Record (ctx , n , append (opts , metric .WithAttributes (h .attrs ... ))... )
4343}
4444
45- func (h * histogram [T ]) Measure (transform timeTransform [T ], opts ... metric.RecordOption ) func (opts ... metric.RecordOption ) {
46- return h .MeasureCtx (context .Background (), transform , opts ... )
45+ func (h * histogram [T ]) Measure (sub timeSub [T ], opts ... metric.RecordOption ) func (opts ... metric.RecordOption ) {
46+ return h .MeasureCtx (context .Background (), sub , opts ... )
4747}
4848
49- func (h * histogram [T ]) MeasureCtx (ctx context.Context , transform timeTransform [T ], opts ... metric.RecordOption ) func (opts ... metric.RecordOption ) {
50- now := time .Now ()
49+ func (h * histogram [T ]) MeasureCtx (ctx context.Context , sub timeSub [T ], opts ... metric.RecordOption ) func (opts ... metric.RecordOption ) {
50+ start := time .Now ()
5151 baseOpts := opts
5252 return func (opts ... metric.RecordOption ) {
53- h .RecordCtx (ctx , transform ( now ), append (baseOpts , opts ... )... )
53+ h .RecordCtx (ctx , sub ( start ), append (baseOpts , opts ... )... )
5454 }
5555}
5656
0 commit comments