Skip to content

Bound and checkpoint Datadog metric submissions#169

Open
Areson wants to merge 3 commits into
mainfrom
ioberst/datadog-byte-chunker
Open

Bound and checkpoint Datadog metric submissions#169
Areson wants to merge 3 commits into
mainfrom
ioberst/datadog-byte-chunker

Conversation

@Areson

@Areson Areson commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Why

Large metric batches can exceed Datadog decompressed payload limits even when their compressed wire size is valid. Reactive 413 retries repeatedly rebuild oversized payloads, and retrying a partially accepted batch from the beginning can stall submission and duplicate acknowledged chunks.

What

  • Size prepared Datadog payloads against exact compressed and decompressed byte limits
  • Stream MetricSeries conversion through a bounded 10,000-series window
  • Store per-batch checkpoints in Retry and resume after the last acknowledged chunk
  • Retain bounded 413 fallback logic and add payload sizing and timing diagnostics
  • Add focused payload-limit, cancellation, fallback, and checkpoint failure coverage

Risk Assessment

Medium — this changes the production Datadog API submission path and Retry queue entries. Payloads are checked below both documented limits, 413 fallback remains bounded, DogStatsD behavior is preserved, and a one-time representative large-batch comparison confirmed decoded output parity; a request accepted by Datadog whose response is lost still cannot be made exactly-once without server-side idempotency.

References

A one-time local representative large-batch comparison reduced submission from 7.53s, 27 requests, and 22 HTTP 413 responses to 1.05s, 5 requests, and no HTTP 413 responses. The comparison harness was intentionally not included in this PR.

Validated with:

  • go test -mod=mod ./...
  • go test -race ./sink
  • go vet ./sink

Generated with Codex

Areson and others added 3 commits July 18, 2026 13:42
Size compressed metric payloads locally against both Datadog limits and submit the prepared bytes directly. Add Catalyst-shaped equivalence and benchmark coverage for the legacy and byte-budgeted paths.

Co-authored-by: Codex <noreply@openai.com>
Ai-assisted: true
Co-authored-by: Codex <noreply@openai.com>
Ai-assisted: true
Co-authored-by: Codex <noreply@openai.com>
Ai-assisted: true
@Areson
Areson marked this pull request as ready for review July 18, 2026 21:26
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