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

logfire.instrument_psycopg() function #30

Merged
merged 19 commits into from
Apr 29, 2024
Merged

logfire.instrument_psycopg() function #30

merged 19 commits into from
Apr 29, 2024

Conversation

alexmojaki
Copy link
Contributor

@alexmojaki alexmojaki commented Apr 28, 2024

Copy link

cloudflare-workers-and-pages bot commented Apr 28, 2024

Deploying logfire-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 01d5e1f
Status: ✅  Deploy successful!
Preview URL: https://2089aa65.logfire-docs.pages.dev
Branch Preview URL: https://alex-psycopg.logfire-docs.pages.dev

View logs

Copy link

codecov bot commented Apr 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@alexmojaki alexmojaki changed the title WIP instrument_psycopg logfire.instrument_psycopg() function Apr 29, 2024
@alexmojaki alexmojaki marked this pull request as ready for review April 29, 2024 12:43
Copy link

linear bot commented Apr 29, 2024

PYD-874 Extra `instrument_` methods

We've talked in the new website about:

  • logfire.instrument_pydantic - this should basically take the same arguments as logfire.configure(pydantic_plugin=…, we should use logfire.instrument_pydantic in docs, but don't need to formally deprecate the .configure parameter
  • Logfire.instrument_psycopg(pg_conn) - I guess this should accept as wide a range of psycopg connection types as possible - 2 and 3, sync and async, connection and pool

This has to be done this week since the website will contain it from the first day.

Comment on lines +842 to +851
Args:
conn_or_module: Can be:

- The `psycopg` (version 3) or `psycopg2` module.
- The string `'psycopg'` or `'psycopg2'` to instrument the module.
- `None` (the default) to instrument whichever module(s) are installed.
- A `psycopg` or `psycopg2` connection.

**kwargs: Additional keyword arguments to pass to the OpenTelemetry `instrument` methods,
particularly `enable_commenter` and `commenter_options`.
Copy link
Member

Choose a reason for hiding this comment

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

Does this renders nicely on the API docs?

from types import ModuleType
from typing import TYPE_CHECKING, Any

from packaging.requirements import Requirement
Copy link
Member

Choose a reason for hiding this comment

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

Do we have this as dependency?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, added.

@alexmojaki alexmojaki enabled auto-merge (squash) April 29, 2024 14:35
@alexmojaki alexmojaki merged commit 47e6bb2 into main Apr 29, 2024
11 checks passed
@alexmojaki alexmojaki deleted the alex/psycopg branch April 29, 2024 14:37
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.

2 participants