Open alexmojaki opened 1 month ago
Remaining methods to add:
logfire.instrument_flask()
logfire.instrument_starlette()
logfire.instrument_aiohttp()
logfire.instrument_sqlalchemy()
logfire.instrument_pymongo()
logfire.instrument_redis()
logfire.instrument_celery()
logfire.instrument_asgi_middleware()
logfire.instrument_wsgi_middleware()
logfire.instrument_logging_handler()
logfire.instrument_loguru_handler()
logfire.instrument_structlog_processor()
I'm not sure about the names of the last 5. It is important that they're methods of logfire objects rather than classes imported from logfire. It would be nice for everything to start with instrument_
but instrument_logging_handler
sounds like it's instrumenting a logging handler, rather than returning a handler that 'instruments logging'.
@Kludex I'm going to start working on the first 6, please do the other half.
@Kludex I think we should have logfire.instrument_loguru()
which calls logger.add(**logfire.loguru_handler())
. That makes the naming less weird and should be easier for users, avoiding problems like https://github.com/pydantic/logfire/issues/228. logfire.loguru_handler()
can be kept for compatibility but not recommended.
e.g.
logfire.instrument_sqlalchemy()
instead offrom opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor; SQLAlchemyInstrumentor().instrument()
. Same for all integrations documented in https://docs.pydantic.dev/logfire/integrations/#opentelemetry-integrations.