Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application Insights - How to sort by custom dimension

I would like to sort the results of my query according to customDimension.MyCustomProperty which is present in all entities and is a number. How can I do that?

like image 859
Leonardo Avatar asked Apr 13 '17 12:04

Leonardo


People also ask

How do you query custom events in application Insights?

In the Azure Portal, navigate to the Application Insights resource, and click Log Analytics. Log queries help you to fully leverage the value of the data collected in Azure Monitor Logs. Query your custom events by entering “customEvents” in the prompt and click Run.

Are application Insights deprecated?

Because the workspace-based Application Insights enhances your monitoring experience, we retire the classic Application Insights on 29 February 2024.

What is telemetry in application Insights?

Application Insights telemetry model defines a way to correlate telemetry to the operation of which it's a part. For example, a request can make a SQL Database calls and recorded diagnostics info. You can set the correlation context for those telemetry items that tie it back to the request telemetry.


1 Answers

What I would suggest is first extending your result set with your customDimension. Then you'll have to cast your new column to either a string, an int or a double. The reason for this is that customDimensions is considered a dynamic column

A quick example:

traces | extend sortKey = toint(customDimensions.MyCustomProperty) | order by sortKey asc 

The casting options are:

  • tostring()
  • toint()
  • todouble()

If you want to remove the sorting key after the actual sort, you can project-away the new column.

like image 83
Yannick Meeus Avatar answered Oct 05 '22 05:10

Yannick Meeus