Skip to content

fix(prometheus_remote_write source): Interpret metrics ending with _total as counters - #26100

Open
AyseGokmen wants to merge 1 commit into
vectordotdev:masterfrom
AyseGokmen:prom-rw-counter
Open

fix(prometheus_remote_write source): Interpret metrics ending with _total as counters#26100
AyseGokmen wants to merge 1 commit into
vectordotdev:masterfrom
AyseGokmen:prom-rw-counter

Conversation

@AyseGokmen

@AyseGokmen AyseGokmen commented Aug 13, 2026

Copy link
Copy Markdown

Summary

This PR aims to align the actual behavior of prometheus remote write source to documentation.

For metrics named with a suffix of _total, this source emits the value as a counter metric. All other metrics are emitted as gauges.

References

Related: #22825

Vector configuration

[sources.prometheus_rw]
type = "prometheus_remote_write"
address = "0.0.0.0:9095"

[transforms.filter_test_metrics]
type = "filter"
inputs = ["prometheus_rw"]
condition = '''
starts_with(string!(.name),"http")
'''

[sinks.file_sink]
type = "file"
inputs = ["filter_test_metrics"]
path = "/tmp/metrics.json"

[sinks.file_sink.encoding]
codec = "json"

[sinks.console_output]
type = "console"
inputs = ["filter_test_metrics"]
encoding.codec = "json"

How did you test this PR?

I have created a docker compose environment with prometheus, vector and node_exporter. Prometheus gathers some counters node_exporter is exposing. Prometheus is configured to send to vector prometheus_remote_write source. Vector then prints received metrics into a file and console.

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

Contributor Guidelines

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • Some CI checks run only after we manually approve them. To catch issues early, add a pre-push hook (template) or run the following locally before pushing:
    • make fmt
    • make check-clippy (auto-fix with make clippy-fix)
    • make test
  • After a review is requested, please avoid force pushes to help us review incrementally.
    • Feel free to push as many commits as you want. They will be squashed into one before merging.
    • For example, you can run git merge origin master and git push.
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run make build-licenses to regenerate the license inventory and commit the changes (if any). More details on the dd-rust-license-tool.

@AyseGokmen
AyseGokmen requested a review from a team as a code owner August 13, 2026 01:13
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@AyseGokmen

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@thomasqueirozb

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 72a43a9270

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@AyseGokmen

Copy link
Copy Markdown
Author

Should I create a changelog for this? I am hesitant because it is already a documented behavior.

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.

2 participants