logfire icon indicating copy to clipboard operation
logfire copied to clipboard

Add support for aiohttp server

Open andreaturli opened this issue 1 year ago • 5 comments

Description

AIOHttp is not available in the https://logfire.pydantic.dev/docs/integrations/web-frameworks/

Would it be possible to add logfire instrumentation support for it?

andreaturli avatar Apr 11 '25 13:04 andreaturli

https://logfire.pydantic.dev/docs/integrations/http-clients/aiohttp/ needs to be updated because it links to https://github.com/open-telemetry/opentelemetry-python-contrib/issues/501 to track progress and that's closed.

You should be able to use https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/aiohttp_server/aiohttp_server.html, i.e. AioHttpServerInstrumentor().instrument() combined with logfire.configure should just work.

alexmojaki avatar Apr 11 '25 13:04 alexmojaki

i will give it a try, thanks!

andreaturli avatar Apr 11 '25 13:04 andreaturli

Reopening because ideally we should add logfire.instrument_aiohttp_server eventually, but in any case we should at least update the docs.

alexmojaki avatar Apr 11 '25 13:04 alexmojaki

logfire.instrument_aiohttp_server would be great!

andreaturli avatar Apr 11 '25 14:04 andreaturli

TBC it would be a thin wrapper around the OTel library, like most of these methods.

alexmojaki avatar Apr 11 '25 14:04 alexmojaki

I've raised a PR for it but need a couple of pointers to close it out. Please check :)

adtyavrdhn avatar Jun 10 '25 16:06 adtyavrdhn