-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add ASGI & WSGI instrument methods #324
Conversation
Deploying logfire-docs with Cloudflare Pages
|
Pretty much. What would you prefer? Just a different name? |
I don't like that every |
I agree with that. The difference is more obvious in OTEL because it's not e.g. If it was |
I think I'll prefer more if it was a class itself e.g. |
But an ASGI application is just a callable, often a function. |
It's a callable, but I don't think it's usually a function. In any case, I think it's irrelevant if an app itself is usually a function or a class, but ASGI middlewsres in the ecosystem are usually presented as classes. |
Currently you can do this: import logfire
logfire_instance = logfire.with_tags('foo')
logfire.instrument_bar()
# or
logfire_instance.instrument_bar() Right now that's not very useful, but we may add other I want the |
Ah, I see. Then I think we can just have it as functions. |
Do you mean methods of the |
Yes. |
@Kludex, ping me when this is ready for review, I'd love to take a look. |
I'll work on this today. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #324 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 132 133 +1
Lines 10175 10206 +31
Branches 1395 1395
=========================================
+ Hits 10175 10206 +31 ☔ View full report in Codecov by Sentry. |
Co-authored-by: Alex Hall <[email protected]>
You can read more about the OpenTelemetry ASGI middleware [here][opentelemetry-asgi]. | ||
The keyword arguments of [`logfire.instrument_asgi()`][logfire.Logfire.instrument_asgi] are passed to the | ||
[`OpenTelemetryMiddleware`][opentelemetry.instrumentation.asgi.OpenTelemetryMiddleware] class | ||
of the OpenTelemetry ASGI Instrumentation package. | ||
|
||
## Excluding URLs from instrumentation | ||
<!-- note that this section is duplicated for different frameworks but with slightly different links --> |
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.
The note here should refer to instrument_asgi, not OpenTelemetryMiddleware.
In fact we should probably just implement the env var ourselves.
Co-authored-by: Alex Hall <[email protected]>
@alexmojaki something else here? |
Thanks!!! 🙏 |
Is this what you had in mind? @alexmojaki
I don't like it.