-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix debug exporter: render TraceID and SpanID as attributes #14489
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: main
Are you sure you want to change the base?
Fix debug exporter: render TraceID and SpanID as attributes #14489
Conversation
|
I cleaned up the branch, removed duplicated diffs, and force-pushed a single clean commit. Thanks for the review. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14489 +/- ##
==========================================
- Coverage 91.84% 91.82% -0.03%
==========================================
Files 677 677
Lines 42699 42699
==========================================
- Hits 39219 39210 -9
- Misses 2425 2431 +6
- Partials 1055 1058 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
andrzej-stencel
left a comment
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.
This pull request tries to make the same change as #14472, which I rejected as incorrect. What is the reason for this PR?
|
Thanks for pointing this out. I wasn’t aware that #14472 was rejected for functional reasons. Could you clarify what aspect of this approach is not desired, or what the correct direction should be for #14471? |
I think you meant #13207 and not #14471? As pointed out in my comments on the previous PR #14472 (review) and on the original issue #13207 (comment), I believe there's nothing to fix, current behavior is correct. |
|
After writing the above comment, I took a closer look and noticed that while the log record rendering in Debug exporter uses the Logs - log fields are not indented: Logs {"resource logs": 1, "log records": 1}
ResourceLog #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.25.0
Resource attributes:
-> service.name: Str(telemetrygen)
ScopeLogs #0
ScopeLogs SchemaURL:
InstrumentationScope
LogRecord #0
ObservedTimestamp: 1970-01-01 00:00:00 +0000 UTC
Timestamp: 2026-01-29 11:10:22.325817 +0000 UTC
SeverityText: Info
SeverityNumber: Info(9)
Body: Str(the message)
Attributes:
-> app: Str(server)
Trace ID:
Span ID:
Flags: 0Traces - span fields are indented: Traces {"resource spans": 1, "spans": 2}
ResourceSpans #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.25.0
Resource attributes:
-> service.name: Str(telemetrygen)
ScopeSpans #0
ScopeSpans SchemaURL:
InstrumentationScope telemetrygen
Span #0
Trace ID : 7d2763b32e70fcbc74eae972eca5c3fb
Parent ID : fa600bbfc591d824
ID : 35d7e0fa55c783d3
Name : okey-dokey-0
Kind : Server
Start time : 2026-01-29 11:10:37.810223 +0000 UTC
End time : 2026-01-29 11:10:37.810346 +0000 UTC
Status code : Unset
Status message :
DroppedAttributesCount: 0
DroppedEventsCount: 0
DroppedLinksCount: 0
Attributes:
-> net.sock.peer.addr: Str(1.2.3.4)
-> peer.service: Str(telemetrygen-client)This is an inconsistency in the For completeness, here's output of metrics (no indentation): Metrics {"resource metrics": 1, "metrics": 1, "data points": 1}
ResourceMetrics #0
Resource SchemaURL: https://opentelemetry.io/schemas/1.13.0
Resource attributes:
-> service.name: Str(telemetrygen)
ScopeMetrics #0
ScopeMetrics SchemaURL:
InstrumentationScope
Metric #0
Descriptor:
-> Name: gen
-> Description:
-> Unit:
-> DataType: Gauge
NumberDataPoints #0
StartTimestamp: 1970-01-01 00:00:00 +0000 UTC
Timestamp: 2026-01-29 11:10:31.569929 +0000 UTC
Value: 0I didn't check profiles, because telemetrygen does not support profiles yet if I'm not mistaken. |
Description
The debug exporter was rendering TraceID and SpanID using
logEntry, which causedmisaligned output compared to other fields rendered as attributes.
This change updates the debug exporter to render TraceID and SpanID using
logAttr, ensuring consistent formatting and column alignment with the restof the log output.
Link to tracking issue
Fixes #14471
Testing
go test ./...go build ./...Documentation
No documentation changes were required.