gpt4 book ai didi

Azure Application Insight 查询获取成功率

转载 作者:行者123 更新时间:2023-12-03 02:41:53 25 4
gpt4 key购买 nike

有一个关于如何在 Azure 仪表板上显示成功率的问题。如果我有一个指示成功或失败的遥测事件 - 这非常简单:

    customEvents
| where name == "ResponseEvent" and customDimensions.Condition == "test"
| summarize count() by tostring(customDimensions.State) //State could be Success|Failure
| render piechart

但就我而言 - 我有 2 个事件:RequestEvent、SuccessResponseEvent,我想从这两个事件中获得成功率,例如:successRate = 100*successCount/requestCount。

我最终得到了这个连接:

    customEvents
| where name == "RequestEvent" and customDimensions.Condition == "test"
| summarize requestCount = count()
| extend joinField = "1"
| join ( customEvents
| where name == "SuccessResponseEvent" and customDimensions.Condition == "test"
| summarize successCount = count()
| extend joinField = "1")
on joinField
| extend successRate = (100 * successCount / requestCount)
//////| extend failureRate = 100 - successRate
| project successRate
| render table

我得到了我需要的值,但我只能将其显示为表格,而我需要一个饼图。我考虑过添加联合:

    let success = view () { print x=toint(80) };
let failure = view () { print x=toint(20) };
union withsource=TableName success, failure
| render piechart

但我不知道如何在我的请求中执行此操作。

或者使用let语句创建变量并尝试计算所有内容并使用materialize(createRequestRecieved)加入,但这会导致很多错误,我希望存在一些简单的方法。

问题是:也许有人可以告诉我如何实现这一目标:计算一个值,也许将其显示为两个值(成功和 100 成功),并以对“渲染饼图”运算符有效的格式排列它们?

第二个问题,不是那么重要:我可以通过一些现有的领域加入他们吗?嘿,我正在尝试使用 joinField = tostring(customDimensions.MappingField) 我收到错误:确保表达式:customDimensions.MappingField 确实是一个简单的名称

最佳答案

如果您要使用饼图,则需要一个字符串图例字段以及该图例的每行一个值,因此两个结果的并集应该有效:

requests
| summarize Success = sumif(itemCount, success == true)
| project Legend = "Success", Value = Success
| union
(requests
| summarize Failed = sumif(itemCount, success == false)
| project Legend = "Failed", Value = Failed )
| render piechart

使用条形图将允许在一个查询中使用两个 summarize 子句,而无需 join/union,并且可以提高性能:

requests
| summarize Success = sumif(itemCount, success == true), Failed = sumif(itemCount, success == false)
| project Legend = "Status", Success, Failed
| render barchart

类似地,要计算同一查询中的费率:

requests
| summarize Success = sumif(itemCount, success == true), Failed = sumif(itemCount, success == false)
| extend SuccessRate = Success * 1.0 / (Success + Failed)

关于Azure Application Insight 查询获取成功率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60831021/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com