Skip to content
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

Psycopg2 automatic instrumentation only partially works #166

Closed
bllchmbrs opened this issue May 13, 2024 · 3 comments
Closed

Psycopg2 automatic instrumentation only partially works #166

bllchmbrs opened this issue May 13, 2024 · 3 comments
Labels
bug Bug related to the Logfire Python SDK OTel Issue

Comments

@bllchmbrs
Copy link
Contributor

Description

I found these docs.

When I instrument my connection like this: logfire.instrument_psycopg(connection) I get an error: `AttributeError: 'psycopg2.extensions.connection' object has no attribute '_is_instrumented_by_opentelemetry'

However, if I run logfire.instrument_psycopg() it works fine.

I found this strange because the docs suggested I could instrument a specific connection like this:

connection = psycopg.connect(
    'dbname=database user=user password=secret host=0.0.0.0 port=5432'
)

# Or instrument just the connection:
logfire.instrument_psycopg(connection)

This is either a bug or user error, I am not sure how it could be user error though because the connection has worked fine for many months.

Python, Logfire & OS Versions, related packages (not required)

No response

@bllchmbrs bllchmbrs added the bug Bug related to the Logfire Python SDK label May 13, 2024
@alexmojaki alexmojaki self-assigned this May 13, 2024
@alexmojaki
Copy link
Contributor

Thanks for the report. I had tested psycopg2, and pyscopg v3 connections, but not psycopg2 connections 🤦

I've reported the underlying issue here: open-telemetry/opentelemetry-python-contrib#2522

I'm surprised no one else has reported it before!

@alexmojaki alexmojaki removed their assignment May 13, 2024
@bllchmbrs
Copy link
Contributor Author

Me too, now that you mention what it is!

Guess it's not a blocker because I can work around, but interesting to see I'm the one that hit it!

@Kludex
Copy link
Member

Kludex commented Jul 18, 2024

Since this issue is on OTel side, I'll be closing this one. 🙏

For people interested, you can watch this: open-telemetry/opentelemetry-python-contrib#2522

@Kludex Kludex closed this as completed Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug related to the Logfire Python SDK OTel Issue
Projects
None yet
Development

No branches or pull requests

3 participants