question

Naruto-3237 avatar image
0 Votes"
Naruto-3237 asked ·

Python telemetry insights

I used the below link for adding the telemetry insights to Azure monitor - https://docs.microsoft.com/en-us/azure/azure-monitor/app/opencensus-python.
I am creating new cloud_rolename for this to be tracked, but under performance tab in App insight, I see the cloud_rolename but nothing inside it. The operations are tracked in default cloud_rolename

azure-monitor
· 3
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

python code used to change the cloud_rolename was

def callback_function(envelope):
envelope.tags['ai.cloud.role'] = 'new_role_name'

0 Votes 0 ·

@Naruto-3237 Thanks for your question. I am looking into it and will update you soon.

0 Votes 0 ·
Naruto-3237 avatar image Naruto-3237 SwathiDhanwada-3128 ·

any update on this @SwathiDhanwada-3128

0 Votes 0 ·

1 Answer

SwathiDhanwada-MSFT avatar image
0 Votes"
SwathiDhanwada-MSFT answered ·

@Naruto-3237 I have tested your scenario and I am able to override the cloud role name. For your reference, I am adding sample script that I have tested. Kindly check it , try it from your end and revert if you have further questions.

 import logging
 from opencensus.ext.azure.log_exporter import AzureLogHandler
    
 logger = logging.getLogger(__name__)
    
    
 def callback_function(envelope):
    envelope.tags['ai.cloud.role'] = 'testrole'
       
 handler = AzureLogHandler(connection_string='InstrumentationKey=xxxxxxxx-xxxx-xxxx-xxx-xxxxxxxxxxxx')
 handler.add_telemetry_processor(callback_function)
 logger.addHandler(handler)
    
    
 def valuePrompt():
     line = input("Enter a value: ")
     logger.warning(line)
      
    
 def main():
     while True:
         valuePrompt()
    
 if __name__ == "__main__":
     main()

Reference screenshot from App Insights :

79828-image.png



image.png (25.5 KiB)
·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.