[fix] Resolve Annotations created as Invocations if links={}#4385
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates trace-type inference so that annotations created with an explicitly provided but empty links payload (e.g., links={} from the frontend, converted to []) are classified as ANNOTATION rather than INVOCATION.
Changes:
- Updated
infer_and_propagate_trace_type_by_traceto treat “links explicitly set” (including[]) as an annotation signal. - Added a unit test to ensure
links=[]is classified asANNOTATIONwhilelinks=NoneremainsINVOCATION.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
api/oss/src/core/tracing/utils/trees.py |
Changes the trace-type inference predicate from “non-empty links” to “links not None”. |
api/oss/tests/pytest/unit/tracing/utils/test_trees.py |
Adds coverage for links=[] being treated as an annotation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| trace_key = str(trace_spans[0].trace_id) | ||
| trace_types_by_trace[trace_key] = ( | ||
| TraceType.ANNOTATION | ||
| if any(span.links for span in trace_spans) | ||
| if any(span.links is not None for span in trace_spans) | ||
| else TraceType.INVOCATION |
| def test_infer_and_propagate_trace_type_by_trace_treats_empty_links_as_annotation(): | ||
| # A queue annotation on a testcase has no link target, so the frontend sends | ||
| # links={}, which build_otel_links converts to an empty list []. An explicitly | ||
| # set (even empty) links list means annotation; only None means invocation. | ||
| trace_a = "trace-a" |
No description provided.