Conditional dashboard variables in TraceQL

Hello!
I added OpenTelemetric to my project.

Creating a dashboard using Tempo and TraceQL.
I create a dashboard variable called httpStatusCode that is a text with the status code number.

I currently have

span.http.status_code=${httpStatusCode}

But this make the variable required. Is it possible to do this only if we set a value to the variable. If the variable is empty let’s not add this condition to the TraceQL query.

Thanks

1.) Don’t use = operator but =~ (regex)
2.) Use wild char as default value for httpStatusCode variable, I gues . *

So by default it will be selecting all status codes, but you will have an option to define custom code.

Hi @jangaraj
Thanks for your answer

I try this

span.http.status_code =~ ${httpStatusCode}

and it didn’t work, also if I hardcode to be

span.http.status_code =~ "*"
``
I always get not result using `=~`

Maybe because is a number type?

Check the doc for supported regexp, maybe it’s .*