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

Regex match unable to match missing labels #3712

Closed
SharpEdgeMarshall opened this Issue Jan 19, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@SharpEdgeMarshall
Copy link

SharpEdgeMarshall commented Jan 19, 2018

Issue

  • my_metric{my_label=""} matches when my_label is empty or missing
  • my_metric{my_label=~".*"} matches only when my_label is empty

This difference in behaviour is misleading and actually there is no workaround.

Use case

Need to match a label my_label with a Grafana template variable $Myvar, it should be possible to match also all values of my_label so regex matching must be used with .* but there is no way to match metrics where my_label is missing.

my_metric{my_label=~"^$Myvar$"}

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Jan 19, 2018

Is this on Prometheus 2.0.0? It should be fixed in 2.1.0.

@SharpEdgeMarshall

This comment has been minimized.

Copy link
Author

SharpEdgeMarshall commented Jan 22, 2018

yes prometheus 2.0.0, i'll try with 2.1.0

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Feb 2, 2018

I presume this is all working now.

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 22, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 22, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.