Repository navigation
enhancement(datadog metrics sink): implement V3 - #26285
Conversation
…s protocol Add a `v3` option for the `datadog_metrics` sink's `series_api_version`, encoding series metrics with Datadog's columnar protobuf format at `/api/intake/metrics/v3/series`. The format uses dictionary-based string deduplication and delta encoding, making it more efficient than `v2` for workloads with many metrics sharing common names or tags. Includes: - new `encoder_v3` implementation and request builder support - resource handling for host and device fields, with correct precedence and multi-value support - timestamp resolution performed once per flush - sketches remain on the v2 protocol; `sketches_api_version: v3` is rejected - rate limiting of request-failed error logs - generated docs and changelog fragments
…rics-v3-main # Conflicts: # Cargo.lock # Cargo.toml # src/sinks/datadog/metrics/config.rs # src/sinks/datadog/metrics/encoder.rs
3e0995c to
f5b396a
Compare
…ies default The generated advanced example embeds each option's default, so changing `series_api_version`'s default to `v3` left it out of sync and CI's `vdev check component-examples` failed on it.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…opping them The sink asked the encoder how many pieces to split an oversized payload into, a count derived from a byte-size ratio, and then partitioned the metrics by count. With unevenly sized metrics one piece could still be over the limit, and `encode_now_or_never` dropped that whole piece even though smaller subdivisions of it would have fit. This is the ordinary overflow path for V3 rather than an edge case: V3 accumulates a whole batch and only learns the payload size at `finish()` time, so unlike V1/V2 it cannot stop before the limit. Replace the single count-based partition with the work queue the Agent's V3 serializer uses (`encode_v3_payload_requests` in saluki): encode a piece, and if the finished payload is still too large, push its two halves back onto the front of the queue and retry. Halving is driven by what the encoder actually produced rather than by an estimate, so it terminates, and the only thing ever dropped is a single metric that is too large to send on its own.
pront
left a comment
There was a problem hiding this comment.
This PR looks great, thanks! Left a few comments but nothing major.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb42f105a4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…integration tests `smoke` and `all_series_metric_types` build their sink from a config that doesn't set `series_api_version`, and match only the v1 and v2 intake paths. Defaulting to v3 sent every request to their `_ =>` arm, so both panicked with "Unexpected request type received!" on any run. Those two decode `MetricPayload`, which is the v1/v2 wire shape, so pin them to v2 explicitly: that is the protocol they intend to exercise. Cover the new default with a separate test asserting the request reaches `/api/intake/metrics/v3/series` as a non-empty zstd protobuf body. V3's columnar payload has no decoder in this crate, so contents stay verified by the e2e suite, where fakeintake decodes them.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 32a37da7f9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…size limits The payload size limits are inclusive: the intake accepts a payload whose encoded size is exactly the maximum, and the Agent agrees -- `V3PayloadLimits::request_fits` in saluki compares both dimensions with `<=`. Deriving the check from `len / limit + 1` classified equality as an overflow, because integer division yields 1 at exactly the limit and the `+ 1` pushed it past the "no splits needed" case. For a batch of a single metric that is destructive rather than merely wasteful: `split_and_encode` has nothing left to halve, so it dropped a payload the intake would have accepted. Compare the two sizes against their limits directly, and compute the (now only logged) split hint with `div_ceil` so an overflowing payload still reports a sensible number.
Summary
This changes the Datadog metrics sink to send metrics via the V3 protocol.
V3 is Datadog's columnar protobuf format. This format uses dictionary-based string
deduplication and delta encoding, making it more efficient than
v2for workloads with manymetrics that share common names or tags.
We lean on the V3 encoder crate currently in use by Saluki.
References
Vector configuration
How did you test this PR?
#26086 was dogfooded internally. That branch created V2 and V3 transactions simultaneously. A backend service compared both payloads to check for differences.
For this PR, I created an account in datadog and sent dogstatsd and host metrics via v3.
Is this a breaking change?
Potentially. We change the default to send V3 metrics. The datadog backend handles V3, but this could break systems that depend on metrics being V2. To restore, configure:
Does this PR include user facing changes?
no-changeloglabel to this PR.Contributor Guidelines
@vectordotdev/vectorto reach out to us regarding this PR.pre-pushhook (template) or run the following locally before pushing:make fmtmake check-clippy(auto-fix withmake clippy-fix)make testgit merge origin masterandgit push.Cargo.lock), pleaserun
make build-licensesto regenerate the license inventory and commit the changes (if any). More details on the dd-rust-license-tool.