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(prometheus) Metric name should not be set twice #1330

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

amolnayak311
Copy link
Contributor

@amolnayak311 amolnayak311 commented Feb 2, 2022

Pull Request checklist

  • The commit(s) message(s) follows the contribution guidelines ?
  • Tests for the changes have been added (for bug fixes / features) ?
  • Docs have been added / updated (for bug fixes / features) ?

Current behavior : Following prom expressions are valid

foo{_metric_="foo"} but foo{__name__="foo"} will fail to parse

New behavior :
both foo{_metric_="foo"} and foo{__name__="foo"} will fail to parse

alextheimer
alextheimer previously approved these changes Feb 2, 2022
Copy link
Contributor

@alextheimer alextheimer left a comment

Choose a reason for hiding this comment

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

lgtm if the test in the comment passes

Comment on lines +188 to +190
parseError("foo{__name__=\"foo\"}")
parseError("foo{_metric_=\"bar\"}")
parseError("foo{_metric_=\"foo\"}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Does something like {_metric_="foo"} still parse successfully? I'm not 100% sure if metricName accounts for both foo{~} and {_metric_="foo"}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll add tests for those too but yes it parses. I'm not sure is {_metric_="foo"} is equivalent to foo{~} as _metric_ is more internal to FiloDB

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pushed more tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you think should happen for {__name__="foo", _metric_="foo"} ? This is expected to fail?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ack, lgtm. Good point about _metric_-- I'm also not sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vishramachandran @tjackpaul @sherali42 Can you please share your view on this?

Copy link
Member

Choose a reason for hiding this comment

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

{__name__="foo", _metric_="foo"} should fail.

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.

None yet

3 participants