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)
| 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). |
| 2146 | func 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 |
| 2167 | func processTopK(input SeriesSet, valueLength, limit int) SeriesSet { |
no test coverage detected