如何在不同的runID上对值进行分组

时间:2018-03-15 10:12:16

标签: azure logging query-string azure-log-analytics

嗨我正在尝试通过该运行ID对与运行ID相关的一些值进行分组。

所以我拥有的是:

AzureDiagnostics
| where resource_workflowName_s =="RABE_REST_CARUS_V2"
| where resource_actionName_s  != "" 
   and resource_actionName_s == "Initialize_variable" 
   or resource_actionName_s == "Compose" 
   or resource_actionName_s == "RabeValidationCarusV2Test" 
   or resource_actionName_s == "HTTP"
| where status_s  == "Succeeded" 
| extend Duration = iff(isnotempty(endTime_t), todouble(endTime_t - startTime_t ) / 10000000, double(null))
| project RunId = resource_runId_s, Actions = resource_actionName_s , Duration

我得到了这个结果:

enter image description here

我想要的是将与一个RunID相关的操作的持续时间相加 我现在拥有的是每个runID的一个动作及其持续时间......

希望有道理吗?

1 个答案:

答案 0 :(得分:0)

找到答案:

AzureDiagnostics
| where resource_workflowName_s =="RABE_REST_CARUS_V2"
| where resource_actionName_s != "" 
    and resource_actionName_s == "Initialize_variable" 
    or resource_actionName_s == "Compose" 
    or resource_actionName_s == "RabeValidationCarusV2Test" 
    or resource_actionName_s == "HTTP"
| where status_s  == "Succeeded" 
| extend Duration = iff(isnotempty(endTime_t), todouble(endTime_t - startTime_t ) / 10000000, double(null))
| project RunId = resource_runId_s, Actions = toobject(resource_actionName_s) , Duration
| summarize Actions = makeset(Actions), Durations = makeset(Duration), DurationSum = sum(Duration) by RunId 
| where DurationSum > 15