You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-07-15 01:04:25 +02:00
Do not return agg if adding err-ed
This commit is contained in:
@ -216,14 +216,17 @@ func (i *inserter[N]) Instrument(inst view.Instrument, instUnit unit.Unit) ([]in
|
|||||||
if agg == nil { // Drop aggregator.
|
if agg == nil { // Drop aggregator.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
err = i.pipeline.addAggregator(inst.Scope, inst.Name, inst.Description, instUnit, agg)
|
||||||
|
if err != nil {
|
||||||
|
errs.append(err)
|
||||||
|
// Do not return the aggregator to be updated if the pipeline will
|
||||||
|
// never produce from it.
|
||||||
|
continue
|
||||||
|
}
|
||||||
// TODO (#3011): If filtering is done at the instrument level add here.
|
// TODO (#3011): If filtering is done at the instrument level add here.
|
||||||
// This is where the aggregator and the view are both in scope.
|
// This is where the aggregator and the view are both in scope.
|
||||||
aggs = append(aggs, agg)
|
aggs = append(aggs, agg)
|
||||||
seen[id] = struct{}{}
|
seen[id] = struct{}{}
|
||||||
err = i.pipeline.addAggregator(inst.Scope, inst.Name, inst.Description, instUnit, agg)
|
|
||||||
if err != nil {
|
|
||||||
errs.append(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !matched { // Apply implicit default view if no explicit matched.
|
if !matched { // Apply implicit default view if no explicit matched.
|
||||||
@ -232,10 +235,13 @@ func (i *inserter[N]) Instrument(inst view.Instrument, instUnit unit.Unit) ([]in
|
|||||||
errs.append(err)
|
errs.append(err)
|
||||||
}
|
}
|
||||||
if a != nil {
|
if a != nil {
|
||||||
aggs = append(aggs, a)
|
|
||||||
err = i.pipeline.addAggregator(inst.Scope, inst.Name, inst.Description, instUnit, a)
|
err = i.pipeline.addAggregator(inst.Scope, inst.Name, inst.Description, instUnit, a)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// Do not return the aggregator to be updated if the pipeline
|
||||||
|
// will never produce from it.
|
||||||
errs.append(err)
|
errs.append(err)
|
||||||
|
} else {
|
||||||
|
aggs = append(aggs, a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user