azure application insights custom dimeptions parameter - calculate query

122 views Asked by At

Is there a way i can use Azure application insights to construct a query that can use numeric paramters in custom dimetions and calculate total value across entries matching criteria?

for instance - say prop_userId in the example below is 101. in other entries the value might be different, say 9 or 58 or 102.

i would like to calculate total value by adding all those values - 101 + 9 + 58 + 102 - adding together values for all entries in the logs together. is something like this possible to construct in app insights portal or would i have to do this in code?

azure app insights example

1

There are 1 answers

3
RithwikBojja On

adding together values for all entries in the logs together. is something like this possible to construct in app insights portal or would i have to do this in code?

Yes, it is possible and I have reproduced in my environment and got expected results as below:

Taken values inside custom dimension using parse_json and aggregate functions(sum,avg) :

enter image description here

Kql Query:

requests 
| sort by timestamp asc
| extend prop= parse_json(customDimensions) 
| extend Value = prop.FunctionExecutionTimeMs
| summarize avrg= avg(todouble(Value)) , Total = sum(todouble(Value))
| project avrg, Total, per=(avrg/Total)*100

Output:

enter image description here

You can also refer this for further information on parse_json.