Skip to content

fix(prometheus_exporter sink): fix race condition in prometheus export sink for incremental metrics#24831

Open
akashvbabu91 wants to merge 2 commits intovectordotdev:masterfrom
akashvbabu91:race-condition-fix
Open

fix(prometheus_exporter sink): fix race condition in prometheus export sink for incremental metrics#24831
akashvbabu91 wants to merge 2 commits intovectordotdev:masterfrom
akashvbabu91:race-condition-fix

Conversation

@akashvbabu91
Copy link

@akashvbabu91 akashvbabu91 commented Mar 2, 2026

Summary

Move the incremental aggregation logic into the write lock scope in run(), making the read-modify-write operation atomic. This fixes the issue in

Vector configuration

How did you test this PR?

  • Smoke tested in our org stacks to verify counters don't decrement except for when they are reset by flush_period_secs
  • Tested on both amd and arm machines

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • Non-functional (chore, refactoring, docs)
  • Performance

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.

References

Notes

  • 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.
    • We recommend adding a pre-push hook, please see this template.
    • Alternatively, we recommend running the following locally before pushing to the remote branch:
      • make fmt
      • make check-clippy (if there are failures it's possible some of them can be fixed 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 here.

@akashvbabu91 akashvbabu91 requested a review from a team as a code owner March 2, 2026 21:10
@github-actions github-actions bot added the domain: sinks Anything related to the Vector's sinks label Mar 2, 2026
@akashvbabu91 akashvbabu91 changed the title fix(prometheus_exporter sink): fix race condition in prometheus export sink for incremental metrics fix(prometheus_exporter): fix race condition in prometheus export sink for incremental metrics Mar 2, 2026
@akashvbabu91 akashvbabu91 changed the title fix(prometheus_exporter): fix race condition in prometheus export sink for incremental metrics fix(prometheus_exporter sink): fix race condition in prometheus export sink for incremental metrics Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: sinks Anything related to the Vector's sinks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prometheus exporter sink: Race condition in incremental metric aggregation

1 participant