Expand description
OTLP/HTTP payloads: decoding an export request into the summary the model sees, and encoding every response the receiver sends.
Pure functions, shared by the server, the tests and nothing else. The model never sees a
payload: it gets counts, the service name, a few resource attributes and the first few span
names, metric names or log bodies, each truncated. It never writes one either: every
response body — the empty full-success message, a partial success, a google.rpc.Status — is
encoded here, in the encoding the request used.
Protobuf is decoded with the OpenTelemetry project’s own generated types
(opentelemetry-proto, prost). prost stops at 100 levels of nesting, so a depth bomb in an
AnyValue is a decode error, not a stack overflow. JSON is parsed as a serde_json::Value
(recursion limit 128) and walked by hand rather than through the crate’s serde types, because
OTLP/JSON senders differ in ways a strict typed decode would refuse (64-bit integers as
numbers or strings, enum values as numbers or names); keys are accepted in lowerCamelCase, as
the specification writes them, and in the proto’s own snake_case. Neither walk recurses into
attribute values: an array or map is summarised by its length.
Structs§
- RpcStatus
google.rpc.Status, the body of every OTLP/HTTP failure response.- Summary
- What the model is told about one export.
Enums§
- Body
Error - Why a body could not be read.
- Encoding
- The two encodings OTLP/HTTP defines.
- Signal
- The three signals and their paths.
Constants§
- MAX_
ATTRIBUTES - MAX_
BODY_ BYTES - The largest request body the receiver reads, after decompression: 4 MiB, the default message limit of the gRPC servers OTLP receivers are built on and what SDK exporters batch under. A gzip body is held to the same number once inflated, so a small compressed body cannot expand past it.
- MAX_
LOG_ BODIES - MAX_
NAMES - How much of an export the model is shown.
- MAX_
SERVICES - REJECT_
STATUSES - The statuses a model may refuse with. 429, 502, 503 and 504 are the ones OTLP clients retry.
Functions§
- export_
response - The export response: full success when
partialisNone, else a partial success naming how many items were rejected and why. - grpc_
code - The gRPC code an HTTP failure status corresponds to, per the OTLP specification’s mapping.
- gunzip_
bounded - Inflate a gzip body, refusing it as soon as it passes
limitbytes. Never allocates more thanlimit + 1bytes of output. - retryable
- Whether an OTLP client retries after this status.
- status_
body - A failure body in the request’s encoding.
- summarize
- Decode a request in either encoding.
- summarize_
json - Decode an OTLP/JSON export request.
- summarize_
protobuf - Decode a protobuf export request.