Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds zipkin.internal.Span2 #1669

Merged
merged 1 commit into from
Jul 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions benchmarks/src/main/java/zipkin/benchmarks/SpanBenchmarks.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import zipkin.Endpoint;
import zipkin.Span;
import zipkin.TraceKeys;
import zipkin.internal.Span2;
import zipkin.internal.Util;

@Measurement(iterations = 5, time = 1)
Expand All @@ -50,9 +51,11 @@ public class SpanBenchmarks {
Endpoint.builder().serviceName("app").ipv4(172 << 24 | 17 << 16 | 2).port(8080).build();

final Span.Builder sharedBuilder;
final Span2.Builder shared2Builder;

public SpanBenchmarks() {
sharedBuilder = buildClientOnlySpan(Span.builder()).toBuilder();
shared2Builder = buildClientOnlySpan2().toBuilder();
}

@Benchmark
Expand Down Expand Up @@ -104,6 +107,39 @@ public Span buildClientOnlySpan_clear() {
return buildClientOnlySpan(sharedBuilder.clear());
}

@Benchmark
public Span2 buildClientOnlySpan2() {
return buildClientOnlySpan2(Span2.builder());
}

static Span2 buildClientOnlySpan2(Span2.Builder builder) {
return builder
.traceId(traceId)
.parentId(traceId)
.id(spanId)
.name("get")
.kind(Span2.Kind.CLIENT)
.localEndpoint(frontend)
.remoteEndpoint(backend)
.timestamp(1472470996199000L)
.duration(207000L)
.addAnnotation(1472470996238000L, Constants.WIRE_SEND)
.addAnnotation(1472470996403000L, Constants.WIRE_RECV)
.putTag(TraceKeys.HTTP_PATH, "/api")
.putTag("clnt/finagle.version", "6.45.0")
.build();
}

@Benchmark
public Span2 buildClientOnlySpan2_clear() {
return buildClientOnlySpan2(shared2Builder.clear());
}

@Benchmark
public Span2 buildClientOnlySpan2_clone() {
return shared2Builder.clone().build();
}

@Benchmark
public Span buildRpcSpan() {
return Span.builder() // web calls app
Expand Down
6 changes: 6 additions & 0 deletions zipkin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
</properties>

<dependencies>
<dependency>
<groupId>com.google.auto.value</groupId>
<artifactId>auto-value</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
Expand Down
Loading