grafanagrafana-variablegrafana-templating

Grafana - Get Status code label name for setting up data link


I have created stats widget and grouped the status code in the query to represent the below stats. anyone can refer below screenshots

Stats Widget

Filters

I want to apply a data link for each status so that whenever user clicks any status code it will open a new tab and show status code information ex -

https://example.com/{status_code}
https://example.com/500
https://example.com/400

I have set the data link in the override properties and tried the below grafana variables but not working as expected

${__field.name} - This gives me a "value" label instead of a status code
${__value.raw} - This gives me a count of status like 458 for 401 status

Data Link Setup

Field name with count


Solution

  • Using ${__series.name}, It is working.

    For more details - check this https://grafana.com/docs/grafana/latest/panels-visualizations/configure-data-links/