天天看点

filecoin lotus 链路追踪jaeger

概述

lotus已在其许多内部组件中内置了跟踪功能,Lotus使用OpenCensus跟踪应用程序。它默认已设置使用Jaeger,当然也可以替换成其他符合规范的产品。

运行jaeger all-in-one

docker run -d --name jaeger \
  -p 6831:6831/udp \
  -p 16686:16686 \
  jaegertracing/all-in-one:1.17
           

设置环境变量,并启动lotus

lotus启动的时候SetupJaegerTracing会查找LOTUS_JAEGER环境变量

LOTUS_JAEGER=localhost:6831 lotus daemon
           

打开浏览器

http://localhost:16686/ 
           
filecoin lotus 链路追踪jaeger
filecoin lotus 链路追踪jaeger

如何添加span

ctx, span := trace.StartSpan(ctx, "put function name here")
defer span.End()