Skip to content

docs(design): gorilla-s3 cold engine — raw → Gorilla → S3 → exact query path - #280

Merged
zzylol merged 1 commit into
mainfrom
docs/design-gorilla-s3-cold-engine
May 6, 2026
Merged

zzylol merged 1 commit into
mainfrom
docs/design-gorilla-s3-cold-engine

Conversation

@zzylol

@zzylol zzylol commented May 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Phase 0 design doc for a new edge → Gorilla-encode → S3 chunk → backend exact-PromQL deployment shape, parallel to today's sketch warm-tier path (not a fallback). Doc-only diff (docs/design-gorilla-s3-cold-engine.md, 1,792 lines).
  • Covers the full picture: §1–2 goals + non-goals; §3 end-to-end architecture diagram (current pipeline + new Gorilla branch in one figure); §4 wire format (chunk + per-hour index.json, hour-bucketed key layout that mirrors cold_store/format.rs); §5 gorillas3processor (sketchcol Phase 2; sketchotap + sketchtelegraf variants Phase 7+); §6 GorillaQueryEngine; §7 GorillaS3ColdStore extending the existing ColdStore trait additively; §8 capability_matching extension with a new StorageBackend axis; §9 controller 5-layer fit (BindGorillaExact rule at L4; StageId::Storage + Topology::FourStage at L5; cost model with S3 PUT/GET/storage terms); §10 paper / product mapping across the 5 evaluation dimensions; §11 7-phase implementation plan; §12 10 open questions with pre-defaulted recommendations.
  • Lifts encode + S3-write logic from telegraf-patch/plugins/outputs/gorilla_s3/gorilla_s3.go (already shipped) and re-uses the AccuracyProfile::exact() summary contract so the path slots into existing infrastructure without re-inventing either side.

Test plan

  • Doc-only diff — only docs/design-gorilla-s3-cold-engine.md touched, no source / config / submodule changes.
  • All 13 mandatory sections present + named per the orchestrator brief.
  • ~1,792 LoC of structured Markdown (target: 800–1200, slightly over to fit per-section detail).
  • No docker, no image rebuild.
  • Reviewer check: option-A vs option-B IR choices in §9.4 (BindGorillaExact shape) and §9.5 (StageId::Storage variant) are flagged for orchestrator decision.
  • Reviewer check: §12 Q7 sub-question on multi-agent same-metric write partitioning is flagged for orchestrator decision.
  • Phase 1 follow-up will land the asap-gorilla block format crate per §11.

🤖 Generated with Claude Code

…ry path

Phase 0 design doc for a new edge → Gorilla-encode → S3 chunk → backend
exact-PromQL deployment shape, parallel to today's sketch warm-tier path
(not a fallback). Doc-only; no code, no docker, no image rebuild.

Covers: end-to-end architecture (current + new branch in one diagram);
chunk + index wire format with the hour-bucketed key layout that mirrors
the existing cold_store/format.rs; gorillas3processor spec for the OTel
runtime (with sketchotap + sketchtelegraf variants); GorillaQueryEngine
+ GorillaS3ColdStore that extend the existing ColdStore trait additively;
capability_matching extension with a new StorageBackend axis;
controller 5-layer fit (BindGorillaExact rule at L4, StageId::Storage +
Topology::FourStage at L5); paper / product mapping across the 5
evaluation dimensions; 7-phase implementation plan; 10 open questions
with pre-defaulted recommendations and the few items flagged for
orchestrator decision.

Lifts encode + S3-write logic from telegraf-patch's existing gorilla_s3
plugin and the AccuracyProfile::exact() summary contract from the
backend's accuracy.rs so the path slots into existing infrastructure
without re-inventing either side.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zzylol
zzylol merged commit 7ad5f11 into main May 6, 2026
zzylol added a commit that referenced this pull request May 6, 2026
… (Phase 2) (#282)

Phase 2 of the Gorilla-S3-cold-engine: a new OTel collector contrib processor
that takes raw metrics, Gorilla-XOR-compresses per-(metric, label_set) per
60s tumbling window, and PutObject's the resulting chunk to S3 / MinIO with a
self-describing index.json per hour bucket. With drop_original=true the agent
emits zero bytes downstream — paired with the Phase 1 asap-gorilla Rust crate
(#281), the backend GorillaQueryEngine (Phase 4, queued) reads + decodes the
same chunk for exact PromQL.

## Block format — byte-compatible with asap-gorilla Rust crate (#281)

Outer block: `GORILLA1` 8-byte magic + 1-byte version + 4-byte LE
series_count + back-to-back per-series chunks. Per-series body:
JSON SeriesMeta + uncompressed first-sample seed + Gorilla XOR + delta-of-delta
bit-packed body. The encoder shape mirrors sibling
`opentelemetry-collector-contrib-patch/processor/gorillaprocessor/` so a
chunk written here can be decoded by the existing in-process gorillaprocessor
catalog scan AND by `asap-gorilla::GorillaDecoder` on the backend side.

(Initial impl used the brief's example "ASGB" 4-byte magic which was not
byte-compatible with #281 — that was reconciled to GORILLA1 for cross-runtime
chunk interchange.)

## S3 sink

aws-sdk-go-v1, S3ForcePathStyle: true for MinIO compatibility, retry/backoff,
optional local spool fallback for S3-unavailable failure mode. Per-hour
`index.json` is read-modify-write with in-memory mutex + small cache; multi-
writer is best-effort and a sidecar compactor is the source-of-truth for
multi-agent sharing the same hour bucket.

## Config

Window 60s, prefix template `{tenant}/{metric}/{YYYY}/{MM}/{DD}/{HH}/`,
drop_original=true canonical, encryption omitted (follow-up). Self-mon emits
`gorillas3_chunks_written_total`, `gorillas3_chunk_payload_bytes_total`,
`gorillas3_data_points_encoded_total`, `gorillas3_s3_put_failures_total`.

## Tests

16 tests across config / encoder / processor (round-trip, regular-interval
compression sanity, multi-series-per-metric grouping, multi-metric chunk
splitting at max_object_bytes, drop_original behavior, factory registration,
shutdown drain).

Build/vet/test verified in main repo (submodules required); worktree submodules
unavailable so local repo verification deferred.

## OCB integration

`cmd/sketchcollector/builder-config-sketches.yaml` registers gorillas3processor.
`deploy/configs/sketchcol-agent-gorillas3-tier.yaml` is an example agent config
pointed at the existing MinIO container (`endpoint: http://minio:9000`,
`bucket: asap-gorilla`, `drop_original: true`).

## Spec ambiguity surfaced for Phase 0 design doc tightening

- Lock GORILLA1 8-byte magic + 13-byte block header in design doc spec
- Lock index.json schema (Version/Tenant/Metric/Entries[])
- Lock prefix-template token set: {tenant} {metric} {YYYY} {MM} {DD} {HH}
- Multi-writer index ownership: best-effort writer-side, sidecar compactor authoritative

Closes part of the Gorilla-S3-cold-engine track per
`docs/design-gorilla-s3-cold-engine.md` §5 (PR #280).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zzylol
zzylol deleted the docs/design-gorilla-s3-cold-engine branch May 9, 2026 18:00
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