Skip to content

fix: extract trace context from diagnostics - #235

Open
YCCDSZXH wants to merge 2 commits into
fast:mainfrom
YCCDSZXH:main
Open

fix: extract trace context from diagnostics#235
YCCDSZXH wants to merge 2 commits into
fast:mainfrom
YCCDSZXH:main

Conversation

@YCCDSZXH

Copy link
Copy Markdown

No description provided.

@tisonkun

tisonkun commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@YCCDSZXH Thanks for your contribution!

I wonder if this patch would cause a:

  1. OpentelemetryLog appender
  2. FastraceEvent append
  3. FastraceDiagnostic
  4. fastrace with OpentelemetryCollector

... setup falls into an infinite loop, or duplicate log entries.

cc @andylokandy

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the OpenTelemetry appender to extract trace context fields from diagnostics and attach them to emitted OpenTelemetry log records, enabling backend trace-log correlation.

Changes:

  • Adds a TraceContextExtractor visitor wrapper to parse trace_id, span_id, and sampling info from diagnostic key-values.
  • Sets SdkLogRecord trace context via set_trace_context(...) when trace fields are present.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Some((
self.trace_id?,
self.span_id?,
TraceFlags::NOT_SAMPLED.with_sampled(self.sampled?),
.and_then(|value| SpanId::from_hex(value).ok())
.filter(|span_id| *span_id != SpanId::INVALID);
}
"sampled" if self.sampled.is_none() => {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants