grafana / azure-data-explorer-datasource

Grafana datasource plugin for Microsoft Azure Data Explorer (formerly Azure Kusto)
Apache License 2.0
48 stars 37 forks source link

ADX Data Source doesn't produce appropriate Key/Value pairs when used as a variable #591

Open MSDkuznetsov opened 1 year ago

MSDkuznetsov commented 1 year ago

I am able to reproduce the following case.

  1. If I use "Custom" Variable type = CORRECT

image

shows up like:

Val = ${adxdsDeploymentModels2} Text = ${adxdsDeploymentModels2:text} Text = ${adxdsDeploymentModels2:cccc} Value = ${adxdsDeploymentModels2:value} Value = ${adxdsDeploymentModels2:Value}

image

  1. If I use Azure Monitor Data Source CORRECT:

image

Shows as :

image

AM

Val = ${amdsDeploymentModels3} Text = ${amdsDeploymentModels3:text} Text = ${amdsDeploymentModels3:cccc} Value = ${amdsDeploymentModels3:value} Value = ${amdsDeploymentModels3:Value}

However, if I use ADX data source for this, then it doesn't work !

image

Shows as :


ADX

Val = ${adxdsDeploymentModels3} Text = ${adxdsDeploymentModels3:text} Text = ${adxdsDeploymentModels3:cccc} Value = ${adxdsDeploymentModels3:value} Value = ${adxdsDeploymentModels3:Value}

image

What happened:

The ADX Data source here , doesn't extract value from Key/Value pair like other data sources do.

What you expected to happen:

Should work like other mentioned data sources, when data query results returns columns "text","value", these should be returned as key/value pairs.

How to reproduce it (as minimally and precisely as possible):

  1. Go to variables on a dashboard
  2. Select ADX data source for the Query variable
  3. Either make a query against real data or use datatable like this:
let data = datatable(text:string, value:string)
[
    "node1","A",
    "node2","B",
    "node3","C"
];
data
  1. Read variable text and value from any panel. Key/Value pairs can't be extracted. Only the "first" column will be returned always.

Environment:

asimpson commented 1 year ago

I can reproduce this in 9.4.12 and on main. Essentially creating a variable using datatable KQL results in a variable where the key is sent even if you explicitly set ${query0:value} in your query.