如何在 Azure Monitor 工作簿中创建缺失值(或零)的连续时间图表?

发布于 2025-01-12 07:10:48 字数 1756 浏览 0 评论 0原文

我正在尝试创建一个时间图表,显示每分钟请求 (RPS) 指标,其中有两条单独的行:一条用于总请求(限制 + 非限制),另一条用于仅限制请求。我设法获取时间表,请参见下图,但是如果您注意到代表受限制的请求的红线显示为不连续,并且与蓝线相比有间隙。如何使 x 轴上的红线下降到零,然后当它具有正值时又尖峰回来。从视觉上看,这更有意义,并且也清楚地显示了下降到零。

我正在做一些研究,发现也许有一个系列(make-series 运算符)会让它更容易,但不确定如何将它适合这个查询。

输入图片此处描述

let T = datatable(Timestamp:datetime, ResultType:string, ResultSignature:string, CorrelationId:string) [
"2022-03-02T14:35:05.6846874Z", "Throttled", "200", "a8de8a0b-2b95-4e16-a90f-d96c1f404850",
"2022-03-02T14:35:06.9535229Z", "Throttled", "200", "7e00ac15-6e82-42a5-8171-3145ae27728f",
"2022-03-02T14:34:21.1880149Z", "Non-Throttled", "200", "8fa9f7ee-6a91-4b8c-b170-9649befa698c",
"2022-03-02T14:34:36.9887590Z", "Non-Throttled", "200", "de7d82be-49b8-44dc-856c-16f76c7a4ae5",
"2022-03-02T14:34:39.3999879Z", "Non-Throttled", "200", "99b67d55-3ee4-4aee-9415-03919b2f23a4",
"2022-03-02T14:34:40.7854748Z", "Non-Throttled", "400", "dec5cd49-9d64-469a-83aa-db759c2e2fb1",
"2022-03-02T14:34:44.2007485Z", "Non-Throttled", "200", "5b412e71-6e48-49e2-9298-fd13d31619d1",
"2022-03-02T14:34:55.6858503Z", "Throttled", "200", "482592f9-722c-4f5d-8e48-967fa655d704",
"2022-03-02T14:25:17.0269766Z", "Throttled", "200", "1732c865-2474-4f76-b0cd-64af5981af7c",
"2022-03-02T14:25:18.9668944Z", "Throttled", "200", "234ec84c-3a0a-4329-a492-f8d590267ec6",
"2022-03-02T14:25:21.8262878Z", "Throttled", "200", "be8bd024-8f5c-4a01-9703-2945ef3bc8ba",
    ];
T 
| project Timestamp, ResultType, ResultSignature , CorrelationId
| summarize Throttled =  countif(ResultType == "Throttled"),
            Total_Requests = count()
         by bin(Timestamp,1m) 

I am trying to create a time-chart showing request per minute (RPS) metric with two separate lines: one for the total requests (throttled + non throttled), and the other for throttled only requests. I manage to get the time-chart, see the image below, but if you notice the red line representing throttled requests shows up as not-continuous and has gaps in it compared to the blue line. How can I make the red line drops to zero on the x-axis and then it spikes back when it has a positive value. Visually, this makes more sense and also clearly shows a drop to zero.

I was doing some research and found out that maybe having a series (make-series operator) makes it easier but not sure how to fit it into this query.

enter image description here

let T = datatable(Timestamp:datetime, ResultType:string, ResultSignature:string, CorrelationId:string) [
"2022-03-02T14:35:05.6846874Z", "Throttled", "200", "a8de8a0b-2b95-4e16-a90f-d96c1f404850",
"2022-03-02T14:35:06.9535229Z", "Throttled", "200", "7e00ac15-6e82-42a5-8171-3145ae27728f",
"2022-03-02T14:34:21.1880149Z", "Non-Throttled", "200", "8fa9f7ee-6a91-4b8c-b170-9649befa698c",
"2022-03-02T14:34:36.9887590Z", "Non-Throttled", "200", "de7d82be-49b8-44dc-856c-16f76c7a4ae5",
"2022-03-02T14:34:39.3999879Z", "Non-Throttled", "200", "99b67d55-3ee4-4aee-9415-03919b2f23a4",
"2022-03-02T14:34:40.7854748Z", "Non-Throttled", "400", "dec5cd49-9d64-469a-83aa-db759c2e2fb1",
"2022-03-02T14:34:44.2007485Z", "Non-Throttled", "200", "5b412e71-6e48-49e2-9298-fd13d31619d1",
"2022-03-02T14:34:55.6858503Z", "Throttled", "200", "482592f9-722c-4f5d-8e48-967fa655d704",
"2022-03-02T14:25:17.0269766Z", "Throttled", "200", "1732c865-2474-4f76-b0cd-64af5981af7c",
"2022-03-02T14:25:18.9668944Z", "Throttled", "200", "234ec84c-3a0a-4329-a492-f8d590267ec6",
"2022-03-02T14:25:21.8262878Z", "Throttled", "200", "be8bd024-8f5c-4a01-9703-2945ef3bc8ba",
    ];
T 
| project Timestamp, ResultType, ResultSignature , CorrelationId
| summarize Throttled =  countif(ResultType == "Throttled"),
            Total_Requests = count()
         by bin(Timestamp,1m) 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

再浓的妆也掩不了殇 2025-01-19 07:10:48

为了切换到使用 make-series,您可以替换:

|总结 Throttled = countif(ResultType == "Throttled"), Total_Requests = count() by bin(Timestamp,1m)

如下:

| make-series Throttled = countif(ResultType == "Throttled"), Total_Requests = count() on Timestamp Step 1m

in order to switch to using make-series, you can replace this:

| summarize Throttled = countif(ResultType == "Throttled"), Total_Requests = count() by bin(Timestamp,1m)

with this:

| make-series Throttled = countif(ResultType == "Throttled"), Total_Requests = count() on Timestamp step 1m

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文