Skip to content

feat(codecs): convert native OTLP traces through the typed trace model in otlp serializer - #26606

Draft
thomasqueirozb wants to merge 2 commits into
bruceg/map-otlp-to-typed-tracefrom
feat/otlp-native-traces
Draft

thomasqueirozb wants to merge 2 commits into
bruceg/map-otlp-to-typed-tracefrom
feat/otlp-native-traces

Conversation

@thomasqueirozb

Copy link
Copy Markdown
Member

Summary

Stacked on #26590. The otlp codec now converts native trace events from the opentelemetry source (decoded without use_otlp_decoding) to OTLP spans, through legacy_to_typed and ExportTraceServiceRequest::from_events. Events that already have resourceSpans are still encoded as before. Datadog traces, and traces where every span is rejected, fail as encode errors.

Conversion issues are reported through a new rate-limited warning event (OtlpTraceConversionIssue). It does not count as an error or a drop because the event is still delivered. Feedback on this reporting choice is welcome.

References

Vector configuration

sources:
  otel_in:
    type: opentelemetry
    grpc:
      address: 0.0.0.0:43170
    http:
      address: 0.0.0.0:43180

sinks:
  to_collector:
    type: opentelemetry
    inputs: [otel_in.traces]
    protocol:
      type: http
      uri: http://127.0.0.1:44318/v1/traces
      encoding:
        codec: otlp

How did you test this PR?

  • Unit tests: flattened trace converted to OTLP; trace with only rejected spans is an error; Datadog trace is an error.
  • Sent 2 traces (4 spans) with telemetrygen to the config above, which forwarded them to an OpenTelemetry Collector 0.111.0 (debug exporter). All spans arrived with trace, span, and parent IDs, kind, timestamps, and attributes. No conversion warnings were logged.

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

@bruceg bruceg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found some must-fix issues below

Comment thread lib/codecs/src/encoding/format/otlp.rs Outdated
Comment thread lib/codecs/src/encoding/format/otlp.rs Outdated
Comment thread lib/codecs/src/internal_events.rs Outdated
@bruceg
bruceg force-pushed the bruceg/map-otlp-to-typed-trace branch from fec87db to 52e7390 Compare October 22, 2026 23:41
thomasqueirozb and others added 2 commits October 22, 2026 17:57
A conversion that yields no spans is success, so the otlp serializer omits
that event instead of failing the rest of the batch. Conversion issues are
reported as component errors with a bounded error code, and a Vector event
that encodes to nothing is counted as discarded. Spans that are still sent,
including ones whose timestamps were clamped, are not counted as discarded.

The HTTP sink does not post the resulting empty body. Finishing gzip or zstd
with no input still emits a frame, so the request builder returns an empty
payload before the compressor is finished. A collector rejects an empty body
with HTTP 400, which rejects acknowledgements for spans already consumed.
Dropping the request leaves the batch delivered.

Datadog traces are still rejected. The HTTP encoder keeps the codec error
text instead of replacing it with a generic encode failure.
@bruceg
bruceg force-pushed the feat/otlp-native-traces branch 2 times, most recently from 2ea77ee to 287c8bc Compare October 23, 2026 20:20
@github-actions github-actions Bot added domain:sinks Anything related to Vector's sinks domain:core Anything related to core crates i.e. vector-core, core-common, etc labels Oct 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain:core Anything related to core crates i.e. vector-core, core-common, etc domain:sinks Anything related to Vector's sinks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants