Skip to content

Commit

Permalink
Removes all deprecated types and modules for Brave v6
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Cole <[email protected]>
  • Loading branch information
Adrian Cole committed Jan 7, 2024
1 parent 169b575 commit 1556440
Show file tree
Hide file tree
Showing 348 changed files with 653 additions and 19,159 deletions.
28 changes: 1 addition & 27 deletions brave-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
<main.basedir>${project.basedir}/..</main.basedir>

<!-- use the same values in ../pom.xml -->
<zipkin.version>2.27.0</zipkin.version>
<zipkin-reporter.version>2.17.2</zipkin-reporter.version>
<zipkin-reporter.version>3.0.0</zipkin-reporter.version>
</properties>

<organization>
Expand Down Expand Up @@ -92,11 +91,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.zipkin.zipkin2</groupId>
<artifactId>zipkin</artifactId>
<version>${zipkin.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>brave</artifactId>
Expand Down Expand Up @@ -127,11 +121,6 @@
<artifactId>brave-context-slf4j</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>brave-context-rxjava2</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>brave-instrumentation-benchmarks</artifactId>
Expand All @@ -142,11 +131,6 @@
<artifactId>brave-instrumentation-dubbo</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>brave-instrumentation-dubbo-rpc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>brave-instrumentation-grpc</artifactId>
Expand Down Expand Up @@ -252,11 +236,6 @@
<artifactId>brave-instrumentation-okhttp3</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>brave-instrumentation-p6spy</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>brave-instrumentation-rpc</artifactId>
Expand All @@ -272,11 +251,6 @@
<artifactId>brave-instrumentation-servlet-jakarta</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>brave-instrumentation-sparkjava</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>brave-instrumentation-spring-rabbit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2023 The OpenZipkin Authors
* Copyright 2013-2024 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand Down Expand Up @@ -311,7 +311,7 @@ protected void is_inheritable(CurrentTraceContext inheritableCurrentTraceContext
}

@Test void restoresSpanAfterCallable() throws Exception {
try (Scope scope0 = currentTraceContext.newScope(context)) {
try (Scope scope = currentTraceContext.newScope(context)) {
attachesSpanInCallable();
assertThat(currentTraceContext.get())
.isEqualTo(context);
Expand Down Expand Up @@ -341,7 +341,7 @@ protected void is_inheritable(CurrentTraceContext inheritableCurrentTraceContext
@Test void restoresSpanAfterRunnable() throws Exception {
TraceContext context0 = TraceContext.newBuilder().traceId(3L).spanId(3L).build();

try (Scope scope0 = currentTraceContext.newScope(context0)) {
try (Scope scope = currentTraceContext.newScope(context0)) {
attachesSpanInRunnable();
assertThat(currentTraceContext.get())
.isEqualTo(context0);
Expand All @@ -366,7 +366,7 @@ static class Unused extends ClassLoaders.ConsumerRunnable<CurrentTraceContext.Bu
static class ClosedScope extends ClassLoaders.ConsumerRunnable<CurrentTraceContext.Builder> {
@Override public void accept(CurrentTraceContext.Builder builder) {
CurrentTraceContext current = builder.build();
try (Scope ws = current.newScope(TraceContext.newBuilder().traceId(1L).spanId(2L).build())) {
try (Scope scope = current.newScope(TraceContext.newBuilder().traceId(1L).spanId(2L).build())) {
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2023 The OpenZipkin Authors
* Copyright 2013-2024 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2023 The OpenZipkin Authors
* Copyright 2013-2024 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand All @@ -13,8 +13,8 @@
*/
package brave.test.propagation;

import brave.internal.codec.HexCodec;
import brave.internal.Nullable;
import brave.internal.codec.HexCodec;
import brave.propagation.Propagation;
import brave.propagation.Propagation.Getter;
import brave.propagation.Propagation.Setter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2020 The OpenZipkin Authors
* Copyright 2013-2024 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand All @@ -18,8 +18,6 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BiConsumer;
import org.assertj.core.api.AbstractThrowableAssert;
import org.assertj.core.api.ObjectAssert;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down Expand Up @@ -104,31 +102,6 @@ public void onError(Throwable throwable) {
throw new AssertionError("unexpected state");
}

// TODO: not actually used as we don't need to verify http status code or otherwise yet
public ObjectAssert<V> assertThatSuccess() {
return assertThat(join());
}

// TODO: not actually used as we have no async error tests, yet
public AbstractThrowableAssert<?, ? extends Throwable> assertThatError() {
awaitUninterruptably();

if (onErrorCount.get() > 0) {
assertThat(onErrorCount)
.withFailMessage("onError signaled multiple times")
.hasValueLessThan(2);

assertThat(onSuccessCount)
.withFailMessage("Both onSuccess and onError were signaled")
.hasValue(0);

return assertThat(result == NULL_SENTINEL ? null : (Throwable) result);
} else if (onSuccessCount.get() > 0) {
throw new AssertionError("expected onError, but received onSuccess(" + result + ")");
}
throw new AssertionError(); // unexpected as we only have two callbacks to handle!
}

void awaitUninterruptably() {
try {
await(3, TimeUnit.SECONDS);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2023 The OpenZipkin Authors
* Copyright 2013-2024 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand Down

This file was deleted.

6 changes: 3 additions & 3 deletions brave/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ When you need more features, or finer control, use the `Span` type:
// Start a new trace or a span within an existing trace representing an operation
Span span = tracer.nextSpan().name("encode").start();
// Put the span in "scope" so that downstream code such as loggers can see trace IDs
try (SpanInScope ws = tracer.withSpanInScope(span)) {
try (SpanInScope scope = tracer.withSpanInScope(span)) {
return encoder.encode();
} catch (RuntimeException | Error e) {
span.error(e); // Unless you handle exceptions, you might not know the operation failed!
Expand Down Expand Up @@ -192,7 +192,7 @@ tracing.propagation().injector(ClientRequestWrapper::addHeader)
span.kind(request.spanKind());
span.name("Report");
span.start();
try (Scope ws = currentTraceContext.newScope(span.context())) { // 2.
try (Scope scope = currentTraceContext.newScope(span.context())) { // 2.
return invoke(request); // 3.
} catch (Throwable e) {
span.error(error); // 4.
Expand Down Expand Up @@ -721,7 +721,7 @@ external code might be invoked (such as proceeding an interceptor or
otherwise), place the span in scope like this.

```java
try (SpanInScope ws = tracer.withSpanInScope(span)) {
try (SpanInScope scope = tracer.withSpanInScope(span)) {
return inboundRequest.invoke();
} catch (RuntimeException | Error e) {
span.error(e);
Expand Down
13 changes: 0 additions & 13 deletions brave/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,6 @@
</properties>

<dependencies>
<!-- Intentionally pinned so that we can move off Tracing.Builder.spanReporter
Once zipkin-reporter-brave is out a while, we can un-pin it. -->
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
<version>${zipkin-reporter.version}</version>
</dependency>
<dependency>
<groupId>io.zipkin.zipkin2</groupId>
<artifactId>zipkin</artifactId>
<version>${zipkin.version}</version>
</dependency>

<!-- To show off SpanHandler -->
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
Loading

0 comments on commit 1556440

Please sign in to comment.