Skip to content

Commit dfec2ab

Browse files
authored
[memory] Include link attributes when searching by tags (#8077)
## Description of the changes - Memory storage was ignoring link attributes, which needs to be matched with query ## How was this change tested? - Unit Test ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/main/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [x] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully: `make lint test` ## AI Usage in this PR (choose one) See [AI Usage Policy](https://github.com/jaegertracing/jaeger/blob/main/CONTRIBUTING_GUIDELINES.md#ai-usage-policy). - [x] **None**: No AI tools were used in creating this PR - [ ] **Light**: AI provided minor assistance (formatting, simple suggestions) - [ ] **Moderate**: AI helped with code generation or debugging specific parts - [ ] **Heavy**: AI generated most or all of the code changes Signed-off-by: Manik Mehta <mehtamanik96@gmail.com>
1 parent bc7e679 commit dfec2ab

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

internal/storage/v2/memory/memory_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,12 @@ func TestFindTracesAttributesMatching(t *testing.T) {
229229
return td.ResourceSpans().At(0).ScopeSpans().At(0).Spans().At(0).Events().AppendEmpty().Attributes()
230230
},
231231
},
232+
{
233+
name: "link-attributes",
234+
attributes: func(td ptrace.Traces) pcommon.Map {
235+
return td.ResourceSpans().At(0).ScopeSpans().At(0).Spans().At(0).Links().AppendEmpty().Attributes()
236+
},
237+
},
232238
}
233239
store, err := NewStore(Configuration{
234240
MaxTraces: 10,

internal/storage/v2/memory/tenant.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,11 @@ func findKeyValInTrace(key string, val pcommon.Value, resourceAttributes pcommon
332332
return true
333333
}
334334
}
335+
for _, link := range span.Links().All() {
336+
if matchAttributes(key, val, link.Attributes()) {
337+
return true
338+
}
339+
}
335340
return tagsMatched
336341
}
337342

0 commit comments

Comments
 (0)