Custom variable format

Hi,

Is it possible to ship a new variable format with a datasource plugin ? As in https://grafana.com/docs/grafana/latest/variables/advanced-variable-format-options/

I don’t believe that it’s possible unless you start parsing the templates yourself. Looks like adding one to the registry isn’t that difficult, in case it’s not too obscure of a format :slight_smile:

What do you mean by “adding one to the registry” ?

The format I’d need for my riemann datasource would be something in the likes of the distributed flavour:

    {
      id: 'riemann',
      name: 'Riemann',
      description: 'Multiple values are formatted like `or variable = "value"`',
      formatter: ({ value }, variable) => {
        if (typeof value === 'string') {
          return value;
        }

        value = map(value, (val: any, index: number) => {
          if (index !== 0) {
            return "or " + variable.name + '" = "' + val + '"';
          } else {
            return val;
          }
        });
        return value.join(',');
      },
    },