Skip to content

opentelemetry-instrument 0.53b0 release breaks azure-monitor-opentelemetry #2487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cforce opened this issue Apr 12, 2025 · 3 comments
Open

Comments

@cforce
Copy link
Contributor

cforce commented Apr 12, 2025

2025-04-12T10:04:15.99111 Connecting to the container 'main'...
2025-04-12T10:04:16.03838 Successfully Connected to container: 'main' [Revision: 'capps-backend-jfnrv5kcsyxqa--azd-1744450658-dbdb5c7d7-r5q9v', Replica: 'capps-backend-jfnrv5kcsyxqa--azd-1744450658']
2025-04-12T09:57:07.4151555Z stderr F 2025-04-12 09:57:07,364 - WARNING - Exception occurred when instrumenting: flask.
2025-04-12T09:57:07.4151567Z stderr F Traceback (most recent call last):
2025-04-12T09:57:07.4151589Z stderr F File "/usr/local/lib/python3.11/site-packages/azure/monitor/opentelemetry/_configure.py", line 200, in _setup_instrumentations
2025-04-12T09:57:07.4151601Z stderr F conflict = get_dist_dependency_conflicts(entry_point.dist) # type: ignore
2025-04-12T09:57:07.4151613Z stderr F ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-12T09:57:07.4151625Z stderr F File "/usr/local/lib/python3.11/site-packages/opentelemetry/instrumentation/dependencies.py", line 51, in get_dist_dependency_conflicts
2025-04-12T09:57:07.4151638Z stderr F for dep in dist.requires: TypeError: 'method' object is not iterable TypeError: 'method' object is not iterable
2025-04-12T09:57:07.4151650Z stderr F TypeError: 'method' object is not iterable
2025-04-12T09:57:07.4151662Z stderr F 2025-04-12 09:57:07,372 - WARNING - This is a warning message
2025-04-12T09:57:07.4151674Z stderr F 2025-04-12 09:57:07,375 - INFO - Started server process [13]
2025-04-12T09:57:07.4151686Z stderr F 2025-04-12 09:57:07,375 - INFO - Waiting for application startup.
2025-04-12T09:57:08.3320300Z stderr F 2025-04-12 09:57:08,331 - INFO - Application startup complete.
2025-04-12T09:57:08.3627583Z stderr F 2025-04-12 09:57:08,362 - INFO - Application startup complete.
2025-04-12T09:57:08.3641281Z stderr F 2025-04-12 09:57:08,363 - INFO - Application startup complete.
2025-04-12T09:57:08.3847667Z stderr F 2025-04-12 09:57:08,384 - INFO - Application startup complete.
2025-04-12T09:57:08.4119500Z stderr F 2025-04-12 09:57:08,411 - INFO - Application startup complete.
2025-04-12T09:57:08.4410831Z stderr F 2025-04-12 09:57:08,440 - INFO - Application startup complete.
2025-04-12T09:57:08.4437162Z stderr F 2025-04-12 09:57:08,443 - INFO - Application startup complete.
2025-04-12T09:57:08.4463553Z stderr F 2025-04-12 09:57:08,446 - INFO - Application startup complete.
2025-04-12T09:57:08.4470302Z stderr F 2025-04-12 09:57:08,446 - INFO - Application startup complete.


There is a known issue i found
open-telemetry/opentelemetry-python-contrib#3415


@cforce
Copy link
Contributor Author

cforce commented Apr 13, 2025

Its a rabbit whole. I guess i have got over the initial issue by pinning versions in
requirements.in like below....

azure-monitor-opentelemetry==1.6.7
opentelemetry-instrumentation==0.53b0
opentelemetry-instrumentation-asgi==0.53b0
opentelemetry-instrumentation-httpx==0.53b0
opentelemetry-instrumentation-aiohttp-client==0.53b0
opentelemetry-instrumentation-openai

... but now i have a different error message..

Connecting...
2025-04-13T09:12:25.94145  Connecting to the container 'main'...
2025-04-13T09:12:25.99666  Successfully Connected to container: 'main' [Revision: 'capps-backend-jfnrv5kcsyxqa--sxq76iz-b54d6cdc4-2xh9g', Replica: 'capps-backend-jfnrv5kcsyxqa--sxq76iz']
2025-04-13T09:09:27.4808462Z stderr F   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
2025-04-13T09:09:27.4808474Z stderr F   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2025-04-13T09:09:27.4808486Z stderr F   File "/usr/local/lib/python3.11/site-packages/opentelemetry/instrumentation/django/__init__.py", line 244, in <module>
2025-04-13T09:09:27.4808550Z stderr F     from django import VERSION as django_version
2025-04-13T09:09:27.4808567Z stderr F ModuleNotFoundError: No module named 'django'
2025-04-13T09:09:27.4808581Z stderr F 2025-04-13 09:09:26,877 - WARNING - This is a warning message
2025-04-13T09:09:27.4808594Z stderr F 2025-04-13 09:09:26,881 - INFO - Started server process [17]
2025-04-13T09:09:27.4808613Z stderr F 2025-04-13 09:09:26,881 - INFO - Waiting for application startup.
2025-04-13T09:09:27.4808626Z stderr F 2025-04-13 09:09:26,883 - WARNING - This is a warning message
2025-04-13T09:09:27.4808664Z stderr F 2025-04-13 09:09:26,888 - INFO - Started server process [13]
2025-04-13T09:09:27.4808678Z stderr F 2025-04-13 09:09:26,889 - INFO - Waiting for application startup.

Microsoft bundles Django, Flask, FastAPI, etc. instrumentation into azure-monitor-opentelemetry, even if you're not using them.
That's why opentelemetry-instrumentation-django shows up - but it shall not try to force instrumentation when Django is not present - i this a bug in opentelemetry-instrumentation auto detection?

I try below and deploy again to azure aca (only on azure execution it fails, not locally)

export OTEL_PYTHON_DISABLED_INSTRUMENTATIONS=django 
azd env set OTEL_PYTHON_DISABLED_INSTRUMENTATIONS django

https://opentelemetry.io/docs/zero-code/python/configuration/#disabling-specific-instrumentations

@cforce
Copy link
Contributor Author

cforce commented Apr 13, 2025

Solved (added it even as even env var for the container in the bicep

Next rabbit 🐰 😭

2025-04-13T10:06:29.37506  Connecting to the container 'main'...
2025-04-13T10:06:29.48061  Successfully Connected to container: 'main' [Revision: 'capps-backend-jfnrv5kcsyxqa--azd-1744537379-6f6f8777b5-czhmq', Replica: 'capps-backend-jfnrv5kcsyxqa--azd-1744537379']
2025-04-13T09:57:37.2696622Z stderr F   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
2025-04-13T09:57:37.2696643Z stderr F   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
2025-04-13T09:57:37.2696675Z stderr F   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2025-04-13T09:57:37.2696696Z stderr F   File "/usr/local/lib/python3.11/site-packages/opentelemetry/instrumentation/psycopg2/__init__.py", line 145, in <module>
2025-04-13T09:57:37.2696718Z stderr F     import psycopg2
2025-04-13T09:57:37.2696739Z stderr F ModuleNotFoundError: No module named 'psycopg2'
2025-04-13T09:57:37.2696760Z stderr F 2025-04-13 09:57:35,837 - INFO - Started server process [13]
2025-04-13T09:57:37.2696781Z stderr F 2025-04-13 09:57:35,838 - INFO - Waiting for application startup.

@pamelafox
Copy link
Collaborator

They say its fixed in the latest ?

open-telemetry/opentelemetry-python-contrib#3415 (comment)

Have you tried azure-monitor-opentelemetry==1.6.7 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants