Reputation: 33
I have urls(more than 10k) none are identical but similar and their response times. For example:
URL Response time(ms)
https://[email protected]/order/pick/123543 291
https://[email protected]/deliver/open/1235 589
https://[email protected]/reach/destination/12351223 390
https://[email protected]/pack/box/square/12355444 771
https://[email protected]/pack/box/square/343433 750
https://[email protected]/order/1235321 774
https://[email protected]/order/size/ 433
I want to summarise and render it as time graph. Please help me to count by specific name from URL eg: average response time for all the urls contains 'box' or 'order/size'
Please help me form a query.
Upvotes: 0
Views: 587
Reputation: 5328
This should do what you want:
datatable(URL:string,ResponseTimeInMs:long) [
"https://[email protected]/order/pick/123543",291,
"https://[email protected]/deliver/open/1235",589,
"https://[email protected]/reach/destination/12351223",390,
"https://[email protected]/pack/box/square/12355444",771,
"https://[email protected]/pack/box/square/343433",750,
"https://[email protected]/order/1235321",774,
"https://[email protected]/order/size/",433
]
| extend PartialUrl = tostring(split(URL, "/")[3])
| summarize avg(ResponseTimeInMs) by PartialUrl
| order by avg_ResponseTimeInMs desc
Output:
|------------|----------------------|
| PartialUrl | avg_ResponseTimeInMs |
|------------|----------------------|
| pack | 760.5 |
| deliver | 589 |
| order | 499.333333333333 |
| reach | 390 |
|------------|----------------------|
Or, if you want order
and order/size
separately, then instead of extend PartialUrl = tostring(split(URL, "/")[3])
write extend PartialUrl = replace("[0-9]*", "", replace("https://[email protected]/", "", URL))
, and you'll get the following output:
|--------------------|----------------------|
| PartialUrl | avg_ResponseTimeInMs |
|--------------------|----------------------|
| order/ | 774 |
| pack/box/square/ | 760.5 |
| deliver/open/ | 589 |
| order/size/ | 433 |
| reach/destination/ | 390 |
| order/pick/ | 291 |
|--------------------|----------------------|
Upvotes: 1