With Python application, you can use OpenCensus to send the telemetry data. However, if your requirement is to use custom dimensions, you can use as below:
import loggingfrom opencensus.ext.azure.log_exporter import AzureLogHandlerlogger = logging.getLogger(__name__)# TODO: replace the all-zero GUID with your instrumentation key.logger.addHandler(AzureLogHandler(connection_string='InstrumentationKey=00000000-0000-0000-0000-000000000000'))properties = {'custom_dimensions': {'key_1': 'value_1', 'key_2': 'value_2'}}# Use properties in logging statementslogger.warning('action', extra=properties) |
In case, your requirement is to use correlation ID with custom dimensions, Function App does not have the feature available yet. The team is working on a solution to light up this feature.
Until then, use the example below and initialize the OpenCensus component with the correlation id in your function’s trigger.
Also, check the OpenCensus Azure extension Repository: https://github.com/census-instrumentation/opencensus-python/tree/master/contrib/opencensus-ext-azure...
Hope this helps!
Shashank Ranjan
Azure App Services Support Engineering
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.