测量使用 Kusto Query 执行的命令的成功率

问题描述

我正在尝试查找命令(例如调用)的成功率。我有场景标记标记成功,并收集了数据。现在我正在使用 Kusto 查询创建一个仪表板,用于在触发命令时测量成功率。

我试图使用百分位数来衡量在一段时间内使用的命令的成功率,如下所示。

Table
| where Table_Name == "call_command" and Table_Step == "CommandReceived" 
| parse Table_MetaData with * "command = " command: string "," *
| where command == "call"
| summarize percentiles(command,5,50,95) by Event_Time

上述查询抛出错误,因为发生了“识别错误”。另外,这是否是查找命令成功率的正确方法

更新:
成功的命令o/p:

    call_command CommandReceived OK         null       null 1453 null [command = call,id = b444,retryAttempt = 0] [null] [null] 

命令 o/p 失败:

    call_command STOP   ERROR      INVALID_VALUE Failed to execute command: call,id: b444,status code: 0,error code: INVALID_VALUE,error details: . 556  [command = call,retryAttempt = 0] [null] [null]

Table name - call_command
Table_step - CommandReceived/STOP 
Table_Metadata - [command = call,retryAttempt = 0]
Table_status - OK/ERROR

解决方法

百分位数要求第一个参数是数字/布尔/时间跨度/日期时间,字符串参数无效。似乎第一步是提取调用是否成功,一旦有了这样的列,您就可以计算它的百分位数。这是一个类似于您的用例的示例:

let Table = datatable(Event_Time:datetime,Table_MetaData:string) [datetime(2021-05-01),"call_command CommandReceived OK         null       null 1453 null [command = call,id = b444,retryAttempt = 0] [null] [null] ",datetime(2021-05-01),"call_command STOP   ERROR      INVALID_VALUE Failed to execute command: call,id: b444,status code: 0,error code: INVALID_VALUE,error details: . 556  [command = call,retryAttempt = 0] [null] [null]"]
| extend CommandStatus = split(Table_MetaData," ")[2]
| extend Success = iif(CommandStatus == "OK",true,false)
| parse Table_MetaData with * "command = " command: string "," *
| where command == "call"
| summarize percentiles(Success,5,50,95) by bin(Event_Time,1d);
Table