天青Kustos查询:Urls的平均响应时间

时间:2020-09-18 08:04:35

标签: azure kusto

我有url(大于10k),没有相同但相似的类,它们的响应时间也一样。 例如:

URL                                                   Response time(ms)
https://abc@example.com/order/pick/123543               291
https://abc@example.com/deliver/open/1235               589
https://abc@example.com/reach/destination/12351223      390
https://abc@example.com/pack/box/square/12355444        771
https://abc@example.com/pack/box/square/343433          750
https://abc@example.com/order/1235321                   774
https://abc@example.com/order/size/                     433

我想总结一下并将其呈现为时间图。 请帮助我按网址中的特定名称进行计数,例如:所有网址的平均响应时间包含“框”或“订单/尺寸”

请帮助我进行查询。

1 个答案:

答案 0 :(得分:1)

这应该做您想要的:

select a from A a LEFT JOIN FETCH a.B

输出:

datatable(URL:string,ResponseTimeInMs:long) [
    "https://abc@example.com/order/pick/123543",291,
    "https://abc@example.com/deliver/open/1235",589,
    "https://abc@example.com/reach/destination/12351223",390,
    "https://abc@example.com/pack/box/square/12355444",771,
    "https://abc@example.com/pack/box/square/343433",750,
    "https://abc@example.com/order/1235321",774,
    "https://abc@example.com/order/size/",433
]
| extend PartialUrl = tostring(split(URL, "/")[3])
| summarize avg(ResponseTimeInMs) by PartialUrl
| order by avg_ResponseTimeInMs desc

或者,如果您想分别使用|------------|----------------------| | PartialUrl | avg_ResponseTimeInMs | |------------|----------------------| | pack | 760.5 | | deliver | 589 | | order | 499.333333333333 | | reach | 390 | |------------|----------------------| order,请写order/size而不是extend PartialUrl = tostring(split(URL, "/")[3]),您将获得以下输出:

extend PartialUrl = replace("[0-9]*", "", replace("https://abc@example.com/", "", URL))