需要在一个查询中添加多个应用洞察结果

时间:2019-08-29 11:21:35

标签: azure-application-insights

是否有可能从多个“应用程序”见解中总结该查询?我无法通过Union命令使用它。

Example query:

union
app("applicationinsight02").requests, 
app("applicationinsight03").requests


availabilityResults
| where timestamp > ago(30d)
// check whether location failed within 5m bin
| summarize _failure=iff(countif(success == 0)>0, 1, 0) by name, location, bin(timestamp, 5m)
// check whether all locations failed within 5m bin
| summarize _failureAll=iff(sum(_failure)>=3, 1, 0) by name, bin(timestamp, 5m)
// count all failed 5 minute bins and total number of bins
| summarize _failuresCount=sum(_failureAll), _totalCount=count() by name
| project ["Name"] = name,            ["SLA"] = todouble(_totalCount - _failuresCount) / todouble(_totalCount) * 100
| order by ["SLA"]

1 个答案:

答案 0 :(得分:1)

是的,类似

union
app("application-insights-01").requests, 
app("application-insights-02").requests
| where timestamp > ago(1h)
| summarize sum(itemCount) by appName, bin(timestamp, 5m)

这将汇总请求,并向您显示按应用名称(应用数据洞察资源名称)划分的内容。修改where子句以符合您的要求

关于查询的可用性结果的示例如下所示,只需用您的实例名称替换application-insights-01 / 02

union
app("application-insights-01").availabilityResults, 
app("application-insights-02").availabilityResults
| where timestamp > ago(1h)
| summarize _failure=iff(countif(success == 0)>0, 1, 0) by name, location, bin(timestamp, 5m)
| summarize _failureAll=iff(sum(_failure)>=3, 1, 0) by name, bin(timestamp, 5m)
| summarize _failuresCount=sum(_failureAll), _totalCount=count() by name
| project ["Name"] = name, ["SLA"] = todouble(_totalCount - _failuresCount) / todouble(_totalCount) * 100
| order by ["SLA"]