如何从Azure中的不同应用洞察中查询?

huangapple go评论49阅读模式
英文:

How to query from different app insights in Azure?

问题

I have different application insights within different directories and then different subscriptions.

> WebAPI1: ApplInsights1, Subscription1, Directory1
>
> WebAPI2: ApplInsights2, Subscription2, Directory2

我有不同的应用洞察在不同的目录中,然后不同的订阅。

I want to get the percentage of HTTP requests of endpoints for both APIs. sp for example If there are 100 requests for API1 and 100 for API2 and there is one endpoint which is called 10 times. then the percentage will be 5.

我想获取两个API的端点的HTTP请求的百分比。例如,如果API1有100个请求,API2有100个请求,并且有一个端点被调用了10次。那么百分比将是5。

I am able to get the individual API, But I am not able to get the combined result in one single query window. Please help. I am very new to KQL.

我可以获取单个API,但无法在一个单一的查询窗口中获取组合结果。请帮助。我对KQL非常陌生。

Below is the query for WebAPI1.

以下是WebAPI1的查询。

requests
| where cloud_RoleName == "WebAPI1"
| summarize count() by operation_Name
| extend percentage = 100.0 * count_ / toscalar(requests | where cloud_RoleName == "WebAPI1"| count)
| project operation_Name, percentage
| order by percentage desc

Note: I am new to KQL so please ignore silly mistakes in my question.

注意:我对KQL不熟悉,所以请忽略我的问题中的愚蠢错误。

Edit: I have tried what has been told by Rithwik, But I can't see an option to select subscriptions. It shows only one subscription.

编辑:我尝试了Rithwik告诉我的方法,但我看不到选择订阅的选项。它只显示一个订阅。

英文:

I have different application insights within different directories and then different subscriptions.

> WebAPI1: ApplInsights1, Subscription1, Directory1
>
> WebAPI2:ApplInsights2, Subscription2, Directory2

I want to get the percentage of HTTP requests of endpoints for both APIs. sp for example If there are 100 requests for API1 and 100 for API2 and there is one endpoint which is called 10 times. then the percentage will be 5.

I am able to get the individual API, But I am not able to get the combined result in one single query window. Please help. I am very new to KQL.

Below is the query for WebAPI1.

requests
| where cloud_RoleName == "WebAPI1"
| summarize count() by operation_Name
| extend percentage = 100.0 * count_ / toscalar(requests | where cloud_RoleName == "WebAPI1"| count)
| project operation_Name, percentage
| order by percentage desc

Note: I am new to KQL so please ignore silly mistakes in my question.

Edit: I have tried what has been told by Rithwik, But I can't see an option to select subscriptions. It shows only one subscription.

如何从Azure中的不同应用洞察中查询?

答案1

得分: 0

是的,你可以查询,首先在Azure门户中打开监视器,然后根据你的需求设置范围,如下所示:

如何从Azure中的不同应用洞察中查询?

对于应用服务日志和函数应用日志的请求日志,你可以使用以下查询:

AppRequests 
| where AppRoleName contains "x" or AppRoleName contains "y"

如何从Azure中的不同应用洞察中查询?

这是一种方法,另一种方法是将日志导出到日志分析工作区,然后也可以从该工作区查询结果。

英文:

>How to query from different app insights in Azure?

Yes, you can query, Firstly open Monitor in Azure Portal Then set scope(according to your requirements) like below:

如何从Azure中的不同应用洞察中查询?

For requests logs of App services logs and Function app logs you can use below :

AppRequests 
|where AppRoleName contains "x" or AppRoleName contains "y"

如何从Azure中的不同应用洞察中查询?

This is one of way of doing, Other way is to export logs to a Log analytics workspace and then also you can query the results from that workspace.

huangapple
  • 本文由 发表于 2023年6月12日 12:16:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/76453623.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定