Description
- Package Name: azure-monitor-opentelemetry
- Package Version: 1.3.0
- Operating System: Debian (bookworm)
- Python Version: 3.10
Describe the bug
I'm worried I'm opening up an old 'bug': #33741 but I'm still having problems with Failures being reported to Azure Application Insights. The opentelemtry-python-contrib project has updated to include support for Flask 3 (version 1.23.0/0.44b0) and I can confirm that it's working as expected. However, when I include OTEL_PYTHON_EXCLUDED_URLS
to keep one of my endpoints from reporting, they're still showing up as a request and a failed one
To Reproduce
Steps to reproduce the behavior:
I'm going to include some sample code in a docker file that you can try:
app.py:
from azure.monitor.opentelemetry import configure_azure_monitor
configure_azure_monitor()
import flask
app = flask.Flask(__name__)
@app.route("/")
def test():
print('got one')
return "Test flask request"
@app.route("/health")
def health():
print('health endpoint')
return "Health request"
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8080)
Dockerfile:
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
COPY requirements.txt .
RUN python -m pip install -r requirements.txt
WORKDIR /app
COPY . /app
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser
CMD ["python", "app.py"]
requirements.txt:
Flask==3.0.0
azure-monitor-opentelemetry==1.3.0
And to run it:
docker build -t azuretelemetry . && docker run --rm -p 8080:8080 -e APPLICATIONINSIGHTS_CONNECTION_STRING=$APPLICATIONINSIGHTS_CONNECTION_STRING -e OTEL_EXPERIMENTAL_RESOURCE_DETECTORS=$OTEL_EXPERIMENTAL_RESOURCE_DETECTORS -e OTEL_PYTHON_EXCLUDED_URLS=$OTEL_PYTHON_EXCLUDED_URLS azuretelemetry
Where OTEL_PYTHON_EXCLUDED_URLS="health,swagger.*"
Expected behavior
Endpoint requests are ignored
Any suggestions? Is this a different project that would need to take care of this? Am I doing something wrong?