Roh1
Roh1

Reputation: 53

Azure application insights, nested object in Custom Dimension appears as [object Object ]

I have a nested object which i send through the custom dimension to azure appInsights logs below is the object

{
   .
   .
  'special_chars':'6'
  'storage_acc_name':'subrodecadlsdev',
  'top_10_line_width':{
       'LW_101':45,
       'LW_229':78,
       'LW_77':67
    }
}

The top_10_lines_width object is coming as [object Object] in customdimension. Below is the pic

enter image description here

I tried using this query but no luck

extend tp = todynamic(tostring(customDimensions['top_10_line_width']))

This is how the result looks enter image description here

Does this have to do with the object? As it cant be extracted as rows. If so then how do I extract it, I just need the message and tp column to show as a dashboard

So for the context, I am using python, and using opencenus SDK for logging here is the code snippet specifying how I send the logs and custom properties using customdimensions

import logging

from opencensus.ext.azure.log_exporter import AzureLogHandler

logger = logging.getLogger(__name__)
# TODO: replace the all-zero GUID with your instrumentation key.
logger.addHandler(AzureLogHandler(
    connection_string='InstrumentationKey=00000000-0000-0000-0000-000000000000')
)

counts_dict = {
  'special_chars':'6'
  'storage_acc_name':'subrodecadlsdev',
  'top_10_line_width':{
       'LW_101':45,
       'LW_229':78,
       'LW_77':67
    }
}

#this is the line where I am adding my custom props to customdimensions
properties = {'custom_dimensions': counts_dict}  

# Use properties in logging statements
logger.warning('action', extra=properties)

Link to official ms docs

Upvotes: 1

Views: 1251

Answers (0)

Related Questions