Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grouping Results in an Azure App Insights Analytics Query

I'm quite new to Azure App Insights analytics and I'm still trying to learn how to use the query language. I'm trying to query the page view data to show browser usage over the last week. I can do this ok, however, to be more useful for my purposes I need to group the different versions of (say) Chrome under a single heading "Chrome" rather than having an entry for each version number. I then wish to do the same for the other major browsers and finally group any left over entries under "Other". I have had some limited success in summarizing the browsers with the following query:

// Total of Page views by Browser version
pageViews
| where timestamp >= ago(7d)
| summarize 
Safari = countif(client_Browser contains "Safari"), iOS = 
countif(client_Browser contains "Mobile Safari"), Samsung = 
countif(client_Browser contains "Samsung"), Chrome = countif(client_Browser 
contains "Chrome"), Edge = countif(client_Browser contains "Edge"), Firefox 
= countif(client_Browser contains "Firefox") by bin(timestamp,3h)
| order by timestamp asc 
| render barchart

This will indeed show me a chart close to what I'm after, but, for some reason, only picks up the first four headings here (so Safari, iOS, Chrome and Samsung) but doesn't show Edge or Firefox. There are definitely hits from Edge and Firefox as they appear in the results when I don't try this grouping. Can anybody shed some light on where I'm going wrong?

Thanks

like image 717
Drum Avatar asked Oct 17 '22 06:10

Drum


1 Answers

Just to answer my own question: all the results were actually there it's just Analytics itself (helpfully?) only selects the first four unless you specify otherwise in a drop down menu at the top of the chart.

Boy, do I feel stupid?

like image 124
Drum Avatar answered Nov 15 '22 08:11

Drum