Skip to content

Add tracing span support to tracing events in opentelemetry-appender-tracing #3221

@cijothomas

Description

@cijothomas

opentelemetry-appender-tracing crate currently converts tracing events to OpenTelemetry LogRecords but ignores span context. We should include span attributes in the LogRecord attributes when events are emitted within an active span (tracing span).

Current behavior:

let span = info_span!("request", user_id = 123, endpoint = "/api/users");
let _guard = span.enter();
info!(status = 200, "Request completed");
// LogRecord only contains: status = 200, message = "Request completed"

Desired behavior:

let span = info_span!("request", user_id = 123, endpoint = "/api/users");
let _guard = span.enter();
info!(status = 200, "Request completed");
// LogRecord should contain: status = 200, message = "Request completed", user_id = 123, endpoint = "/api/users"

This is distinct from the tracing-opentelemetry crate which converts tracing spans to OTel spans. This issue is specifically about enriching log records with span context from tracing.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions