Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to "Group By" by result and count in Azure App Insights

I'm trying to group some results I have in app insights and am struggling

If I were to tabulate my results, it would look like

Product        Version

 A              1
 B              2
 A              2
 A              1
 B              3
 B              3

As you can see, I have 2 products (A and B), and each has a version number.

I am trying to group these and provide a count, so my end result is

Product        Version       Count

 A              1              2
 A              2              1 
 B              2              1
 B              3              2

At the moment, my approach is a mess because I am doing this manually with

customEvents
| summarise A1 = count(customEvents.['payload.prod'] == "A" and myEvents.['payload.vers'] == "1"),
| summarise A2 = count(customEvents.['payload.prod'] == "A" and myEvents.['payload.vers'] == "2")

I have no idea how I can aggregate these so it can group by product and version and then count the occurrences of each

like image 821
MyDaftQuestions Avatar asked Apr 30 '19 10:04

MyDaftQuestions


People also ask

How do you query logs in application Insights?

View logs in Application InsightsGo to Application Insights resource in your resource group. Go to Logs under Monitoring section. Click on traces eye button to get log traces. Select Time Range and click Run.

What's the difference between Azure monitor log analytics and application Insights?

Re: Difference between Log Analytics and MonitorMonitor is the brand, and Log Analytics is one of the solutions. Log Analytics and Application Insights have been consolidated into Azure Monitor to provide a single integrated experience for monitoring Azure resources and hybrid environments.

What is telemetry in Azure application Insights?

Azure Application Insights sends telemetry from your web application to the Azure portal, so that you can analyze the performance and usage of your application. The telemetry model is standardized so that it is possible to create platform and language-independent monitoring.

What is sampling in Azure application Insights?

Sampling is a feature in Azure Application Insights. It's the recommended way to reduce telemetry traffic, data costs, and storage costs, while preserving a statistically correct analysis of application data. Sampling also helps you avoid Application Insights throttling your telemetry.


1 Answers

I think your are looking for:

customEvents
| extend Product = tostring(customDimensions.prod) 
| extend MajorVersion = split(customDimensions.Version, ".")[0] 
| summarize Count = count() by Product , tostring(MajorVersion) 

I wrote this off the top off my head so there might be some syntax issues. I assumed prod and vers are in the customdimensions, let me know if it is otherwise.

You can summarize by multiple fields as you can see.

like image 117
Peter Bons Avatar answered Oct 25 '22 05:10

Peter Bons