Skip to content

autoinstrumentation: don't print duplicated conflict log error message #3432

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

Merged
merged 4 commits into from
Apr 18, 2025

Conversation

emdneto
Copy link
Member

@emdneto emdneto commented Apr 18, 2025

Description

When testing the new version in the otel-operator, I'm getting errors:

DependencyConflict: requested: "starlette >= 0.13, <0.15" but found: "starlette 0.46.2"

The same message is also logged as debug:

ERROR:opentelemetry.instrumentation.instrumentor:DependencyConflict: requested: "starlette >= 0.13, <0.15" but found: "starlette 0.46.2"
DEBUG:opentelemetry.instrumentation.auto_instrumentation._load:Skipping instrumentation starlette: DependencyConflict: requested: "starlette >= 0.13, <0.15" but found: "starlette 0.46.2"

MRE:

# /// script
# requires-python = ">=3.13"
# dependencies = [
#     "fastapi",
#     "opentelemetry-distro==0.53b1",
#     "opentelemetry-exporter-otlp-proto-http==1.32.0",
#     "opentelemetry-exporter-prometheus==0.53b1",
#     "opentelemetry-instrumentation==0.53b1",
#     "opentelemetry-instrumentation-aio-pika==0.53b1",
#     "opentelemetry-instrumentation-aiohttp-client==0.53b1",
#     "opentelemetry-instrumentation-aiohttp-server==0.53b1",
#     "opentelemetry-instrumentation-aiokafka==0.53b1",
#     "opentelemetry-instrumentation-aiopg==0.53b1",
#     "opentelemetry-instrumentation-asgi==0.53b1",
#     "opentelemetry-instrumentation-asyncio==0.53b1",
#     "opentelemetry-instrumentation-asyncpg==0.53b1",
#     "opentelemetry-instrumentation-aws-lambda==0.53b1",
#     "opentelemetry-instrumentation-boto==0.53b1",
#     "opentelemetry-instrumentation-boto3sqs==0.53b1",
#     "opentelemetry-instrumentation-botocore==0.53b1",
#     "opentelemetry-instrumentation-cassandra==0.53b1",
#     "opentelemetry-instrumentation-celery==0.53b1",
#     "opentelemetry-instrumentation-click==0.53b1",
#     "opentelemetry-instrumentation-confluent-kafka==0.53b1",
#     "opentelemetry-instrumentation-dbapi==0.53b1",
#     "opentelemetry-instrumentation-django==0.53b1",
#     "opentelemetry-instrumentation-elasticsearch==0.53b1",
#     "opentelemetry-instrumentation-falcon==0.53b1",
#     "opentelemetry-instrumentation-fastapi==0.53b1",
#     "opentelemetry-instrumentation-flask==0.53b1",
#     "opentelemetry-instrumentation-grpc==0.53b1",
#     "opentelemetry-instrumentation-httpx==0.53b1",
#     "opentelemetry-instrumentation-jinja2==0.53b1",
#     "opentelemetry-instrumentation-kafka-python==0.53b1",
#     "opentelemetry-instrumentation-logging==0.53b1",
#     "opentelemetry-instrumentation-mysql==0.53b1",
#     "opentelemetry-instrumentation-mysqlclient==0.53b1",
#     "opentelemetry-instrumentation-pika==0.53b1",
#     "opentelemetry-instrumentation-psycopg==0.53b1",
#     "opentelemetry-instrumentation-psycopg2==0.53b1",
#     "opentelemetry-instrumentation-pymemcache==0.53b1",
#     "opentelemetry-instrumentation-pymongo==0.53b1",
#     "opentelemetry-instrumentation-pymysql==0.53b1",
#     "opentelemetry-instrumentation-pyramid==0.53b1",
#     "opentelemetry-instrumentation-redis==0.53b1",
#     "opentelemetry-instrumentation-remoulade==0.53b1",
#     "opentelemetry-instrumentation-requests==0.53b1",
#     "opentelemetry-instrumentation-sqlalchemy==0.53b1",
#     "opentelemetry-instrumentation-sqlite3==0.53b1",
#     "opentelemetry-instrumentation-starlette==0.53b1",
#     "opentelemetry-instrumentation-system-metrics==0.53b1",
#     "opentelemetry-instrumentation-threading==0.53b1",
#     "opentelemetry-instrumentation-tornado==0.53b1",
#     "opentelemetry-instrumentation-tortoiseorm==0.53b1",
#     "opentelemetry-instrumentation-urllib==0.53b1",
#     "opentelemetry-instrumentation-urllib3==0.53b1",
#     "opentelemetry-instrumentation-wsgi==0.53b1",
#     "opentelemetry-propagator-aws-xray==1.0.2",
#     "opentelemetry-propagator-b3==1.30.0",
#     "opentelemetry-propagator-jaeger==1.30.0",
#     "opentelemetry-propagator-ot-trace==0.53b1",
#     "urllib3<2.3.0",
# ]
# ///


from opentelemetry.instrumentation.auto_instrumentation import initialize
from os import environ
#import logging
#logging.basicConfig(level=0)

environ["OTEL_LOGS_EXPORTER"] = "console"
environ["OTEL_TRACES_EXPORTER"] = "console"
environ["OTEL_METRICS_EXPORTER"] = "console"

initialize()

uv run repro.py

@emdneto emdneto requested a review from a team as a code owner April 18, 2025 12:46
@emdneto emdneto changed the title Update instrumentor.py autoinstrumentation: don't print conflict log message as error Apr 18, 2025
@emdneto emdneto changed the title autoinstrumentation: don't print conflict log message as error autoinstrumentation: don't print duplicated conflict log error message Apr 18, 2025
Copy link
Contributor

@rjduffner rjduffner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making this change and further reducing the log spam.

Copy link
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@xrmx xrmx enabled auto-merge (squash) April 18, 2025 16:53
@xrmx xrmx merged commit d6f6c60 into main Apr 18, 2025
1437 checks passed
@xrmx xrmx deleted the emdneto-patch-1 branch April 18, 2025 16:53
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

Successfully merging this pull request may close these issues.

3 participants