Python telemetry insights

Naruto 61 Reputation points
2021-02-17T14:27:11.523+00:00

I used the below link for adding the telemetry insights to Azure monitor - https://learn.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
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,014 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SwathiDhanwada-MSFT 18,551 Reputation points
    2021-03-20T13:24:15.537+00:00

    @Naruto 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

    0 comments No comments