-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from openzipkin/kafka
Adds Kafka Transport
- Loading branch information
Showing
15 changed files
with
606 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
zipkin-server/src/main/java/zipkin/server/ZipkinKafkaProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* Copyright 2015-2016 The OpenZipkin Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package zipkin.server; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
@ConfigurationProperties("kafka") | ||
class ZipkinKafkaProperties { | ||
private String topic = "zipkin"; | ||
private String zookeeper; | ||
private String groupId = "zipkin"; | ||
private int streams = 1; | ||
|
||
public String getTopic() { | ||
return topic; | ||
} | ||
|
||
public void setTopic(String topic) { | ||
this.topic = topic; | ||
} | ||
|
||
public String getZookeeper() { | ||
return zookeeper; | ||
} | ||
|
||
public void setZookeeper(String zookeeper) { | ||
this.zookeeper = "".equals(zookeeper) ? null : zookeeper; | ||
} | ||
|
||
public String getGroupId() { | ||
return groupId; | ||
} | ||
|
||
public void setGroupId(String groupId) { | ||
this.groupId = groupId; | ||
} | ||
|
||
public int getStreams() { | ||
return streams; | ||
} | ||
|
||
public void setStreams(int streams) { | ||
this.streams = streams; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# transport-kafka | ||
This transport polls a Kafka 8.2.2+ topic for messages that contain | ||
TBinaryProtocol big-endian encoded lists of spans. These spans are | ||
pushed to a span consumer. | ||
|
||
`zipkin.kafka.KafkaConfig` includes defaults that will operate | ||
against a local Cassandra installation. | ||
|
||
|
||
## Encoding spans into Kafka messages | ||
`Codec.THRIFT.writeSpans(spans)` encodes spans in the following fashion: | ||
|
||
The message's binary data includes a list header followed by N spans serialized in TBinaryProtocol | ||
``` | ||
write_byte(12) // type of the list elements: 12 == struct | ||
write_i32(count) // count of spans that will follow | ||
for (int i = 0; i < count; i++) { | ||
writeTBinaryProtocol(spans(i)) | ||
} | ||
``` | ||
|
||
### Legacy encoding | ||
Older versions of zipkin accepted a single span per message, as opposed | ||
to a list per message. This practice is deprecated, but still supported. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright 2015-2016 The OpenZipkin Authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
in compliance with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under the License | ||
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
or implied. See the License for the specific language governing permissions and limitations under | ||
the License. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>io.zipkin.java</groupId> | ||
<artifactId>zipkin-transports</artifactId> | ||
<version>0.7.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>transport-kafka</artifactId> | ||
<name>Span Transport: Kafka</name> | ||
|
||
<properties> | ||
<main.basedir>${project.basedir}/..</main.basedir> | ||
<!-- This is pinned to Kafka 0.8.x client as 0.9.x brokers work with them, but not visa-versa | ||
http://docs.confluent.io/2.0.0/upgrade.html --> | ||
<kafka.version>0.8.2.2</kafka.version> | ||
<!-- pinned to 0.8.2.2 --> | ||
<kafka-junit.version>1.7</kafka-junit.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>zipkin</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.kafka</groupId> | ||
<artifactId>kafka_2.11</artifactId> | ||
<version>${kafka.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.github.charithe</groupId> | ||
<artifactId>kafka-junit</artifactId> | ||
<version>${kafka-junit.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
Oops, something went wrong.