Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't let captured fields being overwritten by backtracking #169

Conversation

fffonion
Copy link
Contributor

@fffonion fffonion commented Dec 5, 2018

In some use case that the mapping rules need backtracking and the
non-matched rule has star(s), the fsm will incorrectly return the
captures from latter non-matched rule.

This PR fixes this by copying the current captures slice to a different
slice and only return the copied slice. So that later assignment to
captures won't affect the captures of a previously matched rule.

Fix #168

Verified

This commit was signed with the committer’s verified signature. The key has expired.
fffonion Wangchong Zhou
Signed-off-by: Wangchong Zhou <fffonion@gmail.com>
@matthiasr
Copy link
Contributor

Thank you for the prompt fix!

@matthiasr matthiasr merged commit e019c01 into prometheus:master Dec 5, 2018
matthiasr pushed a commit that referenced this pull request Dec 5, 2018

Unverified

No user is associated with the committer email.
and add changelog for #169

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
matthiasr pushed a commit to prometheus/graphite_exporter that referenced this pull request Dec 5, 2018

Unverified

No user is associated with the committer email.
this brings in prometheus/statsd_exporter#169 which fixes
prometheus/statsd_exporter#168: clobbering of captures when
unsuccessfully backtracking

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
matthiasr pushed a commit to prometheus/graphite_exporter that referenced this pull request Dec 5, 2018

Unverified

No user is associated with the committer email.
this brings in prometheus/statsd_exporter#169 which fixes
prometheus/statsd_exporter#168: clobbering of captures when
unsuccessfully backtracking

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
matthiasr pushed a commit to prometheus/graphite_exporter that referenced this pull request Dec 5, 2018

Unverified

No user is associated with the committer email.
to pull in prometheus/statsd_exporter#169

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
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.

Backtracking causes wrong mapping of labels
2 participants