diff --git a/benchmarks/pom.xml b/benchmarks/pom.xml index 1211b4c1e4f..009b2e688ce 100644 --- a/benchmarks/pom.xml +++ b/benchmarks/pom.xml @@ -45,6 +45,11 @@ guava ${guava.version} + + + com.google.code.gson + gson + com.esotericsoftware.kryo @@ -69,19 +74,26 @@ zipkin-server ${project.version} - - io.zipkin.proto3 - zipkin-proto3 + com.squareup.wire + wire-runtime + ${wire.version} - com.google.protobuf - protobuf-java + io.zipkin.proto3 + zipkin-proto3 + + maven-dependency-plugin + + + com.squareup.wire + wire-maven-plugin + net.orfjackal.retrolambda @@ -105,27 +117,6 @@ true - - - maven-dependency-plugin - - - unpack-proto - - - - - org.xolstice.maven.plugins - protobuf-maven-plugin - - - compile-proto - - compile - - - - maven-shade-plugin diff --git a/benchmarks/src/main/java/zipkin2/codec/CodecBenchmarks.java b/benchmarks/src/main/java/zipkin2/codec/CodecBenchmarks.java index 8e196993c0a..d3ebbe4c6fb 100644 --- a/benchmarks/src/main/java/zipkin2/codec/CodecBenchmarks.java +++ b/benchmarks/src/main/java/zipkin2/codec/CodecBenchmarks.java @@ -41,12 +41,15 @@ import org.openjdk.jmh.runner.options.OptionsBuilder; import zipkin2.Span; -import static zipkin2.proto3.Span.parseFrom; - /** * The {@link SpanBytesEncoder bundled java codec} aims to be both small in size (i.e. does not * significantly increase the size of zipkin's jar), and efficient. It may not always be fastest, * but we should try to keep it competitive. + * + *

Note that the wire benchmarks use their structs, not ours. This will result in more efficient + * writes as there's no hex codec of IDs, stringifying of IPs etc. A later change could do that, but + * it likely still going to be more efficient than our dependency-free codec. This means in cases + * where extra dependencies are ok (such as our server), we could consider using wire. */ @Measurement(iterations = 5, time = 1) @Warmup(iterations = 10, time = 1) @@ -56,108 +59,133 @@ @State(Scope.Thread) @Threads(1) public class CodecBenchmarks { - static final byte[] zipkin2Json = read("/zipkin2-client.json"); - static final Span zipkin2 = SpanBytesDecoder.JSON_V2.decodeOne(zipkin2Json); - static final byte[] zipkin2Proto3 = SpanBytesEncoder.PROTO3.encode(zipkin2); - static final List tenSpan2s = Collections.nCopies(10, zipkin2); - static final byte[] tenSpan2sJson = SpanBytesEncoder.JSON_V2.encodeList(tenSpan2s); + static final byte[] clientSpanJsonV2 = read("/zipkin2-client.json"); + static final Span clientSpan = SpanBytesDecoder.JSON_V2.decodeOne(clientSpanJsonV2); + static final byte[] clientSpanProto3 = SpanBytesEncoder.PROTO3.encode(clientSpan); + static final zipkin2.proto3.Span clientSpan_wire; + static final List tenClientSpans = Collections.nCopies(10, clientSpan); + static final byte[] tenClientSpansJsonV2 = SpanBytesEncoder.JSON_V2.encodeList(tenClientSpans); static final Kryo kryo = new Kryo(); - static final byte[] zipkin2Serialized; + static final byte[] clientSpanSerialized; static { kryo.register(Span.class, new JavaSerializer()); Output output = new Output(4096); - kryo.writeObject(output, zipkin2); + kryo.writeObject(output, clientSpan); output.flush(); - zipkin2Serialized = output.getBuffer(); + clientSpanSerialized = output.getBuffer(); + try { + clientSpan_wire = zipkin2.proto3.Span.ADAPTER.decode(clientSpanProto3); + } catch (IOException e) { + throw new AssertionError(e); + } } /** manually implemented with json so not as slow as normal java */ @Benchmark - public Span readClientSpan_java() { - return kryo.readObject(new Input(zipkin2Serialized), Span.class); + public Span readClientSpan_kryo() { + return kryo.readObject(new Input(clientSpanSerialized), Span.class); } @Benchmark - public byte[] writeClientSpan_java() { - Output output = new Output(zipkin2Serialized.length); - kryo.writeObject(output, zipkin2); + public byte[] writeClientSpan_kryo() { + Output output = new Output(clientSpanSerialized.length); + kryo.writeObject(output, clientSpan); output.flush(); return output.getBuffer(); } @Benchmark public Span readClientSpan_json() { - return SpanBytesDecoder.JSON_V2.decodeOne(zipkin2Json); + return SpanBytesDecoder.JSON_V2.decodeOne(clientSpanJsonV2); } @Benchmark public Span readClientSpan_proto3() { - return SpanBytesDecoder.PROTO3.decodeOne(zipkin2Proto3); + return SpanBytesDecoder.PROTO3.decodeOne(clientSpanProto3); } @Benchmark - public zipkin2.proto3.Span readClientSpan_proto3_protobuf() throws Exception { - return parseFrom(zipkin2Proto3); + public zipkin2.proto3.Span readClientSpan_proto3_wire() throws Exception { + return zipkin2.proto3.Span.ADAPTER.decode(clientSpanProto3); } @Benchmark public List readTenClientSpans_json() { - return SpanBytesDecoder.JSON_V2.decodeList(tenSpan2sJson); + return SpanBytesDecoder.JSON_V2.decodeList(tenClientSpansJsonV2); } @Benchmark public byte[] writeClientSpan_json() { - return SpanBytesEncoder.JSON_V2.encode(zipkin2); + return SpanBytesEncoder.JSON_V2.encode(clientSpan); } @Benchmark public byte[] writeTenClientSpans_json() { - return SpanBytesEncoder.JSON_V2.encodeList(tenSpan2s); + return SpanBytesEncoder.JSON_V2.encodeList(tenClientSpans); } @Benchmark - public byte[] writeClientSpan_json_legacy() { - return SpanBytesEncoder.JSON_V1.encode(zipkin2); + public byte[] writeClientSpan_json_v1() { + return SpanBytesEncoder.JSON_V1.encode(clientSpan); } @Benchmark - public byte[] writeTenClientSpans_json_legacy() { - return SpanBytesEncoder.JSON_V1.encodeList(tenSpan2s); + public byte[] writeTenClientSpans_json_v1() { + return SpanBytesEncoder.JSON_V1.encodeList(tenClientSpans); } @Benchmark public byte[] writeClientSpan_proto3() { - return SpanBytesEncoder.PROTO3.encode(zipkin2); + return SpanBytesEncoder.PROTO3.encode(clientSpan); } - static final byte[] zipkin2JsonChinese = read("/zipkin2-chinese.json"); - static final Span zipkin2Chinese = SpanBytesDecoder.JSON_V2.decodeOne(zipkin2JsonChinese); - static final byte[] zipkin2Proto3Chinese = SpanBytesEncoder.PROTO3.encode(zipkin2Chinese); + @Benchmark + public byte[] writeClientSpan_proto3_wire() { + return clientSpan_wire.encode(); + } + + static final byte[] chineseSpanJsonV2 = read("/zipkin2-chinese.json"); + static final Span chineseSpan = SpanBytesDecoder.JSON_V2.decodeOne(chineseSpanJsonV2); + static final zipkin2.proto3.Span chineseSpan_wire; + static final byte[] chineseSpanProto3 = SpanBytesEncoder.PROTO3.encode(chineseSpan); + + static { + try { + chineseSpan_wire = zipkin2.proto3.Span.ADAPTER.decode(chineseSpanProto3); + } catch (IOException e) { + throw new AssertionError(e); + } + } @Benchmark public Span readChineseSpan_json() { - return SpanBytesDecoder.JSON_V2.decodeOne(zipkin2JsonChinese); + return SpanBytesDecoder.JSON_V2.decodeOne(chineseSpanJsonV2); } @Benchmark public Span readChineseSpan_proto3() { - return SpanBytesDecoder.PROTO3.decodeOne(zipkin2Proto3Chinese); + return SpanBytesDecoder.PROTO3.decodeOne(chineseSpanProto3); } @Benchmark - public zipkin2.proto3.Span readChineseSpan_proto3_protobuf() throws Exception { - return parseFrom(zipkin2Proto3Chinese); + public zipkin2.proto3.Span readChineseSpan_proto3_wire() throws Exception { + return zipkin2.proto3.Span.ADAPTER.decode(chineseSpanProto3); } @Benchmark public byte[] writeChineseSpan_json() { - return SpanBytesEncoder.JSON_V2.encode(zipkin2Chinese); + return SpanBytesEncoder.JSON_V2.encode(chineseSpan); } @Benchmark public byte[] writeChineseSpan_proto3() { - return SpanBytesEncoder.PROTO3.encode(zipkin2Chinese); + return SpanBytesEncoder.PROTO3.encode(chineseSpan); + } + + @Benchmark + public byte[] writeChineseSpan_proto3_wire() { + return chineseSpan_wire.encode(); } // Convenience main entry-point diff --git a/benchmarks/src/test/java/zipkin2/internal/Proto3CodecInteropTest.java b/benchmarks/src/test/java/zipkin2/internal/Proto3CodecInteropTest.java index 070228254b3..7737103cecd 100644 --- a/benchmarks/src/test/java/zipkin2/internal/Proto3CodecInteropTest.java +++ b/benchmarks/src/test/java/zipkin2/internal/Proto3CodecInteropTest.java @@ -16,25 +16,23 @@ */ package zipkin2.internal; -import com.google.common.io.BaseEncoding; -import com.google.protobuf.ByteString; -import com.google.protobuf.CodedOutputStream; +import com.squareup.wire.ProtoWriter; import java.io.IOException; import java.util.Arrays; import java.util.List; +import okio.ByteString; import org.assertj.core.data.MapEntry; import org.junit.Test; import zipkin2.codec.SpanBytesDecoder; import zipkin2.codec.SpanBytesEncoder; -import zipkin2.internal.Proto3Fields.Utf8Field; -import zipkin2.internal.Proto3ZipkinFields.EndpointField; import zipkin2.internal.Proto3ZipkinFields.TagField; import zipkin2.proto3.Annotation; import zipkin2.proto3.Endpoint; import zipkin2.proto3.ListOfSpans; import zipkin2.proto3.Span; -import static com.google.protobuf.CodedOutputStream.computeMessageSize; +import static java.util.Collections.singletonMap; +import static okio.ByteString.decodeHex; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.data.MapEntry.entry; import static zipkin2.internal.Proto3ZipkinFields.SPAN; @@ -43,6 +41,7 @@ import static zipkin2.internal.Proto3ZipkinFields.SpanField.REMOTE_ENDPOINT; import static zipkin2.internal.Proto3ZipkinFields.SpanField.TAG_KEY; +// Compares against Square Wire as it is easier than Google's protobuf tooling public class Proto3CodecInteropTest { static final zipkin2.Endpoint ORDER = zipkin2.Endpoint.newBuilder() .serviceName("订单维护服务") @@ -74,190 +73,166 @@ public class Proto3CodecInteropTest { .build(); static final List ZIPKIN_SPANS = Arrays.asList(ZIPKIN_SPAN, ZIPKIN_SPAN); - static final Span PROTO_SPAN = Span.newBuilder() - .setTraceId(decodeHex(ZIPKIN_SPAN.traceId())) - .setParentId(decodeHex(ZIPKIN_SPAN.parentId())) - .setId(decodeHex(ZIPKIN_SPAN.id())) - .setKind(Span.Kind.valueOf(ZIPKIN_SPAN.kind().name())) - .setName(ZIPKIN_SPAN.name()) - .setTimestamp(ZIPKIN_SPAN.timestampAsLong()) - .setDuration(ZIPKIN_SPAN.durationAsLong()) - .setLocalEndpoint(Endpoint.newBuilder() - .setServiceName(ORDER.serviceName()) - .setIpv6(ByteString.copyFrom(ORDER.ipv6Bytes())).build() + static final Span PROTO_SPAN = new Span.Builder() + .trace_id(decodeHex(ZIPKIN_SPAN.traceId())) + .parent_id(decodeHex(ZIPKIN_SPAN.parentId())) + .id(decodeHex(ZIPKIN_SPAN.id())) + .kind(Span.Kind.valueOf(ZIPKIN_SPAN.kind().name())) + .name(ZIPKIN_SPAN.name()) + .timestamp(ZIPKIN_SPAN.timestampAsLong()) + .duration(ZIPKIN_SPAN.durationAsLong()) + .local_endpoint(new Endpoint.Builder() + .service_name(ORDER.serviceName()) + .ipv6(ByteString.of(ORDER.ipv6Bytes())).build() ) - .setRemoteEndpoint(Endpoint.newBuilder() - .setServiceName(PROFILE.serviceName()) - .setIpv4(ByteString.copyFrom(PROFILE.ipv4Bytes())) - .setPort(PROFILE.portAsInt()).build() + .remote_endpoint(new Endpoint.Builder() + .service_name(PROFILE.serviceName()) + .ipv4(ByteString.of(PROFILE.ipv4Bytes())) + .port(PROFILE.portAsInt()).build() ) - .addAnnotations(Annotation.newBuilder() - .setTimestamp(ZIPKIN_SPAN.annotations().get(0).timestamp()) - .setValue(ZIPKIN_SPAN.annotations().get(0).value()) - .build()) - .putAllTags(ZIPKIN_SPAN.tags()) - .setShared(true) + .annotations(Arrays.asList(new Annotation.Builder() + .timestamp(ZIPKIN_SPAN.annotations().get(0).timestamp()) + .value(ZIPKIN_SPAN.annotations().get(0).value()) + .build())) + .tags(ZIPKIN_SPAN.tags()) + .shared(true) .build(); - ListOfSpans PROTO_SPANS = ListOfSpans.newBuilder() - .addSpans(PROTO_SPAN) - .addSpans(PROTO_SPAN).build(); + ListOfSpans PROTO_SPANS = new ListOfSpans.Builder() + .spans(Arrays.asList(PROTO_SPAN, PROTO_SPAN)).build(); + + @Test public void encodeIsCompatible() throws IOException { + okio.Buffer buffer = new okio.Buffer(); - @Test public void encodeIsCompatible() throws Exception { - byte[] googleBytes = new byte[computeMessageSize(1, PROTO_SPAN)]; - CodedOutputStream out = CodedOutputStream.newInstance(googleBytes); - out.writeMessage(1, PROTO_SPAN); + Span.ADAPTER.encodeWithTag(new ProtoWriter(buffer), 1, PROTO_SPAN); assertThat(SpanBytesEncoder.PROTO3.encode(ZIPKIN_SPAN)) - .containsExactly(googleBytes); + .containsExactly(buffer.readByteArray()); } @Test public void decodeOneIsCompatible() { - assertThat(SpanBytesDecoder.PROTO3.decodeOne(PROTO_SPANS.toByteArray())) + assertThat(SpanBytesDecoder.PROTO3.decodeOne(PROTO_SPANS.encode())) .isEqualTo(ZIPKIN_SPAN); } @Test public void decodeListIsCompatible() { - assertThat(SpanBytesDecoder.PROTO3.decodeList(PROTO_SPANS.toByteArray())) + assertThat(SpanBytesDecoder.PROTO3.decodeList(PROTO_SPANS.encode())) .containsExactly(ZIPKIN_SPAN, ZIPKIN_SPAN); } - @Test public void encodeListIsCompatible_buff() throws Exception { - byte[] googleBytes = new byte[PROTO_SPANS.getSerializedSize()]; - CodedOutputStream out = CodedOutputStream.newInstance(googleBytes); - PROTO_SPANS.writeTo(out); + @Test public void encodeListIsCompatible_buff() { + byte[] wireBytes = PROTO_SPANS.encode(); + byte[] zipkin_buff = new byte[10 + wireBytes.length]; - byte[] zipkin_buff = new byte[10 + googleBytes.length]; assertThat(SpanBytesEncoder.PROTO3.encodeList(ZIPKIN_SPANS, zipkin_buff, 5)) - .isEqualTo(googleBytes.length); + .isEqualTo(wireBytes.length); assertThat(zipkin_buff) .startsWith(0, 0, 0, 0, 0) - .containsSequence(googleBytes) + .containsSequence(wireBytes) .endsWith(0, 0, 0, 0, 0); } - @Test public void encodeListIsCompatible() throws Exception { - byte[] googleBytes = new byte[PROTO_SPANS.getSerializedSize()]; - CodedOutputStream out = CodedOutputStream.newInstance(googleBytes); - PROTO_SPANS.writeTo(out); + @Test public void encodeListIsCompatible() { + byte[] wireBytes = PROTO_SPANS.encode(); assertThat(SpanBytesEncoder.PROTO3.encodeList(ZIPKIN_SPANS)) - .containsExactly(googleBytes); + .containsExactly(wireBytes); } - @Test public void span_sizeInBytes_matchesProto3() { + @Test public void span_sizeInBytes_matchesWire() { assertThat(SPAN.sizeInBytes(ZIPKIN_SPAN)) - .isEqualTo(computeMessageSize(SPAN.fieldNumber, PROTO_SPAN)); + .isEqualTo(Span.ADAPTER.encodedSizeWithTag(SPAN.fieldNumber, PROTO_SPAN)); } - @Test public void annotation_sizeInBytes_matchesProto3() { + @Test public void annotation_sizeInBytes_matchesWire() { zipkin2.Annotation zipkinAnnotation = ZIPKIN_SPAN.annotations().get(0); - assertThat(ANNOTATION.sizeInBytes(zipkinAnnotation)) - .isEqualTo(computeMessageSize(ANNOTATION.fieldNumber, PROTO_SPAN.getAnnotations(0))); + assertThat(ANNOTATION.sizeInBytes(zipkinAnnotation)).isEqualTo( + Annotation.ADAPTER.encodedSizeWithTag(ANNOTATION.fieldNumber, PROTO_SPAN.annotations.get(0)) + ); } - @Test public void annotation_write_matchesProto3() throws IOException { + @Test public void annotation_write_matchesWire() { zipkin2.Annotation zipkinAnnotation = ZIPKIN_SPAN.annotations().get(0); - Annotation protoAnnotation = PROTO_SPAN.getAnnotations(0); + Span wireSpan = new Span.Builder().annotations(PROTO_SPAN.annotations).build(); Buffer zipkinBytes = Buffer.allocate(ANNOTATION.sizeInBytes(zipkinAnnotation)); ANNOTATION.write(zipkinBytes, zipkinAnnotation); assertThat(zipkinBytes.toByteArray()) - .containsExactly(writeSpan(Span.newBuilder().addAnnotations(protoAnnotation).build())); + .containsExactly(wireSpan.encode()); } - @Test public void annotation_read_matchesProto3() throws IOException { + @Test public void annotation_read_matchesWireEncodingWithTag() { zipkin2.Annotation zipkinAnnotation = ZIPKIN_SPAN.annotations().get(0); - Annotation protoAnnotation = PROTO_SPAN.getAnnotations(0); + Span wireSpan = new Span.Builder().annotations(PROTO_SPAN.annotations).build(); - Buffer zipkinBytes = - Buffer.wrap(writeSpan(Span.newBuilder().addAnnotations(protoAnnotation).build()), 0); - assertThat(zipkinBytes.readVarint32()) + Buffer wireBytes = Buffer.wrap(wireSpan.encode(), 0); + assertThat(wireBytes.readVarint32()) .isEqualTo(ANNOTATION.key); zipkin2.Span.Builder builder = zipkinSpanBuilder(); - ANNOTATION.readLengthPrefixAndValue(zipkinBytes, builder); + ANNOTATION.readLengthPrefixAndValue(wireBytes, builder); assertThat(builder.build().annotations()) .containsExactly(zipkinAnnotation); } - @Test public void endpoint_sizeInBytes_matchesProto3() { - assertThat(LOCAL_ENDPOINT.sizeInBytes(ZIPKIN_SPAN.localEndpoint())) - .isEqualTo(computeMessageSize(LOCAL_ENDPOINT.fieldNumber, PROTO_SPAN.getLocalEndpoint())); + @Test public void endpoint_sizeInBytes_matchesWireEncodingWithTag() { + assertThat(LOCAL_ENDPOINT.sizeInBytes(ZIPKIN_SPAN.localEndpoint())).isEqualTo( + Endpoint.ADAPTER.encodedSizeWithTag(LOCAL_ENDPOINT.fieldNumber, PROTO_SPAN.local_endpoint) + ); - assertThat(REMOTE_ENDPOINT.sizeInBytes(ZIPKIN_SPAN.remoteEndpoint())) - .isEqualTo(computeMessageSize(REMOTE_ENDPOINT.fieldNumber, PROTO_SPAN.getRemoteEndpoint())); + assertThat(REMOTE_ENDPOINT.sizeInBytes(ZIPKIN_SPAN.remoteEndpoint())).isEqualTo( + Endpoint.ADAPTER.encodedSizeWithTag(REMOTE_ENDPOINT.fieldNumber, PROTO_SPAN.remote_endpoint) + ); } - @Test public void localEndpoint_write_matchesProto3() throws IOException { + @Test public void localEndpoint_write_matchesWire() { Buffer zipkinBytes = Buffer.allocate(LOCAL_ENDPOINT.sizeInBytes(ZIPKIN_SPAN.localEndpoint())); LOCAL_ENDPOINT.write(zipkinBytes, ZIPKIN_SPAN.localEndpoint()); + Span wireSpan = new Span.Builder().local_endpoint(PROTO_SPAN.local_endpoint).build(); assertThat(zipkinBytes.toByteArray()) - .containsExactly( - writeSpan(Span.newBuilder().setLocalEndpoint(PROTO_SPAN.getLocalEndpoint()).build())); + .containsExactly(wireSpan.encode()); } - @Test public void remoteEndpoint_write_matchesProto3() throws IOException { + @Test public void remoteEndpoint_write_matchesWire() { Buffer zipkinBytes = Buffer.allocate(REMOTE_ENDPOINT.sizeInBytes(ZIPKIN_SPAN.remoteEndpoint())); REMOTE_ENDPOINT.write(zipkinBytes, ZIPKIN_SPAN.remoteEndpoint()); + Span wireSpan = new Span.Builder().remote_endpoint(PROTO_SPAN.remote_endpoint).build(); assertThat(zipkinBytes.toByteArray()) - .containsExactly( - writeSpan(Span.newBuilder().setRemoteEndpoint(PROTO_SPAN.getRemoteEndpoint()).build())); - } - - @Test public void utf8_sizeInBytes_matchesProto3() { - assertThat(new Utf8Field(EndpointField.SERVICE_NAME_KEY).sizeInBytes(ORDER.serviceName())) - .isEqualTo(CodedOutputStream.computeStringSize(1, ORDER.serviceName())); + .containsExactly(wireSpan.encode()); } - @Test public void tag_sizeInBytes_matchesProto3() { + @Test public void tag_sizeInBytes_matchesWire() { MapEntry entry = entry("clnt/finagle.version", "6.45.0"); + Span wireSpan = new Span.Builder().tags(singletonMap(entry.key, entry.value)).build(); + assertThat(new TagField(TAG_KEY).sizeInBytes(entry)) - .isEqualTo(Span.newBuilder().putTags(entry.key, entry.value).build().getSerializedSize()); + .isEqualTo(Span.ADAPTER.encodedSize(wireSpan)); } - @Test public void writeTagField_matchesProto3() throws IOException { + @Test public void writeTagField_matchesWire() { MapEntry entry = entry("clnt/finagle.version", "6.45.0"); TagField field = new TagField(TAG_KEY); Buffer zipkinBytes = Buffer.allocate(field.sizeInBytes(entry)); field.write(zipkinBytes, entry); - Span oneField = Span.newBuilder().putTags(entry.key, entry.value).build(); - byte[] googleBytes = new byte[oneField.getSerializedSize()]; - CodedOutputStream out = CodedOutputStream.newInstance(googleBytes); - oneField.writeTo(out); - + Span oneField = new Span.Builder().tags(singletonMap(entry.key, entry.value)).build(); assertThat(zipkinBytes.toByteArray()) - .containsExactly(googleBytes); + .containsExactly(oneField.encode()); } - @Test public void writeTagField_matchesProto3_emptyValue() throws IOException { + @Test public void writeTagField_matchesWire_emptyValue() { MapEntry entry = entry("error", ""); TagField field = new TagField(TAG_KEY); Buffer zipkinBytes = Buffer.allocate(field.sizeInBytes(entry)); field.write(zipkinBytes, entry); - Span oneField = Span.newBuilder().putTags(entry.key, entry.value).build(); - byte[] googleBytes = new byte[oneField.getSerializedSize()]; - CodedOutputStream out = CodedOutputStream.newInstance(googleBytes); - oneField.writeTo(out); - + Span oneField = new Span.Builder().tags(singletonMap(entry.key, entry.value)).build(); assertThat(zipkinBytes.toByteArray()) - .containsExactly(googleBytes); - } - - static ByteString decodeHex(String s) { - return ByteString.copyFrom(BaseEncoding.base16().lowerCase().decode(s)); - } - - static byte[] writeSpan(Span span) throws IOException { - byte[] googleBytes = new byte[span.getSerializedSize()]; - span.writeTo(CodedOutputStream.newInstance(googleBytes)); - return googleBytes; + .containsExactly(oneField.encode()); } static zipkin2.Span.Builder zipkinSpanBuilder() { diff --git a/pom.xml b/pom.xml index f0a5b46ffe5..f94e16ddcb1 100755 --- a/pom.xml +++ b/pom.xml @@ -53,12 +53,13 @@ ${project.basedir} 0.84.0 - 1.19.0 - 3.7.0 - ${project.build.directory}/test/proto 27.0.1-jre + + 3.0.0-alpha01 + ${project.build.directory}/test/proto + 5.6.3 3.7.1 3.14.0 @@ -359,15 +360,16 @@ + io.zipkin.proto3 zipkin-proto3 0.1.0 - com.google.protobuf - protobuf-java - ${protobuf.version} + com.squareup.wire + wire-runtime + ${wire.version} @@ -387,13 +389,6 @@ - - - kr.motd.maven - os-maven-plugin - 1.6.2 - - @@ -519,11 +514,11 @@ - + maven-dependency-plugin - + unpack-proto generate-sources @@ -539,16 +534,23 @@ - org.xolstice.maven.plugins - protobuf-maven-plugin - 0.6.1 - - ${project.build.directory}/main/proto - ${project.build.directory}/test/proto - - com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} - - + com.squareup.wire + wire-maven-plugin + ${wire.version} + + + generate-sources + + generate-sources + + + ${unpack-proto.directory} + + zipkin.proto3.* + + + +