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

$__contains requires hardcoded "all" value #1140

Open
taleena opened this issue Jan 14, 2025 · 0 comments
Open

$__contains requires hardcoded "all" value #1140

taleena opened this issue Jan 14, 2025 · 0 comments

Comments

@taleena
Copy link

taleena commented Jan 14, 2025

Discussed in #1023

Originally posted by nadav-dav September 17, 2024
When using the $__contains macro with a variable, you require to use the value "all" to indicates to the macro not to apply a filter there.

// if $env == "foo"
| where $__contains(env, $env)
this will become
| where env == "foo"


// if $env == "all"
| where $__contains(env, $env)
this will become
| where 1 == 1

But if you are using Prometheus in the same dashboard, the "all" value must be equal to .*.
That means that you have to either have 2 different variables for the same meaning, just with different "all" value, or to write something like:

| where "$env" == ".*" or $__contains(env, $env)

My suggestion is to have the ability to customize the "all" value in the datasource level so it could be multiple options like ("all", ".", "", etc...)

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

No branches or pull requests

1 participant