Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
([#241](https://github.com/microsoft/ApplicationInsights-Python/pull/241))
- Defaulting logging env var for auto-instrumentation. Added logging samples.
([#240](https://github.com/microsoft/ApplicationInsights-Python/pull/240))
- Removed old log_diagnostic_error calls from configurator
([#242](https://github.com/microsoft/ApplicationInsights-Python/pull/242))

## [1.0.0b8](https://github.com/microsoft/ApplicationInsights-Python/releases/tag/v1.0.0b8) - 2022-09-26

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,28 @@
# --------------------------------------------------------------------------


import logging

from azure.monitor.opentelemetry.distro._diagnostics._diagnostic_logging import (
AzureDiagnosticLogging,
)
from opentelemetry.sdk._configuration import _OTelSDKConfigurator

_logger = logging.getLogger(__name__)


class AzureMonitorConfigurator(_OTelSDKConfigurator):
def _configure(self, **kwargs):
try:
AzureDiagnosticLogging.enable(_logger)
super()._configure(**kwargs)
except ValueError as e:
AzureDiagnosticLogging.log_diagnostic_error(
f"The components failed to initialize due to a ValueError: {e}"
_logger.error(
f"Azure Monitor Configurator failed during configuration due to a ValueError: {e}"
)
raise e
except Exception as e:
AzureDiagnosticLogging.log_diagnostic_error(
f"The components failed to initialize: {e}"
_logger.error(
f"Azure Monitor Configurator failed during configuration: {e}"
)
raise e