Skip to content

基于Jaeger、OpenTelemetry的链路追踪Demo.深入了解可观测体系Observability下Traces、Metrics原理

License

Notifications You must be signed in to change notification settings

laziobird/opentelemetry-jaeger

Repository files navigation

opentelemetry-jaeger-prometheus

Introduction

原理文档

OpenTelemetry+Jaeger+Prometheus的分布式链路追踪演示案例

  • Load Balance:Nginx
  • Java:SpringBoot
  • Agent:OpenTelemetry + Jaeger Trace Exporter + Prometheus Metric Exporter
  • 可视化:Jaeger UI 、Prometheus UI 深入了解可观测体系下Traces概念和运行原理
    • Alt Text

Architecture

image.png

Tracing 效果图

image.png

Prometheus 采集Metric

prometheus.jpg

框架列表

Library/Framework Versions 备注
opentelemetry-api 1.9.1
opentelemetry-java-instrumentation 1.9.1 Java探针
opentelemetry-sdk 1.9.1
opentelemetry-exporter-jaeger 1.9.1
opentelemetry-semconv 1.9.0-alpha 目前只有alpha版本
jaegertracing all-in-one:1.29 docker镜像
spring-boot 2.6.2 JDK 1.8+
nginx 1.16.1

Compiling project

Maven 编译Java 程序

mvn package -DskipTests=true
  • target下把对应jar包重命名otel.jar,放到Dockerfile文件同级目录

Linux

  • Docker 环境,三个服务部署在一台服务器上,网络Host模式
## down
docker-compose -f /path/docker-compose.yml  down
## start
docker-compose -f /path/docker-compose.yml  up -d

Mac

Mac 用Docker Host 模式很坑,建议网络 bridge模式

networks:
  jaeger:
  
services: 
    jaeger:
        image: jaegertracing/all-in-one:1.29
        networks:
            - jaeger

非容器独立部署模式

java 程序

其中 opentelemetry-javaagent.jar 是探针 otel.jar 是我们编译 jar 包

java -javaagent:/path/opentelemetry-javaagent.jar  \
-Dotel.resource.attributes=service.name=trace-demo \
-Dotel.traces.exporter=jaeger  \
-jar target/otel.jar

Docker单独启 Jaeger

docker run -d --name jaeger \
-p 5775:5775/udp   \
-p 6831:6831/udp  \
-p 6832:6832/udp  \
-p 5778:5778   \
-p 16686:16686   \
-p 14268:14268   -p 14250:14250   -p 9411:9411   \
jaegertracing/all-in-one:1.27

Docker单独启 Prometheus

docker run  -d \
  -p 9090:9090 \
  prom/prometheus

Documentation

https://github.com/open-telemetry/opentelemetry-java-instrumentation
https://www.jaegertracing.io/docs/1.29/getting-started/
https://opentelemetry.io/docs/

联系

如果有什么疑问和建议,欢迎提交issues,我会第一时间回复

About

基于Jaeger、OpenTelemetry的链路追踪Demo.深入了解可观测体系Observability下Traces、Metrics原理

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published