Skip to content

Latest commit

 

History

History
111 lines (96 loc) · 2.87 KB

链路跟踪.md

File metadata and controls

111 lines (96 loc) · 2.87 KB

Introduction

Jaeger is used for monitoring and troubleshooting microservices-based distributed systems, including:

  • Distributed context propagation
  • Distributed transaction monitoring
  • Root cause analysis
  • Service dependency analysis
  • Performance / latency optimization

Terminology

Let’s start with a quick refresher on the terminology defined by the OpenTracing Specification.

Span

A span represents a logical unit of work in Jaeger that has an operation name, the start time of the operation, and the duration. Spans may be nested and ordered to model causal relationships.

image

Trace

A trace is a data/execution path through the system, and can be thought of as a directed acyclic graph of spans.

Components

image Illustration of direct-to-storage architecture

image Illustration of architecture with Kafka as intermediate buffer

Install jaeger

sudo mkdir /etc/jaeger.d/ /data/jaeger -p
sudo touch /etc/jaeger.d/docker-compose.yaml
sudo chmod -R 777 /data/jaeger /etc/jaeger.d
sudo cat > /etc/jaeger.d/docker-compose.yaml <<EOF
version: "3.5"
services:
  jaeger-collector:
    container_name: jaeger-collector
    image: jaegertracing/jaeger-collector
    environment:
      - SPAN_STORAGE_TYPE=elasticsearch
      - ES_SERVER_URLS=http://192.168.202.128:9200
    ports:
      - 9411:9411
      - 14250:14250
      - 14268:14268
      - 14269:14269
    networks:
      - jaeger
    restart: always
  jaeger-agent:
    container_name: jaeger-agent
    image: jaegertracing/jaeger-agent
    environment:
      - REPORTER_GRPC_HOST_PORT=jaeger-collector:14250
      - LOG_LEVEL=debug
    ports:
      - 5778:5778
      - 6831:6831/udp
      - 6832:6832/udp
      - 5778:5778/udp
      - 5775:5775
    networks:
      - jaeger
    restart: always
    depends_on:
      - jaeger-collector
  jaeger-query:
    container_name: jaeger-query
    image: jaegertracing/jaeger-query
    environment:
      - SPAN_STORAGE_TYPE=elasticsearch
      - ES_SERVER_URLS=http://192.168.202.128:9200
    ports:
      - 16686:16686
      - 16687:16687
    networks:
      - jaeger
    restart: always
  jaeger-hotrod:
    container_name: jaeger-hotrod
    image: jaegertracing/example-hotrod:1.6
    command: all --jaeger-agent.host-port=jaeger-agent:6831
    ports:
      - 16680:8080
    networks:
      - jaeger
    restart: always
    depends_on:
      - jaeger-agent
  jaeger-dependencies:
    container_name: jaeger-dependencies
    image: jaegertracing/spark-dependencies
    environment:
      - STORAGE=elasticsearch
      - ES_NODES=http://192.168.202.128:9200
    networks:
      - jaeger
    restart: always
networks:
  jaeger:
    driver: bridge
EOF
sudo docker-compose -f /etc/jaeger.d/docker-compose.yaml up -d