How to concate list variable with '|'?

I want to query multi-host load info like node_load1{ip=~$'IP1|IP2|IP3'},

The IP1 IP2 IP3 is the variable IPList (query from JSON Datasource, return a List<string>)

How can I concate the IPList variable with ‘|’ to generate an IP1|IP2|IP3 string to send to Prometheus query API?

previously I concate the ip list in my JSON datasource API, but it was a poor implemention,Is there a grafana way to concate this ip elegantly?

Thank U, but where can I use this magic?

servers = ['test1.', 'test2']
String to interpolate: '${servers:pipe}'
Interpolation result: 'test1.|test2'

in create variable form? or in panel query?

The doc your post doesn’t have a example

The doc you post is target for generate a variable with concated variable, How do I use ${varList:pipe} in panel graph data query? or can I generate ‘concatedVarList’ by variable ‘varList:pipe’ with grafana?

In the query. Don’t use plain variable:


But advanced formatting:


Use query inspector for any problems to see if variables are interpolated correctly.

thanks, but it seems should be




As I said, use query inspector and fix it on your won. My recommendation is based on your initial post:

Wrong input, wrong result.