grafana/azure-monitor-datasource

Other options for "Templating with Variables" for AppInsights?

Opened this issue · 1 comments

Hi team,

Documentation on "Templating with Variables" suggest that there are two filters:

https://github.com/grafana/azure-monitor-datasource#templating-with-variables

  • AppInsightsMetricNames() | Returns a list of metric names.
  • AppInsightsGroupBys(aMetricName) | Returns a list of group bys for the specified metric name.

Is there any option to support raw AppInsight queries?

It would be nice if we could say something like this:

customEvents 
| extend myFile = customDimensions['file']
| distinct myFile 
| order by myFile asc

Can we do this right now or this is something not supported at the moment?

Alright, seems these two are the only once and no raw AppINsights query support is there yet.

metricFindQuery(query: string) {
const appInsightsMetricNameQuery = query.match(/^AppInsightsMetricNames\(\)/i);
if (appInsightsMetricNameQuery) {
return this.getMetricNames();
}
const appInsightsGroupByQuery = query.match(/^AppInsightsGroupBys\(([^\)]+?)(,\s?([^,]+?))?\)/i);
if (appInsightsGroupByQuery) {
const metricName = appInsightsGroupByQuery[1];
return this.getGroupBys(this.templateSrv.replace(metricName));
}
return undefined;
}

Relates to #4

Team, how hard would it be to support raw AppInsight queries for template variables?
That way we would be able to build dynamic dashboards allowing people to choose values based on real data coming from AppInsights. Instrumentation, monitoring and other scenarios can be made so much easier!

What do you think?