Skip to content

Commit

Permalink
open-telemetry#375 started on adding Zipkin exporter support
Browse files Browse the repository at this point in the history
Signed-off-by: Sergei Malafeev <sergeymalafeev@gmail.com>
  • Loading branch information
malafeev committed May 18, 2020
1 parent e54f316 commit 3378b82
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- run:
name: Build Project
command: GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx1G -Xms64M' -Dota.forkedMaxHeapSize=1G -Dota.forkedMinHeapSize=64M" ./gradlew clean compileTestGroovy compileLatestDepTestGroovy compileTestScala compileLatestDepTestScala compileTestJava compileLatestDepTestJava :opentelemetry-auto:shadowJar :auto-exporters:opentelemetry-auto-exporters-jaeger:shadowJar :auto-exporters:opentelemetry-auto-exporters-otlp:shadowJar :auto-exporters:opentelemetry-auto-exporters-logging:shadowJar --build-cache --parallel --stacktrace --no-daemon --max-workers=8
command: GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx1G -Xms64M' -Dota.forkedMaxHeapSize=1G -Dota.forkedMinHeapSize=64M" ./gradlew clean compileTestGroovy compileLatestDepTestGroovy compileTestScala compileLatestDepTestScala compileTestJava compileLatestDepTestJava :opentelemetry-auto:shadowJar :auto-exporters:opentelemetry-auto-exporters-jaeger:shadowJar :auto-exporters:opentelemetry-auto-exporters-otlp:shadowJar :auto-exporters:opentelemetry-auto-exporters-logging:shadowJar :auto-exporters:opentelemetry-auto-exporters-zipkin:shadowJar --build-cache --parallel --stacktrace --no-daemon --max-workers=8

- run:
name: Collect Libs
Expand Down
3 changes: 3 additions & 0 deletions auto-exporters/auto-exporters.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ dependencies {
testCompile project(':auto-exporters:opentelemetry-auto-exporters-otlp')
testCompile project(':auto-exporters:opentelemetry-auto-exporters-jaeger')
testCompile project(':auto-exporters:opentelemetry-auto-exporters-logging')
testCompile project(':auto-exporters:opentelemetry-auto-exporters-zipkin')
}

tasks.withType(Test).configureEach() {
dependsOn ':auto-exporters:opentelemetry-auto-exporters-otlp:shadowJar'
dependsOn ':auto-exporters:opentelemetry-auto-exporters-jaeger:shadowJar'
dependsOn ':auto-exporters:opentelemetry-auto-exporters-logging:shadowJar'
dependsOn ':auto-exporters:opentelemetry-auto-exporters-zipkin:shadowJar'
doFirst {
systemProperty 'projectVersion', allprojects.version[0]
systemProperty 'adapterRoot', "${rootDir}/auto-exporters"
systemProperty 'otlpExporterJar', project(':auto-exporters:opentelemetry-auto-exporters-otlp').tasks.shadowJar.archivePath
systemProperty 'jaegerExporterJar', project(':auto-exporters:opentelemetry-auto-exporters-jaeger').tasks.shadowJar.archivePath
systemProperty 'loggingExporterJar', project(':auto-exporters:opentelemetry-auto-exporters-logging').tasks.shadowJar.archivePath
systemProperty 'zipkinExporterJar', project(':auto-exporters:opentelemetry-auto-exporters-zipkin').tasks.shadowJar.archivePath
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class ExporterAdaptersTest extends Specification {
@Shared
def loggingExporterJar = System.getProperty("loggingExporterJar")

@Shared
def zipkinExporterJar = System.getProperty("zipkinExporterJar")

@Shared
def jaegerDir = new File("${adapterRoot}/jaeger-adapter/build/libs")

Expand All @@ -45,7 +48,7 @@ class ExporterAdaptersTest extends Specification {
file != null

where:
exporter << [otlpExporterJar, jaegerExporterJar, loggingExporterJar]
exporter << [otlpExporterJar, jaegerExporterJar, loggingExporterJar, zipkinExporterJar]
}

def "test exporter load"() {
Expand All @@ -71,5 +74,6 @@ class ExporterAdaptersTest extends Specification {
otlpExporterJar | 'io.opentelemetry.auto.exporters.otlp.OtlpSpanExporterFactory'
jaegerExporterJar | 'io.opentelemetry.auto.exporters.jaeger.JaegerExporterFactory'
loggingExporterJar | 'io.opentelemetry.auto.exporters.logging.LoggingExporterFactory'
zipkinExporterJar | 'io.opentelemetry.auto.exporters.zipkin.ZipkinExporterFactory'
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright The OpenTelemetry 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 io.opentelemetry.auto.exporters.zipkin;

import io.opentelemetry.exporters.zipkin.ZipkinExporterConfiguration;
import io.opentelemetry.sdk.contrib.auto.config.Config;
import io.opentelemetry.sdk.contrib.auto.config.SpanExporterFactory;
import io.opentelemetry.sdk.trace.export.SpanExporter;

public class ZipkinExporterFactory implements SpanExporterFactory {
@Override
public SpanExporter fromConfig(Config config) {
ZipkinExporterConfiguration configuration =
ZipkinExporterConfiguration.builder()
.setEndpoint("http://localhost/api/v2/spans")
.setServiceName("my-service")
.build();

ZipkinSpanExporter exporter = ZipkinSpanExporter.create(configuration);
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.opentelemetry.auto.exporters.zipkin.ZipkinExporterFactory
18 changes: 18 additions & 0 deletions auto-exporters/zipkin/zipkin.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
plugins {
id "com.github.johnrengelman.shadow"
}

apply from: "${rootDir}/gradle/java.gradle"

dependencies {
compile(deps.opentelemetryZipkin) {
exclude group: 'io.opentelemetry', module: 'opentelemetry-sdk'
}
compileOnly deps.opentelemetrySdkAutoConfig
compile group: 'io.grpc', name: 'grpc-api', version: '1.24.0'
compile group: 'io.grpc', name: 'grpc-netty-shaded', version: '1.24.0'
}

shadowJar {
archiveClassifier = ''
}
1 change: 1 addition & 0 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ ext {
opentelemetrySdkAutoConfig : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-sdk-contrib-auto-config', version: versions.opentelemetry),
opentelemetryJaeger : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-exporters-jaeger', version: versions.opentelemetry),
opentelemetryOtlp : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-exporters-otlp', version: versions.opentelemetry),
opentelemetryZipkin : dependencies.create(group: 'io.opentelemetry', name: 'opentelemetry-exporters-zipkin', version: versions.opentelemetry),

// General
slf4j : "org.slf4j:slf4j-api:${versions.slf4j}",
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ include ":auto-exporters"
include ":auto-exporters:jaeger"
include ":auto-exporters:logging"
include ":auto-exporters:otlp"
include ":auto-exporters:zipkin"

// benchmark
include ':benchmark'
Expand All @@ -172,3 +173,4 @@ project(':java-agent').name = 'opentelemetry-auto'
project(':auto-exporters:jaeger').name = 'opentelemetry-auto-exporters-jaeger'
project(':auto-exporters:logging').name = 'opentelemetry-auto-exporters-logging'
project(':auto-exporters:otlp').name = 'opentelemetry-auto-exporters-otlp'
project(':auto-exporters:zipkin').name = 'opentelemetry-auto-exporters-zipkin'

0 comments on commit 3378b82

Please sign in to comment.