So in the carrots example in the read me, if I wanted to add an customDimension called “environment”, I would do the following:
tag_key = tag_key.TagKey("environment") tag_map = tag_map_module.TagMap().insert(tag_key, tag_value.TagValue(“staging”))
Then on calling the .record() method for the measure
This is what I have done and the code works I just dont see the custom dimension in app insights. Am I going about this the right way?
Hi I am trying to use opencensus-ext-azure in the following way:
import logging import logging.handlers from opencensus.ext.azure.log_exporter import AzureLogHandler log = logging.getLogger(__name__) root_logger = logging.getLogger() telemetry_handler = AzureLogHandler( connection_string='InstrumentationKey=00000-000-000-000-00000') telemetry_handler.setLevel(logging.INFO) root_logger.addHandler(telemetry_handler) def close_everything(): log.info('closing everything') try: some_error except: log.exception('some exception', exc_info=False) pass import atexit atexit.register(close_everything) atexit.register(logging.shutdown)
The issue is that python session hangs at exit(). I think line which is creating problem is
log.exception('some exception', exc_info=False). Can you please help. Thanks !
close_everythingisn't being called correct?
AzureLogHandlerregisters a flush operation upon exit of the main script, how long is the session hanging for?
try removing logging.shutdownyour suggestion worked. In the background this was happening: