How do I connect to Azure Monitor Opentelemetry via Corporate Proxy
Shahnawaz
21
Reputation points
May I know how can we connect to Azure Insights using Azure Monitor Opentelemetry library via corporates proxy. I have read the document and also tried to pass the proxies = {"http/https": "hostname:port"} inside configure_azure_monitor(connection_string="APPLICATIONINSIGHTS_CONNECTION_STRING",proxies={"https":"hostname:port"}) but it never worked. May seek you help with the below code.
Sample Example: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry/samples
from logging import INFO, getLogger
from azure.monitor.opentelemetry import configure_azure_monitor
configure_azure_monitor(
# Set logger_name to the name of the logger you want to capture logging telemetry with
logger_name="my_application_logger",
)
# Logging calls with this logger will be tracked
logger = getLogger("my_application_logger")
logger.setLevel(INFO)
# Logging calls with any logger that is a child logger will also be tracked
logger_child = getLogger("my-application_logger.module")
logger_child.setLevel(INFO)
# Logging calls with this logger will not be tracked
logger_not_tracked = getLogger("not_my_application_logger")
logger_not_tracked.setLevel(INFO)
logger.info("info log")
logger.warning("warning log")
logger.error("error log")
logger.info("info log")
logger.warning("warning log")
logger.error("error log")
logger_not_tracked.info("info log2")
logger_not_tracked.warning("warning log2")
logger_not_tracked.error("error log2")