remove custom dimension items from application insights if you are using opencensus-python

By inspection of the source code, the properties do seem rather hard to avoid to create, but it is possible to remove them by post-processing the envelope:

import logging

from import AzureLogHandler

custom_dimensions = {'foo': 'bar'}

def remove_items(envelope): = custom_dimensions
    return True

logger = logging.getLogger(__name__)
handler = AzureLogHandler(connection_string='InstrumentationKey=00000000-0000-0000-0000-000000000000')

This is tested and works in opencensus-ext-azure version 1.0.5.

enter image description here

Notice also that with this approarch, it is no longer necessary to specify the extra when logging.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top