-
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 local
parameter to logfire.configure()
#508
Changes from all commits
89a10a5
99cc318
0faf440
e9ce560
fd7e4fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,18 @@ | |
|
||
from opentelemetry.instrumentation.aiohttp_client import AioHttpClientInstrumentor | ||
|
||
from logfire import Logfire | ||
|
||
def instrument_aiohttp_client(**kwargs: Any): | ||
|
||
def instrument_aiohttp_client(logfire_instance: Logfire, **kwargs: Any): | ||
"""Instrument the `aiohttp` module so that spans are automatically created for each client request. | ||
|
||
See the `Logfire.instrument_aiohttp_client` method for details. | ||
""" | ||
AioHttpClientInstrumentor().instrument(**kwargs) # type: ignore[reportUnknownMemberType] | ||
AioHttpClientInstrumentor().instrument( # type: ignore[reportUnknownMemberType] | ||
**{ | ||
'tracer_provider': logfire_instance.config.get_tracer_provider(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm torn on how to do this. On the one hand I don't want to completely prevent users from passing custom providers. We even do that in our own code (passing a NoopMeterProvider to disable fastapi metrics), and I've recommended another user to do the same. On the other hand I don't want to encourage or document it. So this makes it secretly possible to override the logfire providers with custom ones. Which is a mess for type checking. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean we're using kwargs already so this seems like a step better |
||
'meter_provider': logfire_instance.config.get_meter_provider(), | ||
**kwargs, | ||
}, | ||
) |
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.
I moved these warnings to prevent
logfire.instrument_fastapi
emitting similar warnings 3 times.