Skip to content
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

otelslog: Ability to set TraceID and SpanID on logs #6307

Open
jm96441n opened this issue Nov 7, 2024 · 2 comments
Open

otelslog: Ability to set TraceID and SpanID on logs #6307

jm96441n opened this issue Nov 7, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@jm96441n
Copy link

jm96441n commented Nov 7, 2024

Problem Statement

Most (if not all) APM providers have the ability to connect logs with traces via a traceID and spanID on the log. The otelslog bridge (and by extension the others) should have the ability to set the top level (as defined in log contexts here) TraceID and SpanID. The sdk/log package supports this which makes working with the bridges particularly frustrating as you need to write a complex transformer for an otel collector in order to set these fields.

Proposed Solution

Have the convertRecord function be able to extract an attribute of trace_id and span_id and have them be set on the Record struct so that the top level attributes can be set.

Alternatives

Not doing this and continuing to have to write convoluted transformers for logs.

Prior Art

The sdk/log package handles this use case.

Additional Context

Add any other context or screenshots about the feature request here.

@jm96441n jm96441n added the enhancement New feature or request label Nov 7, 2024
@dmathieu
Copy link
Member

While I agree with you that setting the span and trace IDs from attributes makes sense, I can't find trace_id or span_id as semantic conventions.
We'd need that before we can accept that kind of behavior.

@jm96441n
Copy link
Author

along those lines is there an expected way to set the TraceID and SpanID fields for the otel log format? I've been trying to get it working via a transformer in the collector yaml, but it's tricky to get it right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants