Skip to content

feat(deploy): warm-tier OTLP end-to-end — gateway → backend OTLP, alt query_engine_rust image - #205

Merged
zzylol merged 1 commit into
mainfrom
deploy/warm-tier-otlp-v2
May 1, 2026
Merged

zzylol merged 1 commit into
mainfrom
deploy/warm-tier-otlp-v2

Conversation

@zzylol

@zzylol zzylol commented May 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes the warm-tier sketch path in the deploy stack. Follows up on the recently-merged #204; companion PR ASAPQuery-backend#69 lands the matching OTLP receiver on the backend.

With #204's runtime path landed, sketches were still getting dropped at the OTel gateway because prometheusremotewrite can't translate the typed Metric.data variants — so the e2e only flowed through the cold tier. This PR closes that, in both forms #204's PROGRESS.md item 1 named.

(a) OTLP on the existing precompute_engine binary — default path

  • gateway.yaml: metrics pipeline now exports through otlp/backend (gRPC → backend:4317, insecure, sending_queue on) instead of prometheusremotewrite/backend. PRW exporter retained as a non-active fallback for legacy clients / direct PRW writers (it's not in service.pipelines.metrics.exporters).
  • base.yml: backend command picks up --enable-otel-ingest --otel-grpc-port=4317 --otel-http-port=4318. OTLP stays intra-docker; the 19090/19091 host mappings are unchanged.

(b) Alternative query_engine_rust image — opt-in via overlay

  • Dockerfile.backend.queryengine (new): same multi-stage build as Dockerfile.backend but ships query_engine_rust (the workspace's default binary). Use when the deploy needs the binary's extra subsystems — controller capability-miss callbacks, query tracker, schema eviction, backfill worker — that precompute_engine doesn't wire up.
  • queryengine-overlay.yml (new): compose overlay that swaps the backend image to asap/query-backend-queryengine:dev and provides the larger required flag set. Same OTLP wire on :4317, host port 19091 still serves PromQL across both backend variants.

PROGRESS.md

Follow-up #1 marked done. P3 row's limitation note updated.

Why both, not just (a)?

(a) solves the e2e goal end-to-end with the focused binary the harness drives today. (b) is the path forward when you want the controller in-loop on capability misses (which closes the loop on the project's stated North Star — the controller decides where each sketch is computed — for queries the agent's current sketch can't answer). They share the same OTLP receiver on the backend side, so the wire format is identical.

Test plan

  • docker compose -f base.yml -f agents-N1.yml -f baseline-b3-delta.yml -f e2e-overlay.yml config --quiet parses cleanly
  • Same with -f queryengine-overlay.yml appended also parses cleanly
  • gateway.yaml parses; pipeline exporters list = [otlp/backend]
  • Up the stack and run a PromQL with a typed sketch payload through the gateway, verify the answer comes back from the backend's OTLP-fed precompute store rather than the cold tier (i.e. the warm tier is actually live). Quickest check: query the inference plan for histogram_quantile(0.5, ...) on a DDSketch agg, observe non-cold-fallback log line on the backend.
  • Build asap/query-backend-queryengine:dev once, bring up the stack with queryengine-overlay.yml, repeat the warm-tier check.

🤖 Generated with Claude Code

… query_engine_rust image

Closes the warm-tier sketch path in the deploy stack. Previously
the gateway's `prometheusremotewrite/backend` exporter dropped
typed sketch data points (DDSketch / KLLSketch / HLLSketch /
CountSketch / CountMinSketch on Metric.data tags 13–17), so the
e2e flow only ran through the cold-tier path. Companion PR
ASAPQuery-backend#69 lands the matching OTLP receiver on the
backend.

Both follow-ups from ASAPCollector#204 PROGRESS.md item 1 are
included:

(a) **OTLP on the existing precompute_engine binary.**
   - `gateway.yaml`: replace `prometheusremotewrite/backend` in
     the metrics pipeline with `otlp/backend` (gRPC →
     `backend:4317`, insecure TLS, sending_queue enabled). PRW
     exporter retained as a non-active fallback for legacy
     clients / direct PRW writers.
   - `base.yml`: backend command gets `--enable-otel-ingest
     --otel-grpc-port=4317 --otel-http-port=4318`. OTLP ports
     stay intra-docker (gateway → backend); 19090/19091 host
     mappings are unchanged.

(b) **Alternative query_engine_rust image.**
   - `Dockerfile.backend.queryengine`: same multi-stage build
     as `Dockerfile.backend` but ships `query_engine_rust` (the
     workspace's default binary) instead of `precompute_engine`.
     Use when the deploy needs the binary's extra subsystems:
     controller capability-miss callbacks, query tracker,
     schema eviction, backfill worker — none of which
     `precompute_engine` wires up.
   - `queryengine-overlay.yml`: compose overlay swapping the
     backend image to `asap/query-backend-queryengine:dev` with
     the larger required flag set (`--config`,
     `--query-language=promql`, `--lock-strategy=per-key`,
     `--prometheus-scrape-interval=30`, `--output-dir`,
     `--http-port=8088`, `--controller-endpoint=...`,
     `--enable-otel-ingest`, etc.). Same OTLP wire, port
     remapped on the host so 19091 still serves PromQL across
     both backend variants.

PROGRESS.md follow-up #1 marked done; P3 limitation note
updated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zzylol
zzylol merged commit 99714f5 into main May 1, 2026
@zzylol
zzylol deleted the deploy/warm-tier-otlp-v2 branch May 1, 2026 03:43
zzylol added a commit that referenced this pull request May 1, 2026
…es (#206)

Real fix for the warm-tier sketch-drop the e2e harness has been
working around. #205's yaml-only swap (PRW → OTLP exporter) didn't
solve it because the drop wasn't at the exporter — it was at the
gateway's pdata *unmarshal* step.

Stock `otel/opentelemetry-collector-contrib:0.108.0`'s pdata only
knows the standard `Metric.data` OneOf variants (Gauge / Sum /
Histogram / ExpHistogram / Summary). Tags 13–17 (DDSketch /
KLLSketch / HLLSketch / CountSketch / CountMinSketch) hit the
`default:` arm at
`opentelemetry-collector/pdata/internal/generated_proto_metric.go:1201`
which calls `proto.ConsumeUnknown(...)`. That advances past the
bytes without storing them — there's no `XXX_unrecognized` field
on the Metric struct to catch them — so by the time any exporter
sees the metric, the typed sketch payload is gone.

Fix: run the gateway from the ASAP-patched OTel collector — the
same `asap/sketchcol:dev` image agents already use, whose pdata
is generated from the patched proto and round-trips tags 13–17
intact.

base.yml:
- gateway service: image stock 0.108 → asap/sketchcol:dev.
- Mounted config selectable via $GATEWAY_CONFIG env var
  (mirrors $AGENT_CONFIG). Default = gateway.yaml.
- Self-telemetry host port 18889:8889 → 18890:8890 (the patched
  build doesn't include a prometheus exporter on 8889; self-
  telemetry has been on 8890 since #205, intra-docker scrape was
  already pointed there).

deploy/configs/:
- gateway.yaml — pure forwarder (default). Updated comments to
  document the patched-build dependency + cross-reference the two
  aggregate variants.
- gateway-aggregate-from-raw.yaml — agents send raw OTLP; gateway
  runs DDSketch processor at gateway tier (KLL / HLL / CS / CMS
  blocks present but commented out — uncomment to add). Use when
  sketch placement is at the gateway tier per the controller's
  plan.
- gateway-aggregate-from-sketches.yaml — agents already sketched;
  gateway runs countminsketchmerge + countsketchmerge to
  reconstruct full state from delta payloads. DD / KLL / HLL pass
  through unchanged (merge processors for those don't exist yet;
  backend handles per-agent merging via the accumulator's
  merge_into path).

Builder manifests (both `builder-config.yaml` and the
e2e-harness-trimmed `builder-config-sketches.yaml`):
- Add countminsketchmergeprocessor + countsketchmergeprocessor.
  Their factories expose `countminsketchmerge` / `countsketchmerge`
  as the OTel component types — the names referenced in the new
  gateway-aggregate-from-sketches.yaml.

PROGRESS.md follow-up #1 rewritten to document the real root cause
and the real fix; the yaml-only changes from #205 are still in
main and remain correct (just not sufficient alone).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant