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

Method observe

pkg/traceql/engine_metrics_compare.go:113–136  ·  view source on GitHub ↗
(span Span)

Source from the content-addressed store, hash-verified

111}
112
113func (m *MetricsCompare) observe(span Span) {
114 // For performance, MetricsCompare doesn't use the Range/StepAggregator abstractions.
115 // This lets us:
116 // * Include the same attribute value in multiple series. This doesn't fit within
117 // the existing by() grouping or even the potential byeach() (which was in this branch and then deleted)
118 // * Avoid reading the span start time twice, once for the selection window filter, and
119 // then again instead of StepAggregator.
120 // TODO - It would be nice to use those abstractions, area for future improvement
121 st := span.StartTimeUnixNanos()
122 m.interval = m.intervalMapper.Interval(st)
123
124 // Determine if this span is inside the selection
125 // and choose destination buffers
126 if m.isSelection(span, st).Equals(&StaticTrue) {
127 m.dest = m.selections
128 m.destTotals = m.selectionTotals
129 } else {
130 m.dest = m.baselines
131 m.destTotals = m.baselineTotals
132 }
133
134 // Increment values for all attributes of this span
135 span.AllAttributesFunc(m.attrCallback)
136}
137
138// processAttribute is the callback for span.AllAttributesFunc.
139// But it's structured in a certain way to avoid allocating closures and escaping

Callers

nothing calls this directly

Calls 5

isSelectionMethod · 0.95
EqualsMethod · 0.80
StartTimeUnixNanosMethod · 0.65
IntervalMethod · 0.65
AllAttributesFuncMethod · 0.65

Tested by

no test coverage detected