diff --git a/.chloggen/fix-14202.yaml b/.chloggen/fix-14202.yaml new file mode 100644 index 00000000000..2d2ff4188fd --- /dev/null +++ b/.chloggen/fix-14202.yaml @@ -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. receiver/otlp) +component: exporter/debug + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Added logging for dropped attributes, events, and links counts in debug exporter OTLP text traces marshaler." + +# One or more tracking issues or pull requests related to the change +issues: [14202] + +# (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: + +# 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] diff --git a/exporter/debugexporter/internal/otlptext/testdata/traces/traces_with_entity_refs.out b/exporter/debugexporter/internal/otlptext/testdata/traces/traces_with_entity_refs.out index 88b5e40568a..bf3053307de 100644 --- a/exporter/debugexporter/internal/otlptext/testdata/traces/traces_with_entity_refs.out +++ b/exporter/debugexporter/internal/otlptext/testdata/traces/traces_with_entity_refs.out @@ -29,3 +29,6 @@ Span #0 End time : 1970-01-01 00:00:00 +0000 UTC Status code : Unset Status message : + DroppedAttributesCount: 0 + DroppedEventsCount: 0 + DroppedLinksCount: 0 diff --git a/exporter/debugexporter/internal/otlptext/testdata/traces/two_spans.out b/exporter/debugexporter/internal/otlptext/testdata/traces/two_spans.out index 9cb3ac75038..442dd3fe33e 100644 --- a/exporter/debugexporter/internal/otlptext/testdata/traces/two_spans.out +++ b/exporter/debugexporter/internal/otlptext/testdata/traces/two_spans.out @@ -16,6 +16,7 @@ Span #0 End time : 2020-02-11 20:26:13.000000789 +0000 UTC Status code : Error Status message : status-cancelled + DroppedAttributesCount: 1 Events: SpanEvent #0 -> Name: event-with-attr @@ -27,6 +28,8 @@ SpanEvent #1 -> Name: event -> Timestamp: 2020-02-11 20:26:13.000000123 +0000 UTC -> DroppedAttributesCount: 2 + DroppedEventsCount: 1 + DroppedLinksCount: 0 Span #1 Trace ID : Parent ID : @@ -37,6 +40,8 @@ Span #1 End time : 2020-02-11 20:26:13.000000789 +0000 UTC Status code : Unset Status message : + DroppedAttributesCount: 0 + DroppedEventsCount: 0 Links: SpanLink #0 -> Trace ID: @@ -50,3 +55,4 @@ SpanLink #1 -> ID: -> TraceState: -> DroppedAttributesCount: 4 + DroppedLinksCount: 3 diff --git a/exporter/debugexporter/internal/otlptext/traces.go b/exporter/debugexporter/internal/otlptext/traces.go index 190bab5dcd1..71b937a57d2 100644 --- a/exporter/debugexporter/internal/otlptext/traces.go +++ b/exporter/debugexporter/internal/otlptext/traces.go @@ -4,6 +4,8 @@ package otlptext // import "go.opentelemetry.io/collector/exporter/debugexporter/internal/otlptext" import ( + "strconv" + "go.opentelemetry.io/collector/pdata/ptrace" ) @@ -50,8 +52,11 @@ func (textTracesMarshaler) MarshalTraces(td ptrace.Traces) ([]byte, error) { buf.logAttr("Status message", span.Status().Message()) buf.logAttributes("Attributes", span.Attributes()) + buf.logAttr("DroppedAttributesCount", strconv.FormatUint(uint64(span.DroppedAttributesCount()), 10)) buf.logEvents("Events", span.Events()) + buf.logAttr("DroppedEventsCount", strconv.FormatUint(uint64(span.DroppedEventsCount()), 10)) buf.logLinks("Links", span.Links()) + buf.logAttr("DroppedLinksCount", strconv.FormatUint(uint64(span.DroppedLinksCount()), 10)) } } }