HTTPX¶
logfire.instrument_httpx() method can be used to detect HTTPX usingLogfire
install¶
Install logfire using httpx extra:
{{ install_logfire(extras=['httpx']) }}
usage¶
Let's look at a minimal example below. You can run it using python main.py:
main.py
import logfire
import httpx
logfire.configure()
logfire.instrument_httpx()
url = "https://httpbin.org/get"
with httpx.Client() as client:
client.get(url)
async def main():
async with httpx.AsyncClient() as client:
await client.get(url)
if __name__ == "__main__":
import asyncio
asyncio.run(main())
logfire.instrument_httpx() use OpenTelemetry HTTPX Instrumentation Bag, you can here Find more information about the package.
本文总阅读量次