Storage: Kafka

Zipkin Storage: Kafka (Parent)

License

License

Categories

Categories

Zipkin Application Testing & Monitoring Application Performance Monitoring (APM)
GroupId

GroupId

io.github.jeqo.zipkin
ArtifactId

ArtifactId

zipkin-storage-kafka
Last Version

Last Version

0.5.4
Release Date

Release Date

Type

Type

jar
Description

Description

Storage: Kafka
Zipkin Storage: Kafka (Parent)

Download zipkin-storage-kafka

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.jeqo.zipkin/zipkin-storage-kafka/ -->
<dependency>
    <groupId>io.github.jeqo.zipkin</groupId>
    <artifactId>zipkin-storage-kafka</artifactId>
    <version>0.5.4</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.jeqo.zipkin/zipkin-storage-kafka/
implementation 'io.github.jeqo.zipkin:zipkin-storage-kafka:0.5.4'
// https://jarcasting.com/artifacts/io.github.jeqo.zipkin/zipkin-storage-kafka/
implementation ("io.github.jeqo.zipkin:zipkin-storage-kafka:0.5.4")
'io.github.jeqo.zipkin:zipkin-storage-kafka:jar:0.5.4'
<dependency org="io.github.jeqo.zipkin" name="zipkin-storage-kafka" rev="0.5.4">
  <artifact name="zipkin-storage-kafka" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.jeqo.zipkin', module='zipkin-storage-kafka', version='0.5.4')
)
libraryDependencies += "io.github.jeqo.zipkin" % "zipkin-storage-kafka" % "0.5.4"
[io.github.jeqo.zipkin/zipkin-storage-kafka "0.5.4"]

Dependencies

compile (4)

Group / Artifact Type Version
org.apache.kafka : kafka-clients jar 2.3.0
org.apache.kafka : kafka-streams jar 2.3.0
io.zipkin.reporter2 : zipkin-sender-kafka jar 2.10.1
io.zipkin.zipkin2 : zipkin jar 2.16.2

test (9)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter jar 5.5.1
org.apache.kafka : kafka-streams-test-utils jar 2.3.0
org.apache.kafka : kafka-clients jar 2.3.0
org.apache.kafka : kafka-streams jar 2.3.0
no.sysco.middleware.kafka : kafka-util-streams-graphviz jar 0.1.3
org.testcontainers : junit-jupiter jar 1.12.0
org.testcontainers : kafka jar 1.12.0
org.apache.logging.log4j : log4j-slf4j-impl jar 2.11.1
org.awaitility : awaitility jar 3.1.6

Project Modules

There are no modules declared in this project.

Zipkin Storage: Kafka [EXPERIMENTAL]

Gitter chat Build Status Maven Central

Kafka-based storage for Zipkin.

                    +----------------------------*zipkin*----------------------------------------------
                    |                                     [ dependency-storage ]--->( dependencies      )
                    |                                                  ^        +-->( autocomplete-tags )
( collected-spans )-|->[ partitioning ]   [ aggregation ]    [ trace-storage ]--+-->( traces            )
  via http, kafka,  |       |                    ^    |         ^      |        +-->( service-names     )
  amq, grpc, etc.   +-------|--------------------|----|---------|------|-------------------------------
                            |                    |    |         |      |
----------------------------|--------------------|----|---------|------|-------------------------------
                            +-->( spans )--------+----+---------|      |
                                                      |         |      |
*kafka*                                               +->( traces )    |
 topics                                               |                |
                                                      +->( dependencies )

-------------------------------------------------------------------------------------------------------

Spans collected via different transports are partitioned by traceId and stored in a partitioned spans Kafka topic. Partitioned spans are then aggregated into traces and then into dependency links, both results are emitted into Kafka topics as well. These 3 topics are used as source for local stores (Kafka Stream stores) that support Zipkin query and search APIs.

Design

Configuration

Use-cases

Replacement for batch-oriented Zipkin dependencies

A limitation of zipkin-dependencies module, is that it requires to be scheduled with a defined frequency. This batch-oriented execution causes out-of-date values until processing runs again.

Kafka-based storage enables aggregating dependencies as spans are received, allowing a (near-)real-time calculation of dependency metrics.

To enable this, other components could be disabled. There is a profile prepared to enable aggregation and search of dependency graphs.

This profile can be enable by adding Java option: -Dspring.profiles.active=kafka-only-dependencies

Docker image includes a environment variable to set the profile:

MODULE_OPTS="-Dloader.path=lib -Dspring.profiles.active=kafka-only-dependencies"

To try out, there is a Docker compose configuration ready to test.

If an existing Kafka collector is in place downstreaming traces into an existing storage, another Kafka consumer group id can be used for zipkin-storage-kafka to consume traces in parallel. Otherwise, you can forward spans from another Zipkin server to zipkin-storage-kafka if Kafka transport is not available.

Building

To build the project you will need Java 8+.

make build

And testing:

make test

If you want to build a docker image:

make docker-build

Run locally

To run locally, first you need to get Zipkin binaries:

make get-zipkin

By default Zipkin will be waiting for a Kafka broker to be running on localhost:19092.

Then run Zipkin locally:

make run-local

To validate storage make sure that Kafka topics are created so Kafka Stream instances can be initialized properly:

make kafka-topics
make zipkin-test

This will start a browser and check a traces has been registered.

It will send another trace after a minute (trace timeout) + 1 second to trigger aggregation and visualize dependency graph.

Run with Docker

If you have Docker available, run:

make run-docker

And Docker image will be built and Docker compose will start.

To test it, run:

make zipkin-test-single
# or
make zipkin-test-distributed

traces

dependencies

Examples

  • Single-node: span partitioning, aggregation, and storage happening on the same containers.
  • Distributed-mode: partitioning and aggregation is in a different container than storage.
  • Only-dependencies: only components to support aggregation and search of dependency graphs.

Acknowledgments

This project is inspired in Adrian Cole's VoltDB storage https://github.com/adriancole/zipkin-voltdb

Kafka Streams images are created with https://zz85.github.io/kafka-streams-viz/

Artifacts

All artifacts publish to the group ID "io.zipkin.contrib.zipkin-storage-kafka". We use a common release version for all components.

Library Releases

Releases are at Sonatype and Maven Central

Library Snapshots

Snapshots are uploaded to Sonatype after commits to master.

Docker Images

Released versions of zipkin-storage-kafka are published to GitHub Container Registry as ghcr.io/openzipkin-contrib/zipkin-storage-kafka. See docker for details.

Versions

Version
0.5.4
0.5.3
0.5.2
0.5.1
0.5.0
0.4.0
0.3.2
0.3.1
0.3.0
0.2.1
0.2.0
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0