customDimensions ordering - monitoring

loubym 26 Reputation points
2020-10-15T16:38:45.117+00:00

Hi! I'm new monitoring in Azure Application insights, so I apologize in advance if my question could sound dumb.

I'm having trouble viewing the metrics and exporting them because many of them have a different order acquisition.
Is sending me the metrics in different orders although in the code I have them ordered like this (please see image attached)
32664-microsoftteams-image-1.png

and when I go to the log query and pull out the metrics to export them, is giving me random ordering, and this is getting difficult to export to PowerBI (also I'm kind of newbie doing this) please see image attached. Each color of the dots are the different ways retrieving and showing me the metrics, is there a way to "force"an order? or request it through the log query an specific order?
32665-screenshot-2020-10-15-111405.png

for example: the customDimensions (or custom properties) I have set it up are Title, Url, UserEmail, UserFullName. And I want them with an order always, to show as

  1. Title :
  2. Url :
  3. UserFullName :
  4. UserEmail :

if somebody knows a way to achieve this I would really really appreciate the help,

thank you in advance!

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,190 questions
0 comments No comments
{count} votes

Accepted answer
  1. Krish G 2,331 Reputation points
    2020-10-16T06:30:42.96+00:00

    @loubym , You can force ordering by projecting out individual customDimentions fields as separate columns in the query by adding 'project' or 'extend' clause in the query pane (in upper part of the log query screen your are viewing). The reason default view of customDimesions field shows random order because it's a json type created out of the dictionary at lower level which does not guaranty ordering.

    In this case, the query would be like:

    customEvents  
    | project timestamp, Title = tostring(customDimensions.Title), UserName = tostring(customDimensions.UserFullName) // add any other fields you want  
    | order by timestamp desc, Title // just an example of result order, adjust as per your need  
    

    Below is a query result in my case:
    32828-image.png

    If you want to maintain the columns in default result, and want to appends columns for the customDimensions fields, you can use 'extend'.

    customEvents  
    | extend Title = tostring(customDimensions.Title), UserName = tostring(customDimensions.UserFullName) // add any other fields you want  
    | order by timestamp desc, Title // just an example of result order, adjust as per your need  
    

    Refer Overview of log queries in Azure Monitor for 'Kusto Query Language'.

    NOTE: In all the above queries, we are ordering on a 'custom' dynamic fields in customDimesions which requires to specify datatype conversion like in this case since these are string fields, I had to use 'tostring'. If it were some other types like int, double etc. we need to use respective function. But for any other fixed field in the log like for example timestamp, we won't need any conversion function.

    customEvents  
    | project timestamp, name  
    | order by timestamp desc  
    

    32768-image.png

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.