Skip to content

feat(api): model the merge-time policy tiers - #10

Merged
tdakkota merged 2 commits into
refactor/policy-specfrom
feat/policy-merge-tiers
Jul 28, 2026
Merged

feat(api): model the merge-time policy tiers#10
tdakkota merged 2 commits into
refactor/policy-specfrom
feat/policy-merge-tiers

Conversation

@tdakkota

Copy link
Copy Markdown
Contributor

Completes the CRD's coverage of oteldb's storage.policy with the three merge-time tiers, closing out #3.

Note

Stacked on #9 (which introduces spec.policy). Base retargets to main once #9 merges.

spec:
  policy:
    downsample:
      - {after: 24h,  interval: 5m}
      - {after: 168h, interval: 1h, agg: avg}
    precision:
      - {after: 168h, bits: 32}
      - {after: 336h, bits: 16}
    recompress: {after: 72h, level: 19}

Unlike retention/limits, all three work against released oteldb — they're in v0.48.0's StoragePolicyConfig. I verified the rendered YAML decodes through v0.48.0's tenancyOption (so agg: avg really parses), not just against oteldb main.

Validation

Both tier lists are order-independent upstream — a sample takes the coarsest tier whose after it passed — so the CRD doesn't enforce ordering. It does reject tiers the engine would ignore:

  • duplicate after within a list (one of the two tiers is dead)
  • non-positive downsample[].interval, or recompress.after (the block exists only to enable it)
  • any tier at or past retention.maxAge — merge work whose output is dropped before it can be read

That last one only applies to a real window; maxAge: 0 is "retain forever" and doesn't bound anything.

downsample and precision rewrite parts in place and cannot be undone — lowering an after re-processes existing data at the next merge and the discarded samples/mantissa bits are gone. That's why a silently-inert tier is worth failing the reconcile over, and it's called out in the field godoc, the README and the sample. recompress is lossless and decode-transparent, so it's documented as the safe one.

Reserved paths

storage.policy is now modelled in full, so all five keys are reserved in extraConfig. Three existing tests used storage.policy.recompress as their "non-reserved" example and now use storage.log_query_parallelism, a real oteldb key the CRD still doesn't model. The README's extraConfig example moved off recompress for the same reason.

Verification

make test passes at 88.4% coverage (up from 86.9%), make lint reports 0 issues, make manifests generate && go mod tidy leaves the tree clean.

Closes #3

🤖 Generated with Claude Code

tdakkota and others added 2 commits July 28, 2026 16:46
Add spec.policy.downsample, .precision and .recompress, completing the
CRD's coverage of oteldb's storage.policy. All three work against the
released v0.48.0, unlike retention and limits.

Reject tiers the engine would ignore — duplicate after values, a
non-positive downsample interval or recompress after, and any tier at or
past retention.maxAge. Downsample and precision rewrite parts
irreversibly, so a tier that silently does nothing is worth failing over.
With the block modelled in full, all of storage.policy is now reserved in
extraConfig.

Closes #3

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@tdakkota
tdakkota merged commit c8af2fa into refactor/policy-spec Jul 28, 2026
5 checks passed
@tdakkota
tdakkota deleted the feat/policy-merge-tiers branch July 28, 2026 14:06
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