existence
(t *testing.T, _ *tempopb.Trace, _ *tempopb.TraceSearchMetadata, _, _ []*tempopb.SearchRequest, meta *backend.BlockMeta, r Reader, _ common.BackendBlock)
| 1305 | |
| 1306 | // existence |
| 1307 | func traceQLExistence(t *testing.T, _ *tempopb.Trace, _ *tempopb.TraceSearchMetadata, _, _ []*tempopb.SearchRequest, meta *backend.BlockMeta, r Reader, _ common.BackendBlock) { |
| 1308 | ctx := context.Background() |
| 1309 | e := traceql.NewEngine() |
| 1310 | const intrinsicName = "name" |
| 1311 | |
| 1312 | type expected struct { |
| 1313 | key string |
| 1314 | } |
| 1315 | |
| 1316 | type test struct { |
| 1317 | req *tempopb.SearchRequest |
| 1318 | expected expected |
| 1319 | } |
| 1320 | |
| 1321 | searchesThatMatch := []*test{ |
| 1322 | { |
| 1323 | req: &tempopb.SearchRequest{Query: "{ span.foo != nil }", Limit: 10}, |
| 1324 | expected: expected{ |
| 1325 | key: "foo", |
| 1326 | }, |
| 1327 | }, |
| 1328 | { |
| 1329 | req: &tempopb.SearchRequest{Query: "{ nil != span.foo }", Limit: 10}, |
| 1330 | expected: expected{ |
| 1331 | key: "foo", |
| 1332 | }, |
| 1333 | }, |
| 1334 | { |
| 1335 | req: &tempopb.SearchRequest{Query: "{ name != nil }", Limit: 10}, |
| 1336 | expected: expected{ |
| 1337 | key: intrinsicName, |
| 1338 | }, |
| 1339 | }, |
| 1340 | { |
| 1341 | req: &tempopb.SearchRequest{Query: "{ duration != nil }", Limit: 10}, |
| 1342 | expected: expected{ |
| 1343 | key: "duration", |
| 1344 | }, |
| 1345 | }, |
| 1346 | { |
| 1347 | req: &tempopb.SearchRequest{Query: "{ nil != duration }", Limit: 10}, |
| 1348 | expected: expected{ |
| 1349 | key: "duration", |
| 1350 | }, |
| 1351 | }, |
| 1352 | { |
| 1353 | req: &tempopb.SearchRequest{Query: "{ resource.service.name != nil }", Limit: 10}, |
| 1354 | expected: expected{ |
| 1355 | key: "service.name", |
| 1356 | }, |
| 1357 | }, |
| 1358 | { |
| 1359 | req: &tempopb.SearchRequest{Query: "{ nil != resource.service.name }", Limit: 10}, |
| 1360 | expected: expected{ |
| 1361 | key: "service.name", |
| 1362 | }, |
| 1363 | }, |
| 1364 | } |
nothing calls this directly
no test coverage detected