Skip to content

feat: accept OTLP/HTTP protobuf on the logs, metrics and traces endpoints - #156

Merged
VibeSWE merged 9 commits into
mainfrom
feat/otlp-protobuf-ingest
Nov 24, 2026
Merged

VibeSWE merged 9 commits into
mainfrom
feat/otlp-protobuf-ingest

Conversation

@VibeSWE

@VibeSWE VibeSWE commented Nov 24, 2026 •

Copy link
Copy Markdown

Description

Ports upstream parseablehq#1869 (3767d384): the OTLP endpoints accept protobuf bodies as well as JSON.

  • POST /v1/logs, /v1/metrics and /v1/traces accept Content-Type: application/x-protobuf. A protobuf request gets a protobuf response. JSON requests behave as before.
  • The collector setups send protobuf. scripts/ingest.sh and scripts/ingest.ps1 probe the server with an empty protobuf request and write encoding: proto on success and encoding: json otherwise, so they still work against servers without this change. PARSEABLE_OTLP_ENCODING=json|proto skips the probe. The collector snippet in the UI uses encoding: proto.
  • Property and seeded tests compare protobuf ingestion with JSON ingestion of the same data (otel_protobuf_props.rs).
  • scripts/ingest-performance/otlp*.py measures the cost of each encoding against a running server.

The first commit is a separate upstream port (0de90cf2): the alert target outbound policy blocks NAT64 prefixes.

Measured

On a release build, protobuf takes 22–52% fewer server instructions per record than OTLP JSON, depending on the signal and record shape.

Verified

  • cargo test --lib: 1,450 passed, 0 failed.
  • An OpenTelemetry Collector 0.157.0 set up by scripts/ingest.sh chose protobuf against this server and JSON when forced; both datasets had the same 26 metric names and the same columns.

Not verified

  • scripts/ingest.ps1 was not run (no PowerShell available).
  • The Storybook story test edited here was not run; the story tests render empty in the environment used.

Left out

Upstream's handling of the X-P-Dataset-Tags header on these routes: #154.


This PR has:

  • been tested to ensure log ingestion and log query works.
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added documentation for new or modified features or behaviors.

🤖 Generated with Claude Code


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

VibeSWE and others added 7 commits November 23, 2026 14:46
Ports upstream parseablehq/parseable 0de90cf. Addresses in 64:ff9b::/96
(RFC 6052) and 64:ff9b:1::/48 (RFC 8215) embed an IPv4 destination, so a
target resolving to one could reach a private IPv4 address past the policy.
They now need allow_private plus an allowlist match, like other private ranges.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… endpoints

Ports the protobuf handling of upstream parseablehq/parseable 3767d38.
Requests with Content-Type application/x-protobuf were rejected as
unsupported. They are now decoded into the typed export request and flattened
by the protobuf flatteners the crate already had, then staged through the
same push_logs path, flatten budget and field-count check as OTLP JSON.

A malformed body is a 400 and produces no rows. The payload limit the routes
already apply is re-checked before decoding.

prost goes from 0.13 to 0.14 to match the version opentelemetry-proto
implements Message with; the lockfile only loses the unused 0.13 copy.

Upstream's surrounding refactor of flatten_and_push_logs and its dataset-tag
header handling are not part of this port.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…r review

- A successful protobuf export now carries Content-Type application/x-protobuf,
  as OTLP/HTTP requires (the full-success response encodes to zero bytes).
  JSON responses are unchanged.
- The decode error no longer repeats prost's own "failed to decode Protobuf
  message" prefix.
- Drop the payload-size re-check: the routes' PayloadConfig rejects an oversized
  body with 413 before the handler runs, so it could not fire. Without it the
  handler-level content-type test for protobuf is back.
- The truncation test claimed more than it proves: a body cut between two
  top-level entries is a valid shorter request.
- The ingestion UI said protobuf has to be converted by a collector.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Compare the same typed fixtures in a release decode and flatten example and in paired local-store experiments. Record server instructions and CPU time, require SQL row and identity parity, and probe the OTLP HTTP contract.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
…nst OTLP JSON

Replaces the single hand-written differential test of 42a2191 with
generated coverage of OtelProtobufRequest::{decode, flatten} and
flatten_and_push_otel_protobuf, in a test-only child module of ingest_utils:

- differential properties for logs, metrics and traces: protobuf
  encode/decode/flatten gives exactly the rows of OTLP JSON
  serialise/deserialize_otel_json/flatten, over requests the JSON mapping
  can carry, with every AnyValue variant, nesting, duplicate and reserved
  keys, all metric kinds with exemplars and flags, events, links, status,
  extreme ids, integers, timestamps and doubles;
- robustness: arbitrary, truncated, mutated and wrong-signal bodies never
  panic, decode deterministically, and a body that does not decode is
  refused by the entry point with the decode error;
- log flatten limits refuse the same requests with the same error and
  budget under both encodings;
- a seeded scenario (DST_SEED, DST_ITERS) of mixed encodings, damage and
  limits through decode and flatten, with a row-count model, cross-encoding
  checks and a same-seed determinism check;
- pinned tests of what the JSON path does with messages its mapping can not
  carry (non-finite doubles, empty AnyValue, strindex, silently dropped
  metrics, inexact doubles, nesting depth), and an ignored reproduction of
  a metrics flattener bug (metadata supplies the target_info timestamp).

Nothing touches the PARSEABLE global. Larger runs:
OTLP_PB_PROPTEST_CASES, OTLP_PB_PROPTEST_SEED.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The property and seeded tests were written against 42a2191. Since then the
payload-size re-check was removed from flatten_and_push_otel_protobuf, and the
metrics flatteners got their explicit-exemplar variants from the benchmark
commit, so the tests use those and no longer exercise a size refusal.

Also silence a clippy constant-assertion warning in the stage benchmark.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Protobuf costs the server 22-52% fewer instructions per record than
OTLP JSON and its requests are 39-43% of the size, so the generated
collector configurations now use it.

The host-metrics scripts can be pointed at any server version, so they
ask first: an empty protobuf export request to /v1/metrics is answered
200 by servers that accept protobuf and 400 by older ones. Anything but
a 2xx (old server, bad key, unreachable, no curl) keeps `encoding: json`,
which is what the scripts wrote before. PARSEABLE_OTLP_ENCODING=json or
proto skips the check.

The UI's collector.yaml is served by the server it will send to, so it
uses `encoding: proto` directly. Its curl sample stays JSON.

ingest.ps1 is not run here (no PowerShell on this machine); its check
falls back to JSON on any error.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
VibeSWE and others added 2 commits November 24, 2026 08:42
The note under the generated setup said the configuration uses JSON for
every OpenTelemetry source. The collector configuration now sends
protobuf; say so, and keep JSON for the OTLP HTTP sample.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The collector setup page now shows encoding: proto and says so in its
notes. The four baselines are the screenshots CI's pinned Playwright image
produced for this branch; each differs from the old one only in the
snippet's encoding line, the note under it and the OpenTelemetry side note.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@VibeSWE
VibeSWE merged commit 8150d35 into main Nov 24, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant