24 Şubat 2022 Perşembe

SpringCloud Zipkin

Zipkin Nedir?
Açıklaması şöyle
Zipkin is a distributed instrumentation and monitoring tool that will allow us to collect service information and perform searches on it. With the aim of finding problems in the latency of them, mainly through evaluating how long it has taken the execution of those services.
application.properties
Açıklaması şöyle
By default, our services will try to send trace messages to localhost:9411. If OpenZipkin runs at a different address, you need to specify it in the settings of each service:
Örnek
Şöyle yaparız
spring: zipkin: base-url: http://<host>:<port>
Örnek
Zipkin'a RabbitMQ ile mesaj göndermek için şöyle yaparız
spring.zipkin.sender.type=rabbit
spring.zipkin.rabbitmq.queue=zipkin
....
Docker Zipkin Sunucusu
Zipkin sunucusu 9411 numaralı portu kullanır. GUI'ye erişmek için şöyle yaparız
http://localhost:9411/
Örnek
Şöyle yaparız
docker run -d -p 9411:9411 openzipkin/zipkin
Docker Compose
"docker-compose up" ile başlatırız
Örnek
Şöyle yaparız
version: "3.1" services: zipkin: image: openzipkin/zipkin:2 ports: - "9411:9411"
Örnek 
Şöyle yaparız
version: "3.9"

services:
  microservices_postgresql:
    image: postgres:latest
    container_name: microservices_postgresql
    expose:
      - "5432"
    ports:
      - "5432:5432"
    restart: always
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=bank_accounts
      - POSTGRES_HOST=5432
    command: -p 5432
    volumes:
      - ./docker_data/microservices_pgdata:/var/lib/postgresql/data
    networks: [ "microservices" ]

  redis:
    image: redis:latest
    container_name: microservices_redis
    ports:
      - "6379:6379"
    restart: always
    networks: [ "microservices" ]

  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    ports:
      - "9090:9090"
    command:
      - --config.file=/etc/prometheus/prometheus.yml
    volumes:
      - ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
    networks: [ "microservices" ]

  node_exporter:
    container_name: microservices_node_exporter
    restart: always
    image: prom/node-exporter
    ports:
      - '9101:9100'
    networks: [ "microservices" ]

  grafana:
    container_name: microservices_grafana
    restart: always
    image: grafana/grafana
    ports:
      - '3000:3000'
    networks: [ "microservices" ]

  zipkin:
    image: openzipkin/zipkin:latest
    restart: always
    container_name: microservices_zipkin
    ports:
      - "9411:9411"
    networks: [ "microservices" ]


networks:
  microservices:
    name: microservices
Şeklen şöyle

Her hangi bir isteği genişletirsek şöyle






Hiç yorum yok:

Yorum Gönder