-
Notifications
You must be signed in to change notification settings - Fork 802
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update dependency io.zipkin.reporter2:zipkin-reporter-bom to 3.0.2
Signed-off-by: Adrian Cole <adrian@tetrate.io>
- Loading branch information
Adrian Cole
committed
Jan 9, 2024
1 parent
d9f9812
commit 499a972
Showing
8 changed files
with
159 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
6 changes: 5 additions & 1 deletion
6
docs/apidiffs/current_vs_latest/opentelemetry-exporter-zipkin.txt
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 |
---|---|---|
@@ -1,2 +1,6 @@ | ||
Comparing source compatibility of against | ||
No changes. | ||
*** MODIFIED CLASS: PUBLIC FINAL io.opentelemetry.exporter.zipkin.ZipkinSpanExporterBuilder (not serializable) | ||
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0 | ||
=== UNCHANGED METHOD: PUBLIC io.opentelemetry.exporter.zipkin.ZipkinSpanExporterBuilder setEncoder(zipkin2.codec.BytesEncoder<zipkin2.Span><zipkin2.Span>) | ||
+++ NEW ANNOTATION: java.lang.Deprecated | ||
+++ NEW METHOD: PUBLIC(+) io.opentelemetry.exporter.zipkin.ZipkinSpanExporterBuilder setEncoder(zipkin2.reporter.BytesEncoder<zipkin2.Span>) |
51 changes: 51 additions & 0 deletions
51
exporters/zipkin/src/main/java/io/opentelemetry/exporter/zipkin/BytesEncoderAdapter.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,51 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.exporter.zipkin; | ||
|
||
import zipkin2.Span; | ||
import zipkin2.reporter.BytesEncoder; | ||
import zipkin2.reporter.Encoding; | ||
|
||
/** | ||
* This supports the deprecated method {@link | ||
* ZipkinSpanExporterBuilder#setEncoder(zipkin2.codec.BytesEncoder)}. | ||
*/ | ||
final class BytesEncoderAdapter implements BytesEncoder<Span> { | ||
private final zipkin2.codec.BytesEncoder<Span> encoder; | ||
|
||
BytesEncoderAdapter(zipkin2.codec.BytesEncoder<Span> encoder) { | ||
this.encoder = encoder; | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("deprecation") // we have to use the deprecated thrift encoding to return it | ||
public Encoding encoding() { | ||
switch (encoder.encoding()) { | ||
case JSON: | ||
return Encoding.JSON; | ||
case PROTO3: | ||
return Encoding.PROTO3; | ||
case THRIFT: | ||
return Encoding.THRIFT; | ||
} | ||
throw new UnsupportedOperationException("unsupported encoding " + encoder.encoding()); | ||
} | ||
|
||
@Override | ||
public int sizeInBytes(Span span) { | ||
return encoder.sizeInBytes(span); | ||
} | ||
|
||
@Override | ||
public byte[] encode(Span span) { | ||
return encoder.encode(span); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return encoder.toString(); | ||
} | ||
} |
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
66 changes: 66 additions & 0 deletions
66
exporters/zipkin/src/test/java/io/opentelemetry/exporter/zipkin/BytesEncoderAdapterTest.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,66 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.exporter.zipkin; | ||
|
||
import static io.opentelemetry.exporter.zipkin.ZipkinTestUtil.PARENT_SPAN_ID; | ||
import static io.opentelemetry.exporter.zipkin.ZipkinTestUtil.SPAN_ID; | ||
import static io.opentelemetry.exporter.zipkin.ZipkinTestUtil.TRACE_ID; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import zipkin2.Endpoint; | ||
import zipkin2.Span; | ||
import zipkin2.reporter.Encoding; | ||
import zipkin2.reporter.SpanBytesEncoder; | ||
|
||
class BytesEncoderAdapterTest { | ||
|
||
/** Contains {@link Span#localEndpoint()} to ensure would be encoded differently. */ | ||
private final Span testSpan = | ||
Span.newBuilder() | ||
.traceId(TRACE_ID) | ||
.parentId(PARENT_SPAN_ID) | ||
.id(SPAN_ID) | ||
.localEndpoint(Endpoint.newBuilder().serviceName("test").build()) | ||
.build(); | ||
|
||
@Test | ||
void testJsonV2() { | ||
BytesEncoderAdapter adapter = new BytesEncoderAdapter(zipkin2.codec.SpanBytesEncoder.JSON_V2); | ||
assertThat(adapter.encoding()).isEqualTo(Encoding.JSON); | ||
assertThat(adapter.encode(testSpan)).isEqualTo(SpanBytesEncoder.JSON_V2.encode(testSpan)); | ||
assertThat(adapter.sizeInBytes(testSpan)) | ||
.isEqualTo(SpanBytesEncoder.JSON_V2.sizeInBytes(testSpan)); | ||
} | ||
|
||
@Test | ||
void testProtobuf() { | ||
BytesEncoderAdapter adapter = new BytesEncoderAdapter(zipkin2.codec.SpanBytesEncoder.PROTO3); | ||
assertThat(adapter.encoding()).isEqualTo(Encoding.PROTO3); | ||
assertThat(adapter.encode(testSpan)).isEqualTo(SpanBytesEncoder.PROTO3.encode(testSpan)); | ||
assertThat(adapter.sizeInBytes(testSpan)) | ||
.isEqualTo(SpanBytesEncoder.PROTO3.sizeInBytes(testSpan)); | ||
} | ||
|
||
@Test | ||
@SuppressWarnings("deprecation") // we have to use the deprecated thrift encoding to test it | ||
void testThrift() { | ||
BytesEncoderAdapter adapter = new BytesEncoderAdapter(zipkin2.codec.SpanBytesEncoder.THRIFT); | ||
assertThat(adapter.encoding()).isEqualTo(Encoding.THRIFT); | ||
assertThat(adapter.encode(testSpan)).isEqualTo(SpanBytesEncoder.THRIFT.encode(testSpan)); | ||
assertThat(adapter.sizeInBytes(testSpan)) | ||
.isEqualTo(SpanBytesEncoder.THRIFT.sizeInBytes(testSpan)); | ||
} | ||
|
||
@Test | ||
void testJsonV1() { | ||
BytesEncoderAdapter adapter = new BytesEncoderAdapter(zipkin2.codec.SpanBytesEncoder.JSON_V1); | ||
assertThat(adapter.encoding()).isEqualTo(Encoding.JSON); | ||
assertThat(adapter.encode(testSpan)).isEqualTo(SpanBytesEncoder.JSON_V1.encode(testSpan)); | ||
assertThat(adapter.sizeInBytes(testSpan)) | ||
.isEqualTo(SpanBytesEncoder.JSON_V1.sizeInBytes(testSpan)); | ||
} | ||
} |
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