Query for Average response time based on a sub set of the Azure Subscription

%3CLINGO-SUB%20id%3D%22lingo-sub-228194%22%20slang%3D%22en-US%22%3EQuery%20for%20Average%20response%20time%20based%20on%20a%20sub%20set%20of%20the%20Azure%20Subscription%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-228194%22%20slang%3D%22en-US%22%3E%3CP%3EFirst%20time%20poster%20and%20very%20new%20to%20ALA...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20multiple%20sites%20within%20my%20Application%20insights%20resource%20and%20I%20want%20to%20get%20the%20Average%20Response%20time%20for%20each%20of%20the%20app%2Fapi's%20and%20then%20use%20them%20to%20create%20alerts%20if%20they%20go%20over%20our%20target%20SLA.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EShould%20I%20be%20using%26nbsp%3B%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3Erequests%20%7C%20%3C%2FSPAN%3E%3CSPAN%3Esearch%3C%2FSPAN%3E%20%3CSPAN%3E%22https%3A%2F%2Fnameofsite%22%20to%20help%20seperate%20these%20and%20what%20query%20do%20I%20used%20to%20get%20this%20data%3F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EMany%20thanks%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-228194%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EApplication%20Insights%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EQuery%20Language%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-234724%22%20slang%3D%22en-US%22%3ERe%3A%20Query%20for%20Average%20response%20time%20based%20on%20a%20sub%20set%20of%20the%20Azure%20Subscription%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-234724%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Stephen%2C%20welcome%20aboard%20%3A)%3C%2Fimg%3E%3C%2FP%3E%0A%3CP%3EFirst%20I'd%20just%20note%20it%20might%20be%20easier%20to%20manage%20separate%20sites%20over%20separate%20Application%20Insights%20resources%2C%20that%20would%20help%20you%20monitor%20each%20site%20separately.%3C%2FP%3E%0A%3CP%3ETo%20your%20question%2C%20I%20would%20suggest%20to%20create%20a%20runtime%20field%20(let's%20call%20it%20%22domain%22%20in%20this%20example)%20and%20then%20calculate%20the%20average%20duration%20for%20each%20domain.%20%60parse%60%20is%20a%20cool%20command%20that's%20meant%20for%20this%20kind%20of%20string%20parsing%3A%3C%2FP%3E%0A%3CPRE%3Erequests%0A%7C%20parse%20url%20with%20%22https%3A%2F%2F%22%20domain%20%22%2F%22%20*%0A%7C%20summarize%20avg(duration)%20by%20domain%3C%2FPRE%3E%0A%3CP%3Eif%20some%20of%20your%20sites%20start%20with%20%22http%22%20and%20some%20with%20%22https%22%2C%20the%20parse%20pattern%20should%20be%20a%20bit%20different%3A%3C%2FP%3E%0A%3CPRE%3Erequests%0A%7C%20parse%20url%20with%20*%20%22%3A%2F%2F%22%20domain%20%22%2F%22%20*%0A%7C%20summarize%20avg(duration)%20by%20domain%3C%2FPRE%3E%0A%3CP%3EHTH%2C%3C%2FP%3E%0A%3CP%3ENoa%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Visitor

First time poster and very new to ALA...

 

I have multiple sites within my Application insights resource and I want to get the Average Response time for each of the app/api's and then use them to create alerts if they go over our target SLA.  

 

Should I be using 

requests | search "https://nameofsite" to help seperate these and what query do I used to get this data?
 
Many thanks,
1 Reply
Highlighted

Hi Stephen, welcome aboard :)

First I'd just note it might be easier to manage separate sites over separate Application Insights resources, that would help you monitor each site separately.

To your question, I would suggest to create a runtime field (let's call it "domain" in this example) and then calculate the average duration for each domain. `parse` is a cool command that's meant for this kind of string parsing:

requests
| parse url with "https://" domain "/" *
| summarize avg(duration) by domain

if some of your sites start with "http" and some with "https", the parse pattern should be a bit different:

requests
| parse url with * "://" domain "/" *
| summarize avg(duration) by domain

HTH,

Noa