Skip to content

Commit

Permalink
apply MeasurementProcessor
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristina Pathak committed Jun 22, 2023
1 parent fe3edab commit 6f4779d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lightstep/sdk/metric/internal/syncstate/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ func (inst *Observer) ObserveFloat64(ctx context.Context, num float64, cfg OpCon
}

// Observe performs a generic update for any synchronous instrument.
func Observe[N number.Any, Traits number.Traits[N]](_ context.Context, inst *Observer, num N, cfg OpConfig) {
func Observe[N number.Any, Traits number.Traits[N]](ctx context.Context, inst *Observer, num N, cfg OpConfig) {
if inst == nil {
// Instrument was completely disabled by the view.
return
Expand All @@ -339,19 +339,19 @@ func Observe[N number.Any, Traits number.Traits[N]](_ context.Context, inst *Obs
return
}

// TODO: Here, apply the measurement processor if it is non-nil
if inst.performance.MeasurementProcessor != nil {

}

var rec *recordKV
var keyValues []attribute.KeyValue
if cfg.KeyValues != nil {
rec = acquireUninitializedKV[N](inst, cfg.KeyValues)
keyValues = cfg.KeyValues
} else {
// TODO: This is a new code path for optimization,
// for now fall back to the slow path.
rec = acquireUninitializedKV[N](inst, cfg.Attributes.ToSlice())
keyValues = cfg.Attributes.ToSlice()
}

if inst.performance.MeasurementProcessor != nil {
keyValues = inst.performance.MeasurementProcessor.Process(ctx, keyValues)
}
rec := acquireUninitializedKV[N](inst, keyValues)

defer rec.refMapped.unref()

Expand Down

0 comments on commit 6f4779d

Please sign in to comment.