Skip to content

enhancement(remap transform): set counter and gauge values in VRL - #27319

Open
JinchengCao wants to merge 3 commits into
masterfrom
JinchengCao-metric-value-write
Open

JinchengCao wants to merge 3 commits into
masterfrom
JinchengCao-metric-value-write

Conversation

@JinchengCao

@JinchengCao JinchengCao commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Summary

VRL in the remap transform can now set the value of a counter or gauge:

.gauge.value = 100

The path must match the metric's current type. Integers and floats are accepted and stored as floats, so the next read returns 100.0, the same as the output. Other metric value fields stay read-only.

Like other metric fields, a rejected assignment leaves the value unchanged and the program keeps running. This applies to a string, the field of another type (.counter.value on a gauge), a whole object (.gauge = {...}), and every other metric type. del() on a value field returns null.

A follow-up PR will allow replacing .distribution.samples with a new array.

References

Refs #5521. Follows #27264 and #27285.

Vector configuration

NA

How did you test this PR?

  • vrl_target.rs, remap, and VRL condition tests, make check-docs, and markdownlint pass.
  • A new remap test assigns 100 and checks the read back and the output. New core tests cover rejected writes and writes around .type changes.

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
    For a new deprecation announcement, follow the deprecation policy and add a deprecation.d/ notice instead.
  • No. A maintainer will apply the no-changelog label to this PR.

@github-actions github-actions Bot added docs review on hold The documentation team reviews PRs only after a PR is approved by the COSE team. domain:transforms Anything related to Vector's transform components domain:external docs Anything related to Vector's external, public documentation domain:core Anything related to core crates i.e. vector-core, core-common, etc labels Nov 24, 2026
@JinchengCao
JinchengCao marked this pull request as ready for review November 24, 2026 20:11
@JinchengCao
JinchengCao requested review from a team as code owners November 24, 2026 20:11
@datadog-official datadog-official Bot added domain:metrics Anything related to Vector's metrics events transform:remap Anything `remap` transform related labels Nov 24, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T21:00:39.271274Z 0d5d2f5 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@datadoghq-integration datadoghq-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

Numeric assignments keep the metric value and cached float representation synchronized, including across type changes. Rejected writes preserve the existing value; the completed static review identified no actionable defect.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit d2403b1

@thomasqueirozb thomasqueirozb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!!!

@github-actions github-actions Bot removed the docs review on hold The documentation team reviews PRs only after a PR is approved by the COSE team. label Nov 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain:core Anything related to core crates i.e. vector-core, core-common, etc domain:external docs Anything related to Vector's external, public documentation domain:metrics Anything related to Vector's metrics events domain:transforms Anything related to Vector's transform components transform:remap Anything `remap` transform related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants