-
Notifications
You must be signed in to change notification settings - Fork 879
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* #375 Add Zipkin exporter support Signed-off-by: Sergei Malafeev <[email protected]> * #375 use OkHttpSender for Zipkin exporter Signed-off-by: Sergei Malafeev <[email protected]> * #375 add Zipkin exporter to README Signed-off-by: Sergei Malafeev <[email protected]> Co-authored-by: Trask Stalnaker <[email protected]>
- Loading branch information
Showing
9 changed files
with
80 additions
and
2 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
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
42 changes: 42 additions & 0 deletions
42
...rs/zipkin/src/main/java/io/opentelemetry/auto/exporters/zipkin/ZipkinExporterFactory.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,42 @@ | ||
/* | ||
* 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.exporters.zipkin.ZipkinSpanExporter; | ||
import io.opentelemetry.sdk.contrib.auto.config.Config; | ||
import io.opentelemetry.sdk.contrib.auto.config.SpanExporterFactory; | ||
import io.opentelemetry.sdk.trace.export.SpanExporter; | ||
import zipkin2.reporter.okhttp3.OkHttpSender; | ||
|
||
public class ZipkinExporterFactory implements SpanExporterFactory { | ||
private static final String ZIPKIN_ENDPOINT = "zipkin.endpoint"; | ||
private static final String DEFAULT_ZIPKIN_ENDPOINT = "http://localhost:9411/api/v2/spans"; | ||
|
||
private static final String ZIPKIN_SERVICE_NAME = "zipkin.service.name"; | ||
private static final String DEFAULT_ZIPKIN_SERVICE_NAME = "(unknown service)"; | ||
|
||
@Override | ||
public SpanExporter fromConfig(Config config) { | ||
final String zipkinEndpoint = config.getString(ZIPKIN_ENDPOINT, DEFAULT_ZIPKIN_ENDPOINT); | ||
final String serviceName = config.getString(ZIPKIN_SERVICE_NAME, DEFAULT_ZIPKIN_SERVICE_NAME); | ||
return ZipkinSpanExporter.create( | ||
ZipkinExporterConfiguration.builder() | ||
.setSender(OkHttpSender.create(zipkinEndpoint)) | ||
.setServiceName(serviceName) | ||
.build()); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
.../resources/META-INF/services/io.opentelemetry.sdk.contrib.auto.config.SpanExporterFactory
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 @@ | ||
io.opentelemetry.auto.exporters.zipkin.ZipkinExporterFactory |
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,17 @@ | ||
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.zipkin.reporter2', name: 'zipkin-sender-okhttp3', version: '2.12.2' | ||
} | ||
|
||
shadowJar { | ||
archiveClassifier = '' | ||
} |
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