MCPcopy
hub / github.com/grafana/tempo / result

Method result

pkg/traceql/engine_metrics_average.go:66–107  ·  view source on GitHub ↗
(multiplier float64)

Source from the content-addressed store, hash-verified

64}
65
66func (a *averageOverTimeAggregator) result(multiplier float64) SeriesSet {
67 if a.agg != nil {
68 ss := a.agg.Series()
69 if multiplier > 1.0 {
70 countLabel := NewStaticString(internalMetaTypeCount)
71 for _, s := range ss {
72 // Skip non-count series.
73 found := false
74 for _, l := range s.Labels {
75 if l.Name == internalLabelMetaType && l.Value.Equals(&countLabel) {
76 found = true
77 break
78 }
79 }
80 if !found {
81 continue
82 }
83
84 // Found a count series, scale the values by the multiplier.
85 for i := range s.Values {
86 s.Values[i] *= multiplier
87 }
88 }
89 }
90 return ss
91 }
92
93 // In the frontend-version the results come from
94 // the job-level aggregator
95 ss := a.seriesAgg.Results()
96 if a.mode == AggregateModeFinal {
97 for i := range ss {
98 for _, l := range i {
99 if l.Name == internalLabelMetaType {
100 delete(ss, i)
101 break
102 }
103 }
104 }
105 }
106 return ss
107}
108
109func (a *averageOverTimeAggregator) length() int {
110 if a.agg != nil {

Callers

nothing calls this directly

Calls 4

NewStaticStringFunction · 0.85
EqualsMethod · 0.80
SeriesMethod · 0.65
ResultsMethod · 0.65

Tested by

no test coverage detected