-
Notifications
You must be signed in to change notification settings - Fork 626
fix: Remove 0000 trace_id fallbacks #6570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -622,7 +622,7 @@ def get_trace_context(self) -> "Dict[str, Any]": | |
| if ( | ||
| has_tracing_enabled(self.get_client().options) | ||
| and self._span is not None | ||
| and not isinstance(self._span, NoOpStreamedSpan) | ||
| and not isinstance(self._span, (NoOpStreamedSpan, NoOpSpan)) | ||
| ): | ||
| return self._span._get_trace_context() | ||
|
|
||
|
|
@@ -693,7 +693,7 @@ def iter_trace_propagation_headers( | |
| if ( | ||
| has_tracing_enabled(client.options) | ||
| and span is not None | ||
| and not isinstance(span, NoOpStreamedSpan) | ||
| and not isinstance(span, (NoOpStreamedSpan, NoOpSpan)) | ||
| ): | ||
| for header in span._iter_headers(): | ||
| yield header | ||
|
|
@@ -1859,17 +1859,15 @@ def apply_to_telemetry(self, telemetry: "Union[Log, Metric, StreamedSpan]") -> N | |
| if not isinstance(telemetry, StreamedSpan): | ||
| trace_context = self.get_trace_context() | ||
| trace_id = trace_context.get("trace_id") | ||
| if telemetry.get("trace_id") is None: | ||
| telemetry["trace_id"] = ( | ||
| trace_id or "00000000-0000-0000-0000-000000000000" | ||
| ) | ||
| if telemetry.get("trace_id") is None and trace_id is not None: | ||
| telemetry["trace_id"] = trace_id | ||
|
sl0thentr0py marked this conversation as resolved.
|
||
|
|
||
| # span_id should only be populated if there's an active span. We can't | ||
| # use the trace_context here because it synthesizes a span_id if there | ||
| # isn't one | ||
| if telemetry.get("span_id") is None: | ||
| if self._span is not None and not isinstance( | ||
| self._span, NoOpStreamedSpan | ||
| self._span, (NoOpStreamedSpan, NoOpSpan) | ||
| ): | ||
| telemetry["span_id"] = self._span.span_id | ||
| else: | ||
|
Comment on lines
+1863
to
1873
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The test Suggested FixUpdate the assertion in the Prompt for AI AgentAlso affects:
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generalized these instance checks just in case