I am trying to setup a Grafana dashboard variable to filter out a substring from a label’s value. For the regex I have entered it as below;
/^.*managed-(.*?)_.*$/
I cant seem to find the most appropriate regex, I keep getting an error:
Error updating options ^.*managed-(.*?)_.*$ is not a valid regular expression.
The sample time series from Prometheus is given below:
apisix_http_status{code="200", route="orion-gen-proj_managed-abc-test-1_checkout-api"}
apisix_http_status{code="200",route="orion-gen-proj_managed-cus-test-1_registration-api"}
apisix_http_status{code="200",route="ext_new-exe-feature-branch_managed-att-new-ddr-feature-branch_39uy78f"}
The dashboard that for this metric requires that some filter value to be selected via a Grafana dashboard variable. For the filter values I require to grab only the following values:
- “checkout-api”
- “registration-api”
- “39uy78f”
These substrings take any random value and are not necessarily the values “checkout-api” or “registration-api” or “39uy78f”.
What am I doing wrong?