Use OTel Status.Code to filter error traces in search_traces#8554
Open
Sofiyan-Shaikh wants to merge 2 commits into
Open
Use OTel Status.Code to filter error traces in search_traces#8554Sofiyan-Shaikh wants to merge 2 commits into
Sofiyan-Shaikh wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes search_traces’s with_errors=true behavior for OpenTelemetry traces by filtering based on OTel span Status.Code=Error instead of the legacy Jaeger v1 error=true attribute tag, ensuring OTel error traces are no longer silently omitted.
Changes:
- Remove injection of
error=trueinto the storage query parameters. - Add post-retrieval filtering to drop traces that have no spans with
Status.Code=Errorwhenwith_errors=true. - Update and add unit tests to validate the new filtering behavior, including the “OTel status only” bug scenario.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cmd/jaeger/internal/extension/jaegermcp/internal/handlers/search_traces.go | Moves with_errors filtering from query-time (legacy tag) to post-retrieval filtering using OTel Status.Code. |
| cmd/jaeger/internal/extension/jaegermcp/internal/handlers/search_traces_test.go | Updates existing with_errors test expectations and adds coverage for OTel error traces without legacy error=true tags. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
80
to
+83
| summary := buildTraceSummary(trace) | ||
| if input.WithErrors && !summary.HasErrors { | ||
| continue | ||
| } |
…event missing error traces
Author
|
Hi @yurishkuro, I've implemented the fix for OTel error filtering and added logic to expand the search depth to ensure reliable results. I'd appreciate your review when you have a moment. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which problem is this PR solving?
search_traceswithwith_errors=truewas silently missing all OTel error traces because it filtered by the legacy Jaeger v1error=trueattribute tag instead ofStatus.Code = Error.issues : #8553
Description of the changes
attributes.PutStr("error", "true")frombuildQuery— the Jaeger v1 attribute tag is no longer sent to storage as a filter.handleloop: traces where no span hasStatus.Code = Errorare skipped whenwith_errors=true.How was this change tested?
TestSearchTracesHandler_Handle_WithErrorsFilterto asserterror=trueattribute is no longer injected into the query, and that the handler correctly filters non-error traces out.TestSearchTracesHandler_Handle_WithErrorsFilter_OTelStatusOnlycovering the exact bug scenario — a GenAI trace withfinish_reason=content_filterandStatus.Code=Errorbut noerror=truetag.TestSearchTracesHandler_Handle_WithErrorsFilter_UsingMemoryStorecontinues to pass end-to-end.AI Usage in this PR (choose one)
See AI Usage Policy.
Checklist
make lint test