opencensus-python icon indicating copy to clipboard operation
opencensus-python copied to clipboard

Failed to establish a new connection with aplicationinsights.azure.com

Open kevinco26 opened this issue 2 years ago • 1 comments

Describe your environment. Using Opencensus-ext-azure==1.1.3 Python 3.11 Windows machine.

my python code has:

import logging
from opencensus.ext.azure.log_exporter import AzureLogHandler
logger = logging.getLogger(__name__)
logger.addHandler(AzureLogHandler(
    connection_string='<instrumentation key>)
)
logger.exception('Captured an exception.')

This code is running inside my FastAPI backend

When I run my backend api I get the following error repeatedly multiple times Retrying due to transient client side error HTTPSConnectionPool(host='westus-0.in.applicationinsights.azure.com', port=443): Max retries exceeded with url: //v2.1/track (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001E8062DFED0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')).

Also, I don't see anything being logged to application insights.. I used to see it and not anymore.. not sure what changed. Steps to reproduce. Describe exactly how to reproduce the error. Include a code sample if applicable.

What is the expected behavior? Expecting to see logs in azure and expecting to not see Failed to establish connection?

What is the actual behavior? No logs in app insights and connection error emmitted by the handler

kevinco26 avatar Aug 10 '23 18:08 kevinco26

Are you running this in any container of some sort? Perhaps something with your backend api is preventing network calls to be made to the app insights backend

lzchen avatar Sep 15 '23 18:09 lzchen