介绍
Jaeger是Uber开发的一套分布式追踪系统,已在Uber大规模使用
组建介绍:
- 应用:通过opentracing 提供的sdk或直接使用jaeger-client 进行埋点(在具体业务点增加span记录信息)(sdk其实挺全的,各种框架的sdk等都提供了,比如flask,sqlalchemy,nginx都提供了框架层的支持。只有在需要监控详细业务逻辑的时候才需要自己手动埋点)
- jaeger-client: 负责把应用的tracing 数据发送给jaeger-agent
- jaeger-agent: 收集jaeger-client数据
- jaeger-collector:
- jaeger-query:
- jaeger-ui:
部署:
- 应用:参考 上面opentracing的sdk进行配置,例如flask demo: https://github.com/opentracing-contrib/python-flask/tree/master/example, https://scoutapp.com/blog/tutorial-tracing-python-flask-requests-with-opentracing
-
采集和ui :
#数据没有持久化,仅用于测试
docker run -d -e COLLECTOR_ZIPKIN_HTTP_PORT=9411 -p 5775:5775/udp -p 6831:6831/udp -p 6832:6832/udp -p 5778:5778 -p 16686:16686 -p 14268:14268 -p 9411:9411 jaegertracing/all-in-one:latest
COLLECTOR_ZIPKIN_HTTP_PORT=9411要根据自己的端口号而定,若自己的端口号为8000,COLLECTOR_ZIPKIN_HTTP_PORT=8000
在设置环境变量时,
JAEGER_HOST = getenv('JAEGER_HOST', 'localhost')要适配自己程序运行的地址。
相关文档
- 官方文档 https://github.com/opentracing/specification
- OpenTracing语义规范(中文版) https://segmentfault.com/a/1190000008895129
- OpenTracing语义惯例 https://opentracing-contrib.github.io/opentracing-specification-zh/semantic_conventions.html
- opentracing文档中文版 ( 翻译 ) 吴晟 https://wu-sheng.gitbooks.io/opentracing-io/content/
- https://yq.aliyun.com/articles/514488
-
配置步骤 https://github.com/aliyun/jaeger/blob/master/README_CN.md
- https://github.com/jukylin/blog/blob/master/Uber%E5%88%86%E5%B8%83%E5%BC%8F%E8%BF%BD%E8%B8%AA%E7%B3%BB%E7%BB%9FJaeger%E4%BD%BF%E7%94%A8%E4%BB%8B%E7%BB%8D%E5%92%8C%E6%A1%88%E4%BE%8B%E3%80%90PHP%20%20%20Hprose%20%20%20Go%E3%80%91.md