Expand description
JSON “log exporter” trace encoder.
Emits traces in the newline-delimited JSON format consumed by the Datadog Forwarder Lambda (the legacy serverless path used when no Datadog Agent / Lambda Extension is reachable). Each emitted line is a self-contained JSON document of the form:
{"traces":[[ {span}, {span}, ... ]]}\nSpans are greedily packed into size-bounded lines. A single span that alone
exceeds the line cap is dropped (and counted in EncodeStats::spans_dropped)
rather than emitted as a truncated, unparseable line.
See the cross-language specification for the wire contract and the
Forwarder’s is_trace detection requirements.
Structs§
- Encode
Stats - Statistics reported by
encode_traces.
Functions§
- encode_
traces - Encodes
tracesinto newline-delimited JSON “log exporter” lines, writing them toout. - encode_
traces_ v1 - Encodes a v1
TracerPayloadinto newline-delimited JSON “log exporter” lines, writing them toout. Same framing, packing, and oversized-span dropping behavior asencode_traces— see its docs — but takes v1TracerPayload/crate::span::v1::Spaninput and downgrades each span’s unified attribute model back to themeta/metrics-shaped wire span via [span_v1::LogSpanV1], since the JSON log wire contract (consumed by the Datadog Forwarder Lambda) is unchanged by the v1 migration. Payload-levelenv/app_version/attributesare propagated into every span (lowest precedence, below chunk and span level) — same convention as the msgpack v0.4 downgrade encoder’sencode_payload_from_v1.