@@ -180,9 +180,10 @@ func (a *Aggregator) AggregateCombinedMetrics(
180180 cm * aggregationpb.CombinedMetrics ,
181181) error {
182182 cmIDAttrs := a .cfg .CombinedMetricsIDToKVs (cmk .ID )
183- traceAttrs := append (append ([]attribute. KeyValue {}, cmIDAttrs ... ) ,
183+ traceAttrs := append (cmIDAttrs ,
184184 attribute .String (aggregationIvlKey , formatDuration (cmk .Interval )),
185- attribute .String ("processing_time" , cmk .ProcessingTime .String ()))
185+ attribute .String ("processing_time" , cmk .ProcessingTime .String ()),
186+ )
186187 ctx , span := a .cfg .Tracer .Start (ctx , "AggregateCombinedMetrics" , trace .WithAttributes (traceAttrs ... ))
187188 defer span .End ()
188189
@@ -200,11 +201,12 @@ func (a *Aggregator) AggregateCombinedMetrics(
200201 if cmk .ProcessingTime .Before (a .processingTime .Add (- a .cfg .Lookback )) {
201202 a .metrics .EventsProcessed .Add (
202203 context .Background (), cm .EventsTotal ,
203- metric .WithAttributes (append (
204- a .cfg .CombinedMetricsIDToKVs (cmk .ID ),
205- attribute .String (aggregationIvlKey , formatDuration (cmk .Interval )),
206- telemetry .WithFailure (),
207- )... ),
204+ metric .WithAttributeSet (attribute .NewSet (
205+ append (a .cfg .CombinedMetricsIDToKVs (cmk .ID ),
206+ attribute .String (aggregationIvlKey , formatDuration (cmk .Interval )),
207+ telemetry .WithFailure (),
208+ )... ,
209+ )),
208210 )
209211 a .cfg .Logger .Warn (
210212 "received expired combined metrics, dropping silently" ,
@@ -517,10 +519,9 @@ func (a *Aggregator) harvestForInterval(
517519 }
518520 cmCount ++
519521
520- commonAttrsOpt := metric .WithAttributes (
522+ commonAttrsOpt := metric .WithAttributeSet ( attribute . NewSet (
521523 append (a .cfg .CombinedMetricsIDToKVs (cmk .ID ), ivlAttr )... ,
522- )
523- outcomeAttrOpt := metric .WithAttributes (telemetry .WithSuccess ())
524+ ))
524525
525526 // Report the estimated number of overflowed metrics per aggregation interval.
526527 // It is not meaningful to aggregate these across intervals or aggregators,
@@ -529,9 +530,11 @@ func (a *Aggregator) harvestForInterval(
529530 if n == 0 {
530531 return
531532 }
532- a .metrics .MetricsOverflowed .Add (context .Background (), int64 (n ), commonAttrsOpt , metric .WithAttributes (
533- attribute .String (aggregationTypeKey , aggregationType ),
534- ))
533+ a .metrics .MetricsOverflowed .Add (context .Background (), int64 (n ), commonAttrsOpt ,
534+ metric .WithAttributeSet (attribute .NewSet (
535+ attribute .String (aggregationTypeKey , aggregationType ),
536+ )),
537+ )
535538 }
536539 recordMetricsOverflow (harvestStats .servicesOverflowed , "service" )
537540 recordMetricsOverflow (harvestStats .transactionsOverflowed , "transaction" )
@@ -553,6 +556,9 @@ func (a *Aggregator) harvestForInterval(
553556 // Negative values are possible at edges due to delays in running the
554557 // harvest loop or time sync issues between agents and server.
555558 queuedDelay := time .Since (harvestStats .youngestEventTimestamp ).Seconds ()
559+ outcomeAttrOpt := metric .WithAttributeSet (attribute .NewSet (
560+ telemetry .WithSuccess ()),
561+ )
556562 a .metrics .MinQueuedDelay .Record (context .Background (), queuedDelay , commonAttrsOpt , outcomeAttrOpt )
557563 a .metrics .ProcessingLatency .Record (context .Background (), processingDelay , commonAttrsOpt , outcomeAttrOpt )
558564 // Events harvested have been successfully processed, publish these
0 commit comments