0

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

Roh1
  • 43
  • 1
  • 7
  • Can you please attach a fiddler session of how you actually send it? Which SDK do you use? – ZakiMa Jun 07 '22 at 05:05
  • @ZakiMa I am using opencensus which is a python SDK. I have added the code snippet and link to the official docs to the question – Roh1 Jun 07 '22 at 06:11
  • This helps. Would it be also possible to see a fiddler stream? I'm interested in how exactly this object got serialized. The value is supposed to be a string, not an object. If it is serialized as such then the problem is in backend, otherwise it is in SDK (or you might need to serialize it manually to string). – ZakiMa Jun 07 '22 at 08:31
  • You were right. Serialization was the issue, I serialized the top_10_line_width and then the issue is resolved. So I did like this `counts_dict['top_10_line_width'] = json.dumps(top_10_line_width)` – Roh1 Jun 07 '22 at 09:20

0 Answers0