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

Function convertProtoLabelsToTraceQL

pkg/traceql/engine_metrics.go:2146–2164  ·  view source on GitHub ↗

convertProtoLabelsToTraceQL converts protobuf labels to traceql Labels format. If skipBucket is true, it will skip any label with key matching internalLabelBucket. Returns the converted labels and the bucket value (if found and not skipped).

(protoLabels []commonv1proto.KeyValue, skipBucket bool)

Source from the content-addressed store, hash-verified

2144// If skipBucket is true, it will skip any label with key matching internalLabelBucket.
2145// Returns the converted labels and the bucket value (if found and not skipped).
2146func convertProtoLabelsToTraceQL(protoLabels []commonv1proto.KeyValue, skipBucket bool) (Labels, Static) {
2147 // TODO: consider memory pooling for Labels and Static to reduce allocations
2148 labels := make(Labels, 0, len(protoLabels))
2149 var bucket Static
2150
2151 for i := range protoLabels {
2152 l := &protoLabels[i]
2153 if skipBucket && l.Key == internalLabelBucket {
2154 bucket = StaticFromAnyValue(l.Value)
2155 continue
2156 }
2157 labels = append(labels, Label{
2158 Name: l.Key,
2159 Value: StaticFromAnyValue(l.Value),
2160 })
2161 }
2162
2163 return labels, bucket
2164}
2165
2166// processTopK implements TopKBottomK topk method
2167func processTopK(input SeriesSet, valueLength, limit int) SeriesSet {

Callers 3

CombineMethod · 0.85
aggregateExemplarsMethod · 0.85
CombineMethod · 0.85

Calls 1

StaticFromAnyValueFunction · 0.85

Tested by

no test coverage detected