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

Print Span.TraceState() in debugexporter #10421

Merged
merged 5 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .chloggen/print-tracestate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: debugexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Print Span.TraceState() when present.

# One or more tracking issues or pull requests related to the change
issues: [10421]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: Enables viewing sampling threshold information (as by OTEP 235 samplers).

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
1 change: 1 addition & 0 deletions exporter/internal/otlptext/testdata/traces/two_spans.out
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Span #0
ID : 1112131415161718
Name : operationA
Kind : Unspecified
TraceState : ot=th:0
Start time : 2020-02-11 20:26:12.000000321 +0000 UTC
End time : 2020-02-11 20:26:13.000000789 +0000 UTC
Status code : Error
Expand Down
3 changes: 3 additions & 0 deletions exporter/internal/otlptext/traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ func (textTracesMarshaler) MarshalTraces(td ptrace.Traces) ([]byte, error) {
buf.logAttr("ID", span.SpanID())
buf.logAttr("Name", span.Name())
buf.logAttr("Kind", span.Kind().String())
if ts := span.TraceState().AsRaw(); len(ts) != 0 {
buf.logAttr("TraceState", ts)
}
buf.logAttr("Start time", span.StartTimestamp().String())
buf.logAttr("End time", span.EndTimestamp().String())

Expand Down
1 change: 1 addition & 0 deletions pdata/testdata/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func fillSpanOne(span ptrace.Span) {
span.SetStartTimestamp(spanStartTimestamp)
span.SetEndTimestamp(spanEndTimestamp)
span.SetDroppedAttributesCount(1)
span.TraceState().FromRaw("ot=th:0") // 100% sampling
span.SetTraceID([16]byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10})
span.SetSpanID([8]byte{0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18})
evs := span.Events()
Expand Down
Loading