-
Notifications
You must be signed in to change notification settings - Fork 188
Support logfire.instrument without arguments
#607
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
Conversation
Deploying logfire-docs with
|
| Latest commit: |
1fd9012
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://20ab6e74.logfire-docs.pages.dev |
| Branch Preview URL: | https://support-instrument-parametre.logfire-docs.pages.dev |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #607 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 133 133
Lines 10541 10549 +8
Branches 1448 1450 +2
=========================================
+ Hits 10541 10549 +8 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
logfire/_internal/main.py
Outdated
| ) -> Callable[[Callable[P, R]], Callable[P, R]]: ... | ||
|
|
||
| @overload | ||
| def instrument(self, msg_template: Callable[P, R]) -> Callable[P, R]: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def instrument(self, msg_template: Callable[P, R]) -> Callable[P, R]: ... | |
| def instrument(self, func: Callable[P, R]) -> Callable[P, R]: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not possible. The parameter names must match.
|
|
||
| def instrument( | ||
| self, | ||
| msg_template: Callable[P, R] | LiteralString | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| msg_template: Callable[P, R] | LiteralString | None = None, | |
| msg_template_or_func: Callable[P, R] | LiteralString | None = None, |
|
I didn't do what the suggestions suggest because it's a breaking change... People could be doing Or do you want to add the |
|
OK leave the main signature as is but use the name |
|
What if you just ignore that specific error code? |
I'm not sure if this is working as expected, but done. |
Co-authored-by: Marcelo Trylesinski <[email protected]>

@logfire.instrumentshould work in bear mode #537