レディス¶
logfire.instrument_redis() メソッドは、Red isクライアントが実行するコマンドごとにスパンを作成します。
インストール¶
redis extraを使用して logfire をインストールします:
{{ install_logfire(extras=['redis']) }}
使い方¶
次の最小の例を見てみましょう:
main.py
import logfire
import redis
logfire.configure()
logfire.instrument_redis()
# This will report a span with the default settings
client = redis.StrictRedis(host="localhost", port=6379)
client.get("my-key")
# This will report a span with the default settings
async def main():
client = redis.asyncio.Redis(host="localhost", port=6379)
await client.get("my-key")
if __name__ == "__main__":
import asyncio
asyncio.run(main())
logfire.instrument_redis() キーワードパラメータは、OpenTelemometry Red is Instrumentationパッケージに渡されます RedisInstrumentor().instrument() 方法では、ここにしてください関連情報をもっと読む。
本文总阅读量次