【问题标题】:Need to add multiple application insights results in one query需要在一个查询中添加多个应用程序洞察结果
【发布时间】:2019-08-29 11:21:35
【问题描述】:

是否可以从多个应用程序洞察中汇总查询?我无法让它与 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"]

【问题讨论】:

    标签: azure-application-insights


    【解决方案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"]
    

    【讨论】:

    • 但是是否可以从多个应用程序洞察中使用“availabilityResults”?当我尝试先使用 Union 然后使用可用性查询时,我收到了语法错误。我想对 AvailabilityResults 使用查询,但源需要是来自不同资源组的 3 个 Application Insights。
    • 是的,您可以从多个资源中查询 App Insights 中的任何数据类型。用您的用例示例更新答案
    • @RobinJohansson,如果它有效,您应该按照link 接受它作为答案
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-29
    • 2011-10-12
    • 2016-12-23
    • 1970-01-01
    • 2012-05-31
    • 1970-01-01
    相关资源
    最近更新 更多