Skip to content

fix(gorillas3): retire Bucket field validation + log + TSDBBucket fallback (B1 downstream) - #387

Merged
zzylol merged 1 commit into
mainfrom
retire-gorillas3-bucket-field
May 18, 2026
Merged

zzylol merged 1 commit into
mainfrom
retire-gorillas3-bucket-field

Conversation

@zzylol

@zzylol zzylol commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

The gorillas3 processor's `Bucket` field is no longer needed at runtime in the current `BlockFormat: prometheus_tsdb`-only build — the actual S3 write path (`PutTSDBBlock` → `putWithRetryToBucket`) takes the bucket from `TSDBBucket`. The legacy `Bucket`-based calls (`PutChunk`, `PutPostings` via `putWithRetry`) have zero non-test callers.

Phase 1 of a three-phase retire (full plan in the commit body). Highlights:

  • `Config::Validate()` no longer requires `Bucket` non-empty
  • `TSDBBucket → Bucket` fallback shim retired; validation now requires `TSDBBucket`
  • Startup log no longer reads `Bucket`
  • `Bucket` field stays in Config (deprecated comment) so mapstructure keeps accepting the controller's currently-emitted `bucket:` line

Test plan

  • `go test ./...` in `processor/gorillas3processor/` — green
  • `bash build_asap_otel.sh --skip-patches` — clean

Phases 2 + 3 (follow-ups)

  • Phase 2 (ASAPQuery-backend, queued behind in-flight B3 PR): controller's `build_gorillas3_yaml` stops emitting `bucket:`
  • Phase 3 (ASAPCollector, after Phase 2): delete the `Bucket` field + dead `PutChunk`/`PutPostings`/`updateIndex`/`fetchIndex` methods

🤖 Generated with Claude Code

…lback (B1 downstream Phase 1)

The gorillas3 processor's `Bucket` field is no longer needed at
runtime in the current `BlockFormat: prometheus_tsdb`-only build —
the actual S3 write path (`PutTSDBBlock` → `putWithRetryToBucket`)
takes the bucket name as an arg from `TSDBBucket`. The legacy
`Bucket`-based S3 calls (`PutChunk`, `PutPostings` via
`putWithRetry` → `putOnce`) have ZERO non-test callers in the
current code; confirmed by:

    grep -rn '\.PutChunk\b\|\.PutPostings\b' \
        opentelemetry-collector-contrib-patch/processor/gorillas3processor/ \
        | grep -v _test.go
    # (no output)

This PR is Phase 1 of a three-phase retire (the cross-repo
coordination is in the commit body, not the title):

  Phase 1 (this PR, ASAPCollector):
    * `Config::Validate()` no longer requires `Bucket` non-empty.
    * `TSDBBucket == "" → fallback to Bucket` shim retired;
      validation now requires `TSDBBucket` directly for non-agent
      roles.
    * Startup log line `zap.String("bucket", p.cfg.Bucket)` removed.
    * `s3_sink.go`'s TSDB upload path no longer falls back to
      `cfg.Bucket` when `TSDBBucket` is empty.
    * `Bucket` field stays in the Config struct (deprecated, doc
      comment marks it so) — mapstructure-strict will reject yaml
      with unknown keys, and the controller still emits
      `bucket: asap-gorilla`, so the field must continue to parse.
      Tests for the field's existence (`TestConfig_BucketRequired`)
      get reworded to `TestConfig_TSDBBucketRequired`.
    * `processor_test.go`: bucket-only test setups rekeyed to
      TSDBBucket.

  Phase 2 (ASAPQuery-backend, queued behind in-flight PR):
    * Controller's `build_gorillas3_yaml` stops emitting the
      `bucket:` line.

  Phase 3 (ASAPCollector, after Phase 2 lands):
    * Delete the `Bucket` field entirely.
    * Delete the now-dead `PutChunk` / `PutPostings` /
      `putWithRetry` / `putOnce` / `updateIndex` / `fetchIndex`
      methods in `s3_sink.go`. Companion deletion of `chunkSink`
      interface members + the legacy `.gor`-chunk indexCache
      machinery.

Test plan:
  * `go test ./...` in `processor/gorillas3processor/` — green.
  * `bash build_asap_otel.sh --skip-patches` — builds clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zzylol
zzylol merged commit 61d5417 into main May 18, 2026
@zzylol
zzylol deleted the retire-gorillas3-bucket-field branch May 18, 2026 00:05
zzylol added a commit that referenced this pull request May 18, 2026
…methods (B1 downstream Phase 3) (#388)

Final phase of the gorillas3 Bucket-field retire. After:
  * PR #387 — Phase 1: removed validation + log + TSDBBucket-fallback;
    field kept in Config for mapstructure compat
  * ASAPQuery-backend PR #279 — Phase 2: controller stops emitting
    `bucket:` in its YAML

Phase 3 (this PR) removes the field entirely + all the dead
write-path machinery that referenced it:

  Deleted:
    * `Config.Bucket` field
    * `s3Sink.PutChunk` / `PutPostings` methods (zero non-test callers)
    * `s3Sink.putWithRetry` / `putOnce` (callers were PutChunk/PutPostings)
    * `s3Sink.updateIndex` / `fetchIndex` (callers were PutChunk path)
    * `s3Sink.indexCache` + `indexMu` fields + initialization
    * `chunkHints` / `indexEntry` / `indexFile` types (only the dead
      chunk write-path consumed them)
    * `chunkSink` interface methods for PutChunk / PutPostings
    * `mockSink.PutChunk` / `PutPostings` + chunks/postings test
      tracking + `TestFlushWindow_DoesNotEmitLegacyChunkOrPostings`
      (now redundant — the code path is gone)
    * stale `Bucket: "asap-gorilla"` literal in
      TestGatewayFragmentRole_FinalizesFragmentsToTSDBBlock

Build verification:
  * `go test ./...` in processor/gorillas3processor: green (19 tests,
    down from 20 — the deleted redundant negative test)
  * `bash build_asap_otel.sh --skip-patches`: clean
  * empirical confmap-strict check: a yaml carrying a stale
    `bucket: legacy-bucket` is now rejected with `invalid keys: bucket`
    (OTel confmap's `ErrorUnused` is on by default since v0.79). Post
    Phase 2 the controller no longer emits it, so this only affects
    hand-rolled operator configs — those should be cleaned up too.

Closes the gorillas3 Bucket-field retire thread.

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