当前位置:网站首页>Practical sharing of distributed link tracking Jaeger + microservice Pig on Rainbond
Practical sharing of distributed link tracking Jaeger + microservice Pig on Rainbond
2022-08-04 12:14:00 【InfoQ】
随着微服务架构的流行,A request initiated by a client may involve multiple ORs N 个服务,This makes our monitoring and troubleshooting between services more complicated.
举个例子:
An interface of a line of business calls the server faster or slower,At this time, it is necessary to check the logs of each service for analysis,Mobilize the developers of each service to conduct a joint investigation,This investigation is time-consuming and labor-intensive.对于 ToB The business sometimes still can't get the log,难搞哦!
因此,It needs to be able to help understand the behavior of the system、用于分析性能问题的工具,以便发生故障的时候,能够快速定位和解决问题,那就是 APM (Application Performance Monitor).目前流行的 APM 开源工具有很多,比如:Zipkin,Skywalking,Pinpoint、Jaeger 等等,本文将主要介绍 Jaeger .
Jaeger 是 Uber An open source distributed tracing system released by the technical team,It is used for monitoring and troubleshooting microservice-based distributed systems:
- 分布式上下文传播、事务监控
- 根本原因、服务依赖分析
- 性能/延迟优化
- OpenTracing Inspired data model
- Multiple storage backends:Cassandra, Elasticsearch, memory.
- 系统拓扑图
- 服务性能监控(SPM)
- 自适应采样
Jaeger 架构

如何在Rainbond上集成?

1.集成 OpenTelemetry Client:
v1.36 版本以前 Jaeger Client 是基于
OpenTracingAPI
Implemented client library,Jaeger Client 结合 Jaeger Agent 一起使用,发送 span 到 Jaeger Collector.
v1.36 版本以后被弃用.使用
OpenTelemetry
替代 Jaeger Client and Jaeger Agent,详情见
Jaeger and OpenTelemetry
.
OpenTelemetry
是无侵入的,只需在 Java Added when the process starts
javaagent
,例:
java-javaagent:path/to/opentelemetry-javaagent.jar-jar myapp.jar
.
那么在 Rainbond On the plug-in will be available
OpenTelemetryjavaagent
Download into the component and modify the startup command.
2.连接到 Jaeger-Collector:
All installed
OpenTelemetryjavaagent
The plugin's microservice components are all connected to via dependencies
JaegerCollector
.
实践步骤
will be used in practice Spring Cloud Pig 进行演示,Gitee:https://gitee.com/zhangbigqi/pig
Rainbond See the documentation for deployment
快速安装
.
1. Spring Cloud Pig 源码部署
通过源码部署
SpringCloudPig
The microservice framework does not cover deployment in detail,请参阅:
- Spring Cloud Pig 部署教程
- Spring Cloud Pig 视频教程
2. OpenTelemetry 插件安装
从应用商店安装
opentelemetry-java-agent
初始化插件,What this plugin does is download
opentelemetry-javaagent.jar
into the microservice component,可以在 Java specified in the startup item.
- 团队视图 -> 插件 -> 从应用商店安装插件 -> 搜索
opentelemetry-java-agent
并安装.

3. 部署 Jaeger
在开源应用商店中搜索
Jaeger
and install it into the specified application.

4. OpenTelemetry Agent 插件配置
1.开通 OpenTelemetry Agent 插件
以
pig-gateway
为例,在组件 -> open in plugin
opentelemetry-java-agent
Plugins and update components take effect,All other components in the microservice need to activate plug-ins and update or restart the components to take effect.

2.配置环境变量
Configure environment variables for all microservice components.
可使用
应用配置组
Unified configuration and applied to all components.

3.Configure the component service name
Configure environment variables for all microservice components
OTEL_SERVICE_NAME
,配置组件的 Jaeger 服务名称,如:
OTEL_SERVICE_NAME=pig-gateway
OTEL_SERVICE_NAME=pig-auth
5.建立依赖关系
Add dependencies to all microservice components
JaegerCollector
.
因
Jaeger
Deployed in another application,需要进入 组件 -> 依赖 -> 添加
JaegerCollector
依赖,It can be seen in the topology diagram of the current application
JaegerCollector
组件,The rest of the components can be dependently connected through the topology map editing mode.Update or restart all microservice components for dependencies to take effect.

6. Jaeger 快速使用
- 访问 Spring Cloud Pig UI 进行登录,make it generate data.
- 访问
Jaeger-Query
的16686
端口,Open external services to accessJaegerUI
.
- 在 Jaeger Search Search for microservices on the page Pig-gateway 的 Traces
- Service:Select the components of the microservice
- Operation:选择操作类型,例:GET POST、接口、类.....
- Tags:Filter by response headers,例:http.status_code=200 error=true
- Lookback:选择时间
- Max Duration:最大持续时间;Min Duration:Minimum duration.
- Limit Results:限制返回结果数量.

- 找到 Pig-gateway HTTP POST 的 Traces 并包含了 pig-auth Span并进入,It can be seen that the layer-by-layer calls between services and the response time of the interface are clearly displayed,In this way, we can check which service call is slow or has a problem with the call.

Jaeger 拓扑图生成
Topology maps are not generated by default,使用
spark-dependencies
Components generate topology map data,这是一个 Spark 作业,It is collected from storage span,分析服务之间的链接,and store them for later UI 中展示.请参阅
Jaeger Spark dependencies
.
spark-dependencies
Components take up a lot of resources,Can be turned off when not in use,You can start it when you need to generate topology map data.

最后
有了 APM 系统后,Allows us to better analyze business performance、排查故障等.
结合 Rainbond As a base no matter what
SpringCloud
还是
Jaeger
或其他
APM
can be very convenient、Quick and easy deployment,from tedious deployment、配置中解放出来,Let's focus more on the business layer.
边栏推荐
- HyperLynx仿真(一)LineSim简单介绍
- cat /proc/kallsyms found that the kernel symbol table values are all 0
- Leetcode brush questions - binary search tree related topics (98. Verify binary search tree, 235. The nearest common ancestor of binary search tree, 1038. From binary search tree to bigger sum tree, 5
- The use of DDR3 (Naive) in Xilinx VIVADO (3) simulation test
- The use of DDR3 (Naive) in Xilinx VIVADO (2) Read and write design
- 244 page PDF!"2022 China cloud computing ecological blue book published
- Zikko launches new Thunderbolt 4 docking station with both HDMI2.1 and 2.5GbE
- 项目管理前景
- Hands-on Deep Learning_LeNet
- IBM Q复制启动停止查看状态
猜你喜欢
随机推荐
Implementation principle of function emplace_back in vector
小程序在政务服务平台建设中如何发挥价值
LeetCode每日一题(858. Mirror Reflection)
Disc burning steps
【目标检测】YOLOv4特征提取网络——CSPDarkNet53结构解析及PyTorch实现
正则表达式
博云入选 Gartner 中国 DevOps 代表厂商
节流函数(每隔一段时间就会执行一次)
电源输出的Overshoot和Undershoot 测试
你值得拥有的登录注册页面(附赠源码)
蒲丰投针学习笔记
不会还有人不知道防抖吧?
【全网首发】Redis系列5:深入分析Cluster 集群模式
C#控制台退出前操作
记我的第一篇CCF-A会议论文|在经历六次被拒之后,我的论文终于中啦,耶!
The use of DDR3 (Naive) in Xilinx VIVADO (3) simulation test
如何让 WPF 程序更好地适配 UI 自动化
隐私计算与数据流通:关系、作用及功能
论文翻译:2022_Time-Frequency Attention for Monaural Speech Enhancement
云原生Devops 的实现方法