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

Function nestedSet

tempodb/tempodb_search_test.go:1113–1304  ·  view source on GitHub ↗
(t *testing.T, _ *tempopb.Trace, wantMeta *tempopb.TraceSearchMetadata, _, _ []*tempopb.SearchRequest, meta *backend.BlockMeta, r Reader, _ common.BackendBlock)

Source from the content-addressed store, hash-verified

1111}
1112
1113func nestedSet(t *testing.T, _ *tempopb.Trace, wantMeta *tempopb.TraceSearchMetadata, _, _ []*tempopb.SearchRequest, meta *backend.BlockMeta, r Reader, _ common.BackendBlock) {
1114 ctx := context.Background()
1115 e := traceql.NewEngine()
1116
1117 type test struct {
1118 req *tempopb.SearchRequest
1119 expected []*tempopb.TraceSearchMetadata
1120 }
1121
1122 searchesThatMatch := []*test{
1123 {
1124 req: &tempopb.SearchRequest{Query: "{ .parent } | select(nestedSetLeft)"},
1125 expected: []*tempopb.TraceSearchMetadata{
1126 {
1127 SpanSets: []*tempopb.SpanSet{
1128 {
1129 Spans: []*tempopb.Span{
1130 {
1131 SpanID: "0000000000040506",
1132 StartTimeUnixNano: 1000000000000,
1133 DurationNanos: 2000000000,
1134 Name: "",
1135 Attributes: []*v1_common.KeyValue{
1136 {Key: "nestedSetLeft", Value: &v1_common.AnyValue{Value: &v1_common.AnyValue_IntValue{IntValue: 1}}},
1137 {Key: "parent", Value: &v1_common.AnyValue{Value: &v1_common.AnyValue_BoolValue{BoolValue: true}}},
1138 },
1139 },
1140 },
1141 Matched: 1,
1142 },
1143 },
1144 },
1145 },
1146 },
1147 {
1148 req: &tempopb.SearchRequest{Query: "{ name = `BrokenSpan` } | select(nestedSetRight, nestedSetLeft, nestedSetParent)"},
1149 expected: []*tempopb.TraceSearchMetadata{
1150 {
1151 SpanSets: []*tempopb.SpanSet{
1152 {
1153 Spans: []*tempopb.Span{
1154 {
1155 SpanID: "0000000000000000",
1156 StartTimeUnixNano: 1000000000000,
1157 DurationNanos: 1000000000,
1158 Name: "BrokenSpan",
1159 Attributes: []*v1_common.KeyValue{
1160 {Key: "nestedSetLeft", Value: &v1_common.AnyValue{Value: &v1_common.AnyValue_IntValue{IntValue: 0}}},
1161 {Key: "nestedSetParent", Value: &v1_common.AnyValue{Value: &v1_common.AnyValue_IntValue{IntValue: 0}}},
1162 {Key: "nestedSetRight", Value: &v1_common.AnyValue{Value: &v1_common.AnyValue_IntValue{IntValue: 0}}},
1163 },
1164 },
1165 },
1166 Matched: 1,
1167 },
1168 },
1169 },
1170 },

Callers

nothing calls this directly

Calls 6

ExecuteSearchMethod · 0.95
NewEngineFunction · 0.92
NewSpansetFetcherWrapperFunction · 0.92
DefaultSearchOptionsFunction · 0.92
FetchMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected