Skip to content

Commit

Permalink
Removes all deprecated things (Brave v5) (#708)
Browse files Browse the repository at this point in the history
  • Loading branch information
adriancole authored May 22, 2018
1 parent 95b53b7 commit 9d98d56
Show file tree
Hide file tree
Showing 79 changed files with 122 additions and 2,151 deletions.
11 changes: 0 additions & 11 deletions brave/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@
<groupId>io.zipkin.zipkin2</groupId>
<artifactId>zipkin</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.zipkin.reporter</groupId>
<artifactId>zipkin-reporter</artifactId>
<version>1.1.2</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter</artifactId>
Expand Down
2 changes: 0 additions & 2 deletions brave/src/it/nozipkin1/README.md

This file was deleted.

62 changes: 0 additions & 62 deletions brave/src/it/nozipkin1/pom.xml

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions brave/src/main/java/brave/Clock.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package brave;

/**
* Epoch microseconds used for {@link zipkin.Span#timestamp} and {@link
* zipkin.Annotation#timestamp}.
* Epoch microseconds used for {@link zipkin2.Span#timestamp} and {@link
* zipkin2.Annotation#timestamp}.
*
* <p>This should use the most precise value possible. For example, {@code gettimeofday} or
* multiplying {@link System#currentTimeMillis} by 1000.
Expand Down
5 changes: 0 additions & 5 deletions brave/src/main/java/brave/CurrentSpanCustomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,4 @@ public static CurrentSpanCustomizer create(Tracing tracing) {
@Override public SpanCustomizer annotate(String value) {
return tracer.currentSpanCustomizer().annotate(value);
}

/** @deprecated use {@link #annotate(String)} as this can result in clock skew */
@Deprecated @Override public SpanCustomizer annotate(long timestamp, String value) {
return tracer.currentSpanCustomizer().annotate(timestamp, value);
}
}
5 changes: 0 additions & 5 deletions brave/src/main/java/brave/NoopSpanCustomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,4 @@ public enum NoopSpanCustomizer implements SpanCustomizer {
@Override public SpanCustomizer annotate(String value) {
return this;
}

/** @deprecated use {@link #annotate(String)} as this can result in clock skew */
@Deprecated @Override public SpanCustomizer annotate(long timestamp, String value) {
return this;
}
}
6 changes: 0 additions & 6 deletions brave/src/main/java/brave/RealSpanCustomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ static RealSpanCustomizer create(TraceContext context, Recorder recorder) {
return this;
}

/** @deprecated use {@link #annotate(String)} as this can result in clock skew */
@Override @Deprecated public SpanCustomizer annotate(long timestamp, String value) {
recorder().annotate(context(), timestamp, value);
return this;
}

@Override public SpanCustomizer tag(String key, String value) {
recorder().tag(context(), key, value);
return this;
Expand Down
15 changes: 3 additions & 12 deletions brave/src/main/java/brave/Span.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
// Design note: this does not require a builder as the span is mutable anyway. Having a single
// mutation interface is less code to maintain. Those looking to prepare a span before starting it
// can simply call start when they are ready.
// BRAVE5: do not inherit SpanCustomizer, rather just return it. This will prevent accidentally
// BRAVE6: do not inherit SpanCustomizer, rather just return it. This will prevent accidentally
// leaking lifecycle methods
public abstract class Span implements SpanCustomizer {
public enum Kind {
Expand Down Expand Up @@ -102,7 +102,7 @@ public enum Kind {
* <p>Take extreme care with this feature as it is easy to have incorrect timestamps. If you must
* use this, generate the timestamp using {@link Tracing#clock(TraceContext)}.
*/
@Override public abstract Span annotate(long timestamp, String value);
public abstract Span annotate(long timestamp, String value);

/** {@inheritDoc} */
@Override public abstract Span tag(String key, String value);
Expand All @@ -112,15 +112,6 @@ public enum Kind {
// multi-catch. In practice, you should always at least catch RuntimeException and Error.
public abstract Span error(Throwable throwable);

/**
* @deprecated use {@link #remoteEndpoint(Endpoint)}, possibly with {@link zipkin.Endpoint#toV2()}
*/
@Deprecated
public final Span remoteEndpoint(zipkin.Endpoint endpoint) {
if (isNoop()) return this;
return remoteEndpoint(endpoint.toV2());
}

/**
* For a client span, this would be the server's address.
*
Expand All @@ -137,7 +128,7 @@ public final Span remoteEndpoint(zipkin.Endpoint endpoint) {
/**
* Like {@link #finish()}, except with a given timestamp in microseconds.
*
* <p>{@link zipkin.Span#duration Zipkin's span duration} is derived by subtracting the start
* <p>{@link zipkin2.Span#duration Zipkin's span duration} is derived by subtracting the start
* timestamp from this, and set when appropriate.
*
* <p>Take extreme care with this feature as it is easy to have incorrect timestamps. If you must
Expand Down
9 changes: 2 additions & 7 deletions brave/src/main/java/brave/SpanCustomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/
// Note: this is exposed to users. We cannot add methods to this until Java 8 is required or we do a
// major version bump
// BRAVE5: add isNoop to avoid instanceof checks
// BRAVE5: add error to support error handling
// BRAVE6: add isNoop to avoid instanceof checks
// BRAVE6: add error to support error handling
public interface SpanCustomizer {
/**
* Sets the string name for the logical operation this span represents.
Expand All @@ -43,9 +43,4 @@ public interface SpanCustomizer {
* @param value A short tag indicating the event, like "finagle.retry"
*/
SpanCustomizer annotate(String value);

/** @deprecated use {@link #annotate(String)} as this can result in clock skew */
// BRAVE5: remove this: backdating ops should only be available on Span, as it isn't reasonable
// for those only having a reference to SpanCustomizer to have a correct clock for the trace.
@Deprecated SpanCustomizer annotate(long timestamp, String value);
}
94 changes: 1 addition & 93 deletions brave/src/main/java/brave/Tracer.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import zipkin2.Endpoint;
import zipkin2.reporter.Reporter;

/**
Expand Down Expand Up @@ -60,87 +59,6 @@
* @see Propagation
*/
public class Tracer {
/** @deprecated Please use {@link Tracing#newBuilder()} */
@Deprecated public static Builder newBuilder() {
return new Builder();
}

/** @deprecated Please use {@link Tracing.Builder} */
@Deprecated public static final class Builder {
final Tracing.Builder delegate = new Tracing.Builder();

/** @see Tracing.Builder#localServiceName(String) */
public Builder localServiceName(String localServiceName) {
delegate.localServiceName(localServiceName);
return this;
}

/** @deprecated use {@link #endpoint(Endpoint)}, possibly with {@link zipkin.Endpoint#toV2()} */
@Deprecated
public Builder localEndpoint(zipkin.Endpoint localEndpoint) {
return endpoint(localEndpoint.toV2());
}

/** @deprecated use {@link #endpoint(Endpoint)} */
@Deprecated
public Builder localEndpoint(Endpoint localEndpoint) {
delegate.endpoint(localEndpoint);
return this;
}

/** @see Tracing.Builder#endpoint(Endpoint) */
public Builder endpoint(Endpoint endpoint) {
delegate.endpoint(endpoint);
return this;
}

/** @deprecated use {@link #spanReporter(Reporter)} */
@Deprecated
public Builder reporter(zipkin.reporter.Reporter<zipkin.Span> reporter) {
delegate.reporter(reporter);
return this;
}

/** @see Tracing.Builder#spanReporter(Reporter) */
public Builder spanReporter(Reporter<zipkin2.Span> reporter) {
delegate.spanReporter(reporter);
return this;
}

/** @see Tracing.Builder#clock(Clock) */
public Builder clock(Clock clock) {
delegate.clock(clock);
return this;
}

/** @see Tracing.Builder#sampler(Sampler) */
public Builder sampler(Sampler sampler) {
delegate.sampler(sampler);
return this;
}

/** @see Tracing.Builder#currentTraceContext(CurrentTraceContext) */
public Builder currentTraceContext(CurrentTraceContext currentTraceContext) {
delegate.currentTraceContext(currentTraceContext);
return this;
}

/** @see Tracing.Builder#traceId128Bit(boolean) */
public Builder traceId128Bit(boolean traceId128Bit) {
delegate.traceId128Bit(traceId128Bit);
return this;
}

/** @see Tracing.Builder#supportsJoin(boolean) */
public Builder supportsJoin(boolean supportsJoin) {
delegate.supportsJoin(supportsJoin);
return this;
}

public Tracer build() {
return delegate.build().tracer();
}
}

final Clock clock;
final Propagation.Factory propagationFactory;
Expand Down Expand Up @@ -204,11 +122,6 @@ public Tracer withSampler(Sampler sampler) {
);
}

/** @deprecated use {@link Tracing#clock(TraceContext)} */
@Deprecated public Clock clock() {
return clock;
}

/**
* Explicitly creates a new trace. The result will be a root span (no parent span ID).
*
Expand Down Expand Up @@ -329,11 +242,6 @@ public Span nextSpan(TraceContextOrSamplingFlags extracted) {
throw new AssertionError("should not reach here");
}

/** @deprecated Prefer {@link #withSampler(Sampler)} */
@Deprecated public Span newTrace(SamplingFlags samplingFlags) {
return toSpan(newContextBuilder(null, samplingFlags).build());
}

/** Converts the context as-is to a Span object */
public Span toSpan(TraceContext context) {
if (context == null) throw new NullPointerException("context == null");
Expand Down Expand Up @@ -397,7 +305,7 @@ public SpanInScope withSpanInScope(@Nullable Span span) {
*
* <p>Unlike {@link CurrentSpanCustomizer}, this represents a single span. Accordingly, this
* reference should not be saved as a field. That said, it is more efficient to save this result
* as a method-local variable vs repeated calls to {@link #currentSpanCustomizer()}.
* as a method-local variable vs repeated calls.
*/
public SpanCustomizer currentSpanCustomizer() {
TraceContext currentContext = currentTraceContext.get();
Expand Down
Loading

0 comments on commit 9d98d56

Please sign in to comment.