fix(datadog_metrics sink): preserve dd agent v2 series resources - #25973
fix(datadog_metrics sink): preserve dd agent v2 series resources#25973tessneau wants to merge 5 commits into
Conversation
645bed7 to
cd4d384
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd4d3848f8
ℹ️ 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".
There was a problem hiding this comment.
I'm not crazy about adding source specific logic into the encoder but the alternative of adding first-class support for arbitrary resources to Vector’s generic metric model felt pretty invasive for this fix
There was a problem hiding this comment.
agree, makes sense to me
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4be28772c9
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b4fa44424
ℹ️ 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".
| if let Some(values) = tags.remove_set(&tag) { | ||
| for value in values { | ||
| match value { | ||
| TagValue::Value(name) => { | ||
| resources.push(ddmetric_proto::metric_payload::Resource { |
There was a problem hiding this comment.
Track resource values before promotion
Fresh evidence: this commit now records only the resource type keys in metadata, not the specific values that decode_ddseries_v2 inserted. If a v2 Agent series also carries an ordinary tag with the same key, such as resource.database_instance:custom, or a transform adds one after decoding, remove_set takes the whole value set and every TagValue::Value is emitted as a protobuf resource, so the ordinary tag is still removed/misclassified in v2 output. Preserve per-value provenance or otherwise promote only values that came from the original resources field.
Useful? React with 👍 / 👎.
|
|
||
| if !resource_types.is_empty() { | ||
| metadata.value_mut().insert( | ||
| vrl::path!("datadog_agent", "v2_resource_types"), |
There was a problem hiding this comment.
nit: could we use the constants for both values, since they are used in the method below?
|
overall looks good to me, but wondering if we could simplify it for this single specific use case and just populate resources at the sink from tags, prefixed with |
Summary
Preserves datadog agent metric resources when forwarding them through a v2
datadog_metricssink. Thisapplies only to metrics received from a
datadog_agentsource; v1 behavior is unchanged.The datadog agent converts
dd.internal.resource:<type>:<name>tags into series resources, which it then encodes in the v2 protobufresourcesfield.Vector currently represents unknown resources internally as
resource.<type>tags, which was leading to some integration dashboards e.g. mongo integration check not working. This change converts those tagsback into v2 resources before forwarding the metrics.
Vector configuration
How did you test this PR?
Besides the updated tests, I did a manual test:
With the above vector config. I then emitted the following to the datadog agent's dogstatsd port (8125)
After the metric reached Datadog, this query returned the series:
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
Notes
@vectordotdev/vectorto reach out to us regarding this PR.pre-pushhook, please see this template.make fmtmake check-clippy(if there are failures it's possible some of them can be fixed 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.