openzipkin / zipkin-gcp

Reporters and collectors for use in Google Cloud Platform
https://cloud.google.com/trace/docs/zipkin
Apache License 2.0
91 stars 54 forks source link

Adds Brave Encoding support for v2 #208

Closed codefromthecrypt closed 9 months ago

codefromthecrypt commented 9 months ago

This adds two new artifacts to allow StackdriverSender to have no zipkin dependency:

The main change is StackdriverEncoder.V2 is moved to a new package: zipkin2.reporter.stackdriver.zipkin, where it was formerly one level up. This is the part that decouples the classpath.

Most won't use this encoder anymore as you can use Brave directly like so:

spanHandler = AsyncZipkinSpanHandler.newBuilder(sender).build(new StackdriverV2Encoder(Tags.ERROR));
codefromthecrypt commented 9 months ago

FYI classes and tests for the brave encoder were ported from the translation module as abstracting was messier.

codefromthecrypt commented 9 months ago

benchmarks

Benchmark                                                                           Mode  Cnt    Score   Error  Units
TracesParserBenchmarks.parse100ClientSpans                                          avgt   15  136.369 ± 2.955  us/op
TracesParserBenchmarks.parseClientSpan                                              avgt   15    1.362 ± 0.026  us/op
brave.StackdriverV2EncoderBenchmarks.encodeClientSpan_json_stackdriver_proto3       avgt   15    0.778 ± 0.014  us/op
brave.StackdriverV2EncoderBenchmarks.encodeClientSpan_json_zipkin_json              avgt   15    0.464 ± 0.003  us/op
brave.StackdriverV2EncoderBenchmarks.sizeInBytesClientSpan_json_stackdriver_proto3  avgt   15    0.346 ± 0.003  us/op
brave.StackdriverV2EncoderBenchmarks.sizeInBytesClientSpan_json_zipkin_json         avgt   15    0.070 ± 0.001  us/op
zipkin.StackdriverEncoderBenchmarks.encodeClientSpan_json_stackdriver_proto3        avgt   15    0.672 ± 0.007  us/op
zipkin.StackdriverEncoderBenchmarks.encodeClientSpan_json_zipkin_json               avgt   15    0.409 ± 0.003  us/op
zipkin.StackdriverEncoderBenchmarks.sizeInBytesClientSpan_json_stackdriver_proto3   avgt   15    0.281 ± 0.002  us/op
zipkin.StackdriverEncoderBenchmarks.sizeInBytesClientSpan_json_zipkin_json          avgt   15    0.054 ± 0.001  us/op