Azure Monitor 工作簿 - 使用 Bin()

问题描述 投票:0回答:1

我正在尝试将 Azure Monitor 工作簿中的仪表板放在一起,但在尝试使用时间范围和时间“分箱”时遇到问题。

这是当前的查询。

请注意,在下面的查询中,有一个

{time}
参数(时间范围类型)已作为工作簿步骤的一部分创建。

requests
| where name == "Confirmation"
| where resultCode == 200
| where timestamp > {time}
| summarize c=count() by resultCode, bin(timestamp, 1h)
| render columnchart kind=stacked

执行查询时,它会查看时间范围设置来过滤结果(参见下图),然后将结果按小时块进行分组。

现在,当您的时间范围相当短(24/48 小时)时,这很好,因为

bin()
设置为 1 小时。

但是,如果将时间范围延长到 3 / 7 天,则图表会变得非常“繁忙”,因此您需要将 bin 框架更改为 6 小时。

所以,问题是:如何在时间范围更改时动态更改分箱时间范围。

azure azure-application-insights azure-monitor-workbooks
1个回答
0
投票

AFAIK,唯一的方法是添加 bin 的另一个参数,如下所示:

enter image description here

然后将您的查询更改为:

requests 
| where name == "GET /"
| where resultCode == 200
| where timestamp > ago({time})
| summarize c=count() by resultCode, bin(timestamp, {bin})
| render columnchart kind=stacked

然后设置 bin 参数,如下所示:

enter image description here

因此,每当您更改时间参数时,您也需要更改 bin。只能动态更改参数。

© www.soinside.com 2019 - 2024. All rights reserved.