kareem
kareem

Reputation: 773

Query a list of custom dimension keys

I'm looking to build a distinct list of all the custom dimension keys that exist in a set of results. I can't find a function to isolate the key names. The closest I can find is mvexpand but that still keeps each key/value pair in a dictionary.

Is there an application insights function to extract key names from a dictionary?

Upvotes: 1

Views: 1507

Answers (2)

cResults
cResults

Reputation: 793

This worked for us:

traces
| project (customDimensions)
| extend keybag = bag_keys(customDimensions)
| mv-expand (keybag)
| extend property = tostring(keybag)
| distinct property
| order by property asc

Upvotes: 0

Dmitry Matveev
Dmitry Matveev

Reputation: 2679

If you do | mvexpand bagexpansion=array you'll be able to address the column names as you would with an array index via customDimensions[0]:

| mvexpand bagexpansion=array customDimensions
| distinct tostring(customDimensions[0])

Upvotes: 3

Related Questions