I am doing project on Python. Currently it uses OpenCensus AzureMonitorTraceExporter as logging handler to write data to Application Insights. It is important for the client to use Usage section of Application Insights (Users, Events and Sessions specifically). But Usage takes data from the customEvents table of Application Insights and sending writing data to customEvents is not supported by Open Telemetry. Is there any way now to utilize Users, Events and Sessions without using deprecated libraries in Python code?
Add a comment
|
1 Answer
. Is there any way now to utilize
Users,EventsandSessionswithout using deprecated libraries in Python code?
AFAIK, newer versions are sending data to dependencies and custom metrics but not to CustomEvents. Below code works and sends logs to CustomEvents and I followed Microsoft-Document:
import logging
from opencensus.ext.azure.log_exporter import AzureEventHandler
rith_logger = logging.getLogger(__name__)
rith_logger.addHandler(AzureEventHandler(connection_string='InstrumentationKey=a2dec3a2-4e8df;IngestionEndpoint=https://eastus-8.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/'))
rith_logger.setLevel(logging.INFO)
rith_logger.info('Hello, Rithwik Bojja!')
Output:
