DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

How are you handling the data revolution? We want your take on what's real, what's hype, and what's next in the world of data engineering.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

SBOMs are essential to circumventing software supply chain attacks, and they provide visibility into various software components.

Related

  • Building an SQL to DataFrame Converter With ANTLR
  • Master SQL Performance Optimization: Step-by-Step Techniques With Case Studies
  • MySQL Formatter: How to Make Beautiful Code and Why You Need It
  • Useful System Table Queries in Relational Databases

Trending

  • How We Broke the Monolith (and Kept Our Sanity): Lessons From Moving to Microservices
  • How to Troubleshoot Common Linux VPS Issues: CPU, Memory, Disk Usage
  • Spring Cloud LoadBalancer vs Netflix Ribbon
  • Seata the Deal: No More Distributed Transaction Nightmares Across (Spring Boot) Microservices
  1. DZone
  2. Data Engineering
  3. Databases
  4. Persisting ZipKin SpanStore: MySQL and Cassandra

Persisting ZipKin SpanStore: MySQL and Cassandra

The ZipKin distributed tracing system is great for testing latency issues, but by default, it doesn't persist the traces. Fortunately, you can fix that with Cassandra and MySQL.

By 
Nitin Ware user avatar
Nitin Ware
·
Dec. 28, 16 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
14.3K Views

Join the DZone community and get the full member experience.

Join For Free

ZipKin is a distributed tracing system that collects the traces from sleuth-enabled microservices and helps gather the timing data needed to troubleshoot latency issues in microservices.

The ZipKin provides a UI that displays the "waterfall" style graph of service calls — showing call durations as horizontal bars, the UI helps users visualize latency when requests travel across several microservices.

ZipKin, by default, does not persist traces, which are stored in-memory and thus lost on server startup. But ideally, if we plan to use ZipKin, we would like to persist the traces in some persistent store. So, to do that, ZipKin has given a provision to persist SpanStore in MySQL and Cassandra.

You can check the list of available storage options provided by ZipKin on GitHub. 

Below are some examples for persisting ZipKin SpansStore both in Cassandra 3 and MySQL.

Persisting ZipKin SpanStore to Cassandra 3

For Cassandra 3, add the dependencies below for Cassandra in your pom.xml

<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-storage-cassandra3</artifactId>
<version>1.17.1</version>
<exclusions>
<exclusion>
<artifactId>cassandra-driver-core</artifactId>
<groupId>com.datastax.cassandra</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-mapping</artifactId>
<version>3.1.0</version>
</dependency>


Also in your application.yml/application.properties files, specify the database configuration information of you Cassandra database. Here, you need to specify the ZipKin storage type as "cassandra3".

server:
  port: 9411

spring:
  application:
    name: zipkin-server
  datasource:
    schema: classpath:/cassandra3-schema.cql
    url: jdbc:cassandra://127.0.0.1:9042
    keyspace: zipkin3
    contactPoints: localhost
    initialize: true
    continue-on-error: true
  sleuth:
    enabled: false

zipkin:
  storage:
      type: cassandra3


And that's it. That is the minimum configuration needed in to persist ZipKin SpanStore to Cassandra 3.

Persisting ZipKin SpanStore to MySQL 

For MySQL, add the dependencies below for MySQL in your pom.xml

<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-storage-mysql</artifactId>
<version>1.17.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>


Now in your application.yml/application.properties files, specify the database configuration information of your MySQL database. Here, you need to specify the ZipKin storage type as "mysql".

server:
  port: 9411

spring:
  application:
    name: zipkin-server
  datasource:
    schema: classpath:/mysql.sql
    url: jdbc:mysql://localhost:3306/zipkin?autoReconnect=true&useSSL=false
    username: root
    driver-class-name: com.mysql.jdbc.Driver
    initialize: true
    continue-on-error: true
  sleuth:
    enabled: false

zipkin:
  storage:
      type: mysql


I have posted the code example for both MySQL and Cassandra 3 on GitHub.

MySQL

Opinions expressed by DZone contributors are their own.

Related

  • Building an SQL to DataFrame Converter With ANTLR
  • Master SQL Performance Optimization: Step-by-Step Techniques With Case Studies
  • MySQL Formatter: How to Make Beautiful Code and Why You Need It
  • Useful System Table Queries in Relational Databases

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends: