Aller au contenu

par HTTPX

La méthode logfire.instrument_httpx() peut être utilisée pour détecter HTTPX avecLogfire.

Installation de

Installez logfire avec httpx extra:

{{ install_logfire(extras=['httpx']) }}

Utilisation de

Regardons un exemple minimal ci-dessous. vous pouvez l'exécuter en utilisant 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() Utilisation de OpenTelemetry HTTPX Instrumentation Le sac, vous pouvez Ici, là où Trouvez plus d'informations sur le pack.


本文总阅读量次