HELM: Regex for Grafana Template Variable does not work on labels [Performance Datasource]

Description

When using Grafana Template Variables on Performance Datasource to filter out SNMP Interfaces using Regex , the Regex only applies to resourceName and not the label [label contains ifAlias]
Please refer attached screenshots.

Here below the Regex applies to only the resourceName [ifName-PhysicalAddress]

Below is screenshot of all the labels without filtering


Here if you notice when I try to set the Regex for ".DPN." which is the ifAlias/label for some of the interfaces, nothing is returned

Would be a good idea to have filtering set for label's too, since users usually add tags to ifAlias as well which generally is part of labels as opposed to the resourceName which has [ifName/ifDescr].

Attachments

3

Lucidchart Diagrams

Activity

Show:

Alberto August 11, 2022 at 6:41 PM

Merged to Release-8.x

Mark Mahacek August 9, 2022 at 10:38 PM
Edited

This request is more related to passing a regex search to a nodeResources() query. If we could do something like the following, that would satisfy the customer's request.

 

 

Alberto August 9, 2022 at 9:01 PM

This could be done but probably not using the Regex field in the Template variable.

The issue is mainly the order how the regex expression gets applied to the data retrieved.

From grafana documentation https://grafana.com/docs/grafana/latest/variables/filter-variables-with-regex/#filter-and-modify-using-named-text-and-value-capture-groups

If the data was being retrieved as a single string that included text/labels and values, then a regular expression could be applied to group text/labels and values as separate columns and grafana would do the rest. 

Currently custom helm functions (such as nodeFilter, nodeResources) do this text/value structure before hand and it pass the text/labels and values columns preformatted. I tried applying the regular expression before hand but this filtered result are being filtered again by the grafana sdk and it seem to only apply it to the values column.

An alternative to implement would be passing a regular expression as a parameter to the custom functions that would be applied to the text/label column and leave the grafana Regex field for the value. 

Jeff Gehlbach August 2, 2022 at 3:35 PM

It's a bit unclear whether the application of the regex is in our code or upstream in Grafana itself, but we will investigate.

Done

Details

Assignee

Reporter

Labels

HB Grooming Date

HB Backlog Status

Story Points

Components

Sprint

Fix versions

Priority

PagerDuty

Created July 15, 2022 at 2:34 PM
Updated August 8, 2023 at 2:26 PM
Resolved August 11, 2022 at 6:41 PM
Loading...