Expand description
OTLP/HTTP with a JSON body.
JSON is a normative encoding of OTLP, not an extra: the browser SDK emits it,
and it is what anyone reaches for with curl. The three endpoints in
crate::receiver dispatch on content-type and land here.
No new dependency. The document is parsed by the same yaml_rust2 loader
that reads queries and config (api::parse), because YAML 1.2 is a superset
of JSON β so this file is only the mapping from a parsed document onto the
prost structs. It also means a KYAML body works, which is principle 5 falling
out for free rather than being built.
Two places the OTLP JSON mapping is not the canonical protobuf one, and both are why an off-the-shelf reflective decoder is wrong here:
trace_id,span_idandparent_span_idare hex, not base64. A 32-character hex string is also valid base64, so a canonical decoder does not fail on one β it silently produces 24 bytes of nonsense. Every otherbytesfield really is base64.- 64-bit integers are strings.
time_unix_nanoarrives as"1544712660300000000"because a JSON number cannot hold it exactly. Numbers are accepted too; emitters disagree.
Everything here is lenient in the directions the spec allows and strict where
being lenient would store the wrong bytes: a field name may be either
lowerCamelCase or the original proto name, an enum may be its name or its
number, but an id of the wrong length is an error rather than a truncation.
ConstantsΒ§
- SEVERITY π
- SPAN_
KIND π - STATUS_
CODE π - TEMPORALITY π
FunctionsΒ§
- any_
value π - base64 π
- Standard base64 with padding, which is what proto3 JSON uses for every
bytesfield that is not an id. URL-safe input is accepted because it costs two match arms and a rejected attribute value is a lost attribute value. - boolean π
- buckets π
- data_
points π - dropped π
- enumerate π
- An enum, as its proto name or as its number.
names[i]is the name of valuei; every OTLP enum reached from here numbers from zero with no gaps. - exemplars π
- exp_
histogram_ πpoints - f π
- Look up one field.
- float π
- A double. proto3 JSON spells the three special values as strings, and lets any number arrive as a string as well.
- floats π
- hex π
- A trace or span id: lowercase or uppercase hex, exactly
wantbytes. - histogram_
points π - i32f π
- int π
- A 64-bit integer, as a JSON number or β the proto3 JSON default, because a double cannot hold one exactly β as a string.
- key_
values π - list π
- Absent, null and βpresent but emptyβ are the same thing to every caller here: proto3 has no way to tell them apart on the wire either.
- log_
record π - logs
- metric_
of π - metrics
- missing π
- number_
points π - number_
value π - The
asDouble/asIntoneof, shared byNumberDataPointandExemplar. - opt_
float π optional doublein the proto, so absent and0are different values and the difference is visible in a histogram.- resource π
- s π
- scope π
- scope_
logs π - scope_
metrics π - scope_
spans π - span π
- summary_
points π - temporality π
- top π
- The one top-level member of an export request, in either dialect.
- traces
- u32f π
- uint π
- Unsigned 64-bit. Values above
i64::MAXare legal forfixed64/uint64and arrive as strings, so they are parsed asu64rather than routed throughint, which would reject them. - uints π
Type AliasesΒ§
- R π