Skip to content

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

Open
@kevinco26

Description

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

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions