Zipkin Tracing
Distributed tracing system for latency analysis in microservices.
Overview
Zipkin is an open-source distributed tracing system originally developed by Twitter to help troubleshoot latency problems in microservice architectures. It collects timing data needed to troubleshoot latency issues, allowing developers to visualize request flows across multiple services and identify performance bottlenecks. Zipkin follows the OpenTracing standard and provides detailed insights into how requests propagate through distributed systems, making it essential for maintaining observable microservices. This configuration combines Zipkin with Elasticsearch as the storage backend, creating a powerful tracing platform that can handle high-volume trace data with advanced search and analytics capabilities. Elasticsearch provides Zipkin with scalable storage, fast querying, and the ability to perform complex aggregations on trace data, while the zipkin-dependencies service automatically generates service dependency graphs from collected traces. Development teams building microservices, DevOps engineers managing distributed systems, and organizations transitioning from monolithic to service-oriented architectures will find this stack invaluable for understanding system behavior and optimizing performance across service boundaries.
Key Features
- B3 propagation support for seamless trace context propagation across HTTP requests
- Real-time service dependency graph generation with automatic topology discovery
- Latency percentile analysis with P50, P95, and P99 calculations for performance monitoring
- Elasticsearch-powered full-text search across trace annotations and tags
- Automatic trace retention and cleanup through Elasticsearch index lifecycle management
- Support for multiple span types including client, server, producer, and consumer spans
- Built-in sampling strategies to control trace collection overhead in high-traffic environments
- RESTful API for programmatic trace submission and querying
Common Use Cases
- 1Debugging performance bottlenecks in microservice architectures during development
- 2Root cause analysis for intermittent latency spikes in production environments
- 3Service dependency mapping for legacy system modernization projects
- 4Performance regression testing in CI/CD pipelines with trace comparison
- 5Capacity planning by analyzing request patterns and service utilization
- 6SLA monitoring and alerting based on service-level latency metrics
- 7API gateway performance optimization through upstream service analysis
Prerequisites
- Minimum 2GB RAM for Elasticsearch storage backend (4GB recommended for production)
- Port 9411 available for Zipkin web UI and API access
- Basic understanding of distributed tracing concepts and span terminology
- Application instrumentation with Zipkin-compatible tracing libraries
- Docker Engine 19.03+ with Docker Compose v2 support
- At least 10GB free disk space for trace data storage and Elasticsearch indices
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 zipkin: 3 image: openzipkin/zipkin:latest4 container_name: zipkin5 environment: 6 - STORAGE_TYPE=elasticsearch7 - ES_HOSTS=elasticsearch:92008 ports: 9 - "9411:9411"10 depends_on: 11 - elasticsearch12 networks: 13 - zipkin-network14 restart: unless-stopped1516 elasticsearch: 17 image: docker.elastic.co/elasticsearch/elasticsearch:8.11.018 container_name: zipkin-elasticsearch19 environment: 20 - discovery.type=single-node21 - xpack.security.enabled=false22 - "ES_JAVA_OPTS=-Xms512m -Xmx512m"23 volumes: 24 - elasticsearch-data:/usr/share/elasticsearch/data25 networks: 26 - zipkin-network27 restart: unless-stopped2829 zipkin-dependencies: 30 image: openzipkin/zipkin-dependencies:latest31 container_name: zipkin-dependencies32 environment: 33 - STORAGE_TYPE=elasticsearch34 - ES_HOSTS=elasticsearch:920035 depends_on: 36 - elasticsearch37 networks: 38 - zipkin-network39 entrypoint: crond -f4041volumes: 42 elasticsearch-data: 4344networks: 45 zipkin-network: 46 driver: bridge.env Template
.env
1# Zipkin2# Send traces to http://localhost:9411/api/v2/spansUsage Notes
- 1Zipkin UI at http://localhost:9411
- 2Send traces via HTTP POST
- 3Service dependency graph
- 4Latency percentile analysis
- 5Supports B3 propagation
Individual Services(3 services)
Copy individual services to mix and match with your existing compose files.
zipkin
zipkin:
image: openzipkin/zipkin:latest
container_name: zipkin
environment:
- STORAGE_TYPE=elasticsearch
- ES_HOSTS=elasticsearch:9200
ports:
- "9411:9411"
depends_on:
- elasticsearch
networks:
- zipkin-network
restart: unless-stopped
elasticsearch
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.11.0
container_name: zipkin-elasticsearch
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- ES_JAVA_OPTS=-Xms512m -Xmx512m
volumes:
- elasticsearch-data:/usr/share/elasticsearch/data
networks:
- zipkin-network
restart: unless-stopped
zipkin-dependencies
zipkin-dependencies:
image: openzipkin/zipkin-dependencies:latest
container_name: zipkin-dependencies
environment:
- STORAGE_TYPE=elasticsearch
- ES_HOSTS=elasticsearch:9200
depends_on:
- elasticsearch
networks:
- zipkin-network
entrypoint: crond -f
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 zipkin:5 image: openzipkin/zipkin:latest6 container_name: zipkin7 environment:8 - STORAGE_TYPE=elasticsearch9 - ES_HOSTS=elasticsearch:920010 ports:11 - "9411:9411"12 depends_on:13 - elasticsearch14 networks:15 - zipkin-network16 restart: unless-stopped1718 elasticsearch:19 image: docker.elastic.co/elasticsearch/elasticsearch:8.11.020 container_name: zipkin-elasticsearch21 environment:22 - discovery.type=single-node23 - xpack.security.enabled=false24 - "ES_JAVA_OPTS=-Xms512m -Xmx512m"25 volumes:26 - elasticsearch-data:/usr/share/elasticsearch/data27 networks:28 - zipkin-network29 restart: unless-stopped3031 zipkin-dependencies:32 image: openzipkin/zipkin-dependencies:latest33 container_name: zipkin-dependencies34 environment:35 - STORAGE_TYPE=elasticsearch36 - ES_HOSTS=elasticsearch:920037 depends_on:38 - elasticsearch39 networks:40 - zipkin-network41 entrypoint: crond -f4243volumes:44 elasticsearch-data:4546networks:47 zipkin-network:48 driver: bridge49EOF5051# 2. Create the .env file52cat > .env << 'EOF'53# Zipkin54# Send traces to http://localhost:9411/api/v2/spans55EOF5657# 3. Start the services58docker compose up -d5960# 4. View logs61docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/zipkin-tracing/run | bashTroubleshooting
- Zipkin UI shows no traces: Verify applications are instrumented and sending traces to http://localhost:9411/api/v2/spans
- Elasticsearch connection refused errors: Wait for Elasticsearch to fully start (30-60 seconds) before Zipkin attempts connection
- Out of memory errors in Elasticsearch: Increase ES_JAVA_OPTS heap size from 512m to 1g or higher based on trace volume
- zipkin-dependencies service not generating dependency graphs: Check that spans have proper service names and that Elasticsearch contains trace data
- High CPU usage on zipkin-dependencies: Adjust cron schedule in entrypoint or limit dependency analysis to specific time ranges
- Traces not appearing in UI after submission: Check Elasticsearch cluster health and verify STORAGE_TYPE environment variable is set correctly
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
zipkinelasticsearch
Tags
#tracing#zipkin#observability#latency#microservices
Category
Monitoring & ObservabilityAd Space
Shortcuts: C CopyF FavoriteD Download