Using heatmap with Azure Log Analytics datasource

Hi.
It is my first approach to us Azure Log Analytics as datasource in Grafana.
I succeeded to connect it.
Now I have bucket metric api_response_time_seconds which I can query with following kusto query:

InsightsMetrics
| where Namespace == ‘prometheus’
| extend tag=parse_json(Tags)
| extend app=tostring(tag[“app”])
| extend le=tostring(tag[“le”])
| where app==“mbpoc”
| where Name==“api_response_time_seconds”
| where TimeGenerated > ago(2m)
| order by TimeGenerated, le
| project TimeGenerated, Name, le, Val

Example results are:

TimeGenerated Name le Val
2/10/2021, 9:42:00.000 AM api_response_time_seconds 7.5 86
2/10/2021, 9:42:00.000 AM api_response_time_seconds 5 86
2/10/2021, 9:42:00.000 AM api_response_time_seconds 2.5 86
2/10/2021, 9:42:00.000 AM api_response_time_seconds 10 86
2/10/2021, 9:42:00.000 AM api_response_time_seconds 1 86
2/10/2021, 9:42:00.000 AM api_response_time_seconds 0.75 86
2/10/2021, 9:42:00.000 AM api_response_time_seconds 0.5 86
2/10/2021, 9:42:00.000 AM api_response_time_seconds 0.25 86
2/10/2021, 9:42:00.000 AM api_response_time_seconds 0.1 86
2/10/2021, 9:42:00.000 AM api_response_time_seconds 0.075 86
2/10/2021, 9:42:00.000 AM api_response_time_seconds 0.05 85
2/10/2021, 9:42:00.000 AM api_response_time_seconds 0.025 85
2/10/2021, 9:42:00.000 AM api_response_time_seconds 0.01 85
2/10/2021, 9:42:00.000 AM api_response_time_seconds 0.005 85
2/10/2021, 9:42:00.000 AM api_response_time_seconds +Inf 86
2/10/2021, 9:41:00.000 AM api_response_time_seconds 7.5 82
2/10/2021, 9:41:00.000 AM api_response_time_seconds 5 82
2/10/2021, 9:41:00.000 AM api_response_time_seconds 2.5 82
2/10/2021, 9:41:00.000 AM api_response_time_seconds 10 82
2/10/2021, 9:41:00.000 AM api_response_time_seconds 1 82
2/10/2021, 9:41:00.000 AM api_response_time_seconds 0.75 82
2/10/2021, 9:41:00.000 AM api_response_time_seconds 0.5 82
2/10/2021, 9:41:00.000 AM api_response_time_seconds 0.25 82
2/10/2021, 9:41:00.000 AM api_response_time_seconds 0.1 82
2/10/2021, 9:41:00.000 AM api_response_time_seconds 0.075 82
2/10/2021, 9:41:00.000 AM api_response_time_seconds 0.05 81
2/10/2021, 9:41:00.000 AM api_response_time_seconds 0.025 81
2/10/2021, 9:41:00.000 AM api_response_time_seconds 0.01 81
2/10/2021, 9:41:00.000 AM api_response_time_seconds 0.005 81
2/10/2021, 9:41:00.000 AM api_response_time_seconds +Inf 82

Now I would like to use these results in heatmap visualization in Grafana. When I choose a heatmap in Grafana panel options then values in Val column get treated as bucket which is incorrect. I want bucket to be indicated by column le and the values should be calculated as difference between old and new within each bucket for consecutive points in time. In other words I want to provide same or similar behaviour which I could get with prometheus rate function.

I’m not sure how should I construct kusto query to achieve this. Or is there other way?

This topic was automatically closed after 365 days. New replies are no longer allowed.