Skip to content

Commit

Permalink
Bump opentracing libraries to latest versions
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed May 31, 2019
1 parent 337a033 commit 7797d1e
Show file tree
Hide file tree
Showing 31 changed files with 72 additions and 53 deletions.
24 changes: 12 additions & 12 deletions .idea/libraries/opentracing.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion java/client/src/org/openqa/selenium/remote/tracing/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ java_library(
"//third_party/java/opentracing:opentracing-api",
],
deps = [
"//java/client/src/org/openqa/selenium/remote:remote",
"//java/client/src/org/openqa/selenium/remote/http:http",
"//third_party/java/contrib:opentracing-tracerresolver",
"//third_party/java/guava:guava",
"//third_party/java/opentracing:opentracing-noop",
"//third_party/java/opentracing:opentracing-util",
],
visibility = [
"//java/client/src/org/openqa/selenium/remote:",
"//java/client/test/org/openqa/selenium/remote/tracing:",
"//java/server/src/org/openqa/selenium/grid/...",
"//java/server/test/org/openqa/selenium/grid/...",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class OpenTracingSpan implements Span {

@Override
public Span activate() {
tracer.scopeManager().activate(span, false);
tracer.scopeManager().activate(span);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
import io.opentracing.SpanContext;
import io.opentracing.Tracer;
import io.opentracing.propagation.Format;
import io.opentracing.propagation.TextMapExtractAdapter;
import io.opentracing.propagation.TextMapAdapter;

import java.util.Map;
import java.util.Objects;
import java.util.StringJoiner;
import java.util.function.Function;

class OpenTracingTracer implements DistributedTracer {
Expand All @@ -43,7 +42,7 @@ public Span createSpan(String operation, Span parent) {
}

io.opentracing.Span span = delegate.buildSpan(operation).asChildOf(context).start();
delegate.scopeManager().activate(span, false);
delegate.scopeManager().activate(span);
OpenTracingSpan toReturn = new OpenTracingSpan(delegate, span);
toReturn.activate();
return toReturn;
Expand All @@ -58,10 +57,10 @@ public <C> Span createSpan(

SpanContext context = delegate.extract(
Format.Builtin.HTTP_HEADERS,
new TextMapExtractAdapter(map));
new TextMapAdapter(map));

io.opentracing.Span span = delegate.buildSpan(operationName).asChildOf(context).start();
delegate.scopeManager().activate(span, false);
delegate.scopeManager().activate(span);
OpenTracingSpan toReturn = new OpenTracingSpan(delegate, span);
toReturn.activate();
return toReturn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import io.opentracing.Span;
import io.opentracing.SpanContext;
import io.opentracing.tag.Tag;

import java.util.AbstractMap;
import java.util.HashMap;
Expand Down Expand Up @@ -54,6 +55,11 @@ public Span setTag(String key, Number value) {
return setTag(key, (Object) value);
}

@Override
public <T> Span setTag(Tag<T> tag, T value) {
return setTag(tag.getKey(), value);
}

private Span setTag(String key, Object value) {
if (key == null || value == null) {
return this;
Expand Down Expand Up @@ -128,6 +134,19 @@ public void finish(long finishMicros) {

private class Context implements SpanContext {

private final String traceId = UUID.randomUUID().toString();
private final String spanId = UUID.randomUUID().toString();

@Override
public String toTraceId() {
return traceId;
}

@Override
public String toSpanId() {
return spanId;
}

@Override
public Iterable<Map.Entry<String, String>> baggageItems() {
return ImmutableSet.<Map.Entry<String, String>>builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

import static io.opentracing.References.CHILD_OF;

import io.opentracing.Scope;
import io.opentracing.ScopeManager;
import io.opentracing.Span;
import io.opentracing.SpanContext;
import io.opentracing.Tracer;
import io.opentracing.tag.Tag;

import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -83,6 +83,11 @@ public Tracer.SpanBuilder withTag(String key, Number value) {
return withTag(key, (Object) value);
}

@Override
public <T> Tracer.SpanBuilder withTag(Tag<T> tag, T value) {
return withTag(tag.getKey(), value);
}

private Tracer.SpanBuilder withTag(String key, Object value) {
if (key == null || value == null) {
return this;
Expand All @@ -99,16 +104,6 @@ public Tracer.SpanBuilder withStartTimestamp(long microseconds) {
return this;
}

@Override
public Scope startActive(boolean finishSpanOnClose) {
return scopeManager.activate(start(), finishSpanOnClose);
}

@Override
public Span startManual() {
return start();
}

@Override
public Span start() {
return new SimpleSpan().setOperationName(operationName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@ public ScopeManager scopeManager() {

@Override
public Span activeSpan() {
Scope scope = scopeManager().active();
return scope == null ? null : scope.span();
return scopeManager().activeSpan();
}

@Override
public Scope activateSpan(Span span) {
return scopeManager().activate(span);
}

@Override
Expand Down Expand Up @@ -85,4 +89,8 @@ public <C> SpanContext extract(Format<C> format, C carrier) {

return span.context();
}

@Override
public void close() {
}
}
21 changes: 9 additions & 12 deletions third_party/java/contrib/BUCK
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
prebuilt_jar(
name = "opentracing-concurrent",
maven_coords = "io.opentracing.contrib:opentracing-concurrent:jar:0.1.0",
binary_jar = "opentracing-concurrent-0.1.0.jar",
source_jar = "opentracing-concurrent-0.1.0-sources.jar",
maven_coords = "io.opentracing.contrib:opentracing-concurrent:jar:0.4.0",
binary_jar = "opentracing-concurrent-0.4.0.jar",
source_jar = "opentracing-concurrent-0.4.0-sources.jar",
deps = [
"//third_party/java/opentracing:opentracing-api",
"//third_party/java/opentracing:opentracing-noop",
Expand All @@ -11,25 +11,22 @@ prebuilt_jar(

prebuilt_jar(
name = "opentracing-okhttp3",
maven_coords = "io.opentracing.contrib:opentracing-okhttp3:jar:0.1.0",
binary_jar = "opentracing-okhttp3-0.1.0.jar",
source_jar = "opentracing-okhttp3-0.1.0-sources.jar",
maven_coords = "io.opentracing.contrib:opentracing-okhttp3:jar:2.0.1",
binary_jar = "opentracing-okhttp3-2.0.1.jar",
source_jar = "opentracing-okhttp3-2.0.1-sources.jar",
deps = [
":opentracing-concurrent",
"//third_party/java/okhttp3:okhttp",
"//third_party/java/opentracing:opentracing-api",
"//third_party/java/opentracing:opentracing-noop",
],
)

prebuilt_jar(
name = "opentracing-tracerresolver",
maven_coords = "io.opentracing.contrib:opentracing-tracerresolver:jar:0.1.5",
binary_jar = "opentracing-tracerresolver-0.1.5.jar",
source_jar = "opentracing-tracerresolver-0.1.5-sources.jar",
maven_coords = "io.opentracing.contrib:opentracing-tracerresolver:jar:0.1.7",
binary_jar = "opentracing-tracerresolver-0.1.7.jar",
source_jar = "opentracing-tracerresolver-0.1.7-sources.jar",
deps = [
"//third_party/java/opentracing:opentracing-api",
"//third_party/java/opentracing:opentracing-util",
],
visibility = [
"//java/client/src/org/openqa/selenium/remote/tracing:",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
18 changes: 9 additions & 9 deletions third_party/java/opentracing/BUCK
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
prebuilt_jar(
name = "opentracing-api",
maven_coords = "io.opentracing:opentracing-api:jar:0.31.0",
binary_jar = "opentracing-api-0.31.0.jar",
source_jar = "opentracing-api-0.31.0-sources.jar",
maven_coords = "io.opentracing:opentracing-api:0.33.0",
binary_jar = "opentracing-api-0.33.0.jar",
source_jar = "opentracing-api-0.33.0-sources.jar",
visibility = [
"//third_party/java/contrib:",
"//java/client/src/org/openqa/selenium/remote/tracing:",
Expand All @@ -11,9 +11,9 @@ prebuilt_jar(

prebuilt_jar(
name = "opentracing-noop",
maven_coords = "io.opentracing:opentracing-noop:jar:0.31.0",
binary_jar = "opentracing-noop-0.31.0.jar",
source_jar = "opentracing-noop-0.31.0-sources.jar",
maven_coords = "io.opentracing:opentracing-noop:0.33.0",
binary_jar = "opentracing-noop-0.33.0.jar",
source_jar = "opentracing-noop-0.33.0-sources.jar",
deps = [
":opentracing-api",
],
Expand All @@ -26,9 +26,9 @@ prebuilt_jar(

prebuilt_jar(
name = "opentracing-util",
maven_coords = "io.opentracing:opentracing-util:jar:0.31.0",
binary_jar = "opentracing-util-0.31.0.jar",
source_jar = "opentracing-util-0.31.0-sources.jar",
maven_coords = "io.opentracing:opentracing-util:0.33.0",
binary_jar = "opentracing-util-0.33.0.jar",
source_jar = "opentracing-util-0.33.0-sources.jar",
deps = [
":opentracing-api",
":opentracing-noop",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 7797d1e

Please sign in to comment.