在使用Azure Kusto中的时间表时遇到了一些麻烦。 在此图表中,我们随时间将http异常分组。
问题在于,图表仍然报告不存在该异常的时间点的最后一次看到的值。 参见红色标记。 在此特定情况下,我们看到图表在5:28的/ poll端点上报告了3.23k个异常。虽然实际上当时没有这种错误。
查询看起来像这样
AppServiceHTTPLogs
| where TimeGenerated > ago(1d)
| where ScStatus >= 500
| summarize count() by tostring(CsUriStem), bin(TimeGenerated, 30m)
| render timechart
使用柱形图可以使问题消失,但是随之而来的价格却不那么清晰。 还有其他选择吗?
我们可以以某种方式使缺失值默认为0吗?
答案 0 :(得分:4)
您应该能够使用make-series运算符填充默认零:
https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/make-seriesoperator
AppServiceHTTPLogs
| where TimeGenerated > ago(1d)
| where ScStatus >= 500
| make-series count() on TimeGenerated from ago(1d) to now() step 30min by tostring(CsUriStem)
| render timechart
某些UX客户端不知道如何表示序列数据-在这种情况下,您可以使用mv-expand对其进行扩展:
AppServiceHTTPLogs
| where TimeGenerated > ago(1d)
| where ScStatus >= 500
| make-series count() on TimeGenerated from ago(1d) to now() step 30min by tostring(CsUriStem)
| mv-expand count_ to typeof(long)
| render timechart