Skip to content

Commit

Permalink
deps: bumps to Brave 5.17.1 and moves off internal type
Browse files Browse the repository at this point in the history
This updates to Brave 5.17.1 and dodges an internal type that will not
be in Brave 6.0. See openzipkin/brave#1396 about
Propagation and Brave 6.0

Signed-off-by: Adrian Cole <adrian@tetrate.io>
  • Loading branch information
Adrian Cole committed Jan 7, 2024
1 parent 04dc4ee commit d3c80d1
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 36 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<spring-cloud-openfeign.version>3.1.10-SNAPSHOT</spring-cloud-openfeign.version>
<spring-cloud-task.version>2.4.6</spring-cloud-task.version>
<spring-cloud-deployer.version>2.5.1</spring-cloud-deployer.version>
<brave.version>5.13.9</brave.version>
<brave.version>5.17.1</brave.version>
<opentracing.version>0.32.0</opentracing.version>
<!-- Deprecated - reached EOL -->
<spring-security-boot-autoconfigure.version>2.3.4.RELEASE</spring-security-boot-autoconfigure.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,16 @@ public boolean requires128BitTraceId() {
return delegate.requires128BitTraceId();
}

/**
* @deprecated end users and instrumentation should never call this, and instead
* use {@link #get()}. This only remains to avoid rev-lock upgrading to Brave 6.
*/
@Deprecated
@Override
public <K> Propagation<K> create(Propagation.KeyFactory<K> ignored) {
throw new UnsupportedOperationException("As of Brave 5.12, call PropagationFactory.get()");
}

@Override
public Propagation<String> get() {
Propagation<String> propagation = delegate.get();
Expand All @@ -334,12 +344,6 @@ public TraceContext decorate(TraceContext context) {
return delegate.decorate(context);
}

@Override
public <K> Propagation<K> create(Propagation.KeyFactory<K> keyFactory) {
Propagation<K> propagation = delegate.create(keyFactory);
return delegateWithoutB3Baggage(factoryFromSupplier, propagation);
}

private <K> Propagation<K> delegateWithoutB3Baggage(Propagation.Factory factoryFromSupplier,
Propagation<K> propagation) {
return new Propagation<K>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.util.Map;

import brave.internal.codec.HexCodec;
import brave.internal.propagation.StringPropagationAdapter;
import brave.propagation.Propagation;
import brave.propagation.TraceContext;
import brave.propagation.TraceContextOrSamplingFlags;
Expand Down Expand Up @@ -158,9 +157,19 @@ public <R> TraceContext.Extractor<R> extractor(Getter<R, String> getter) {
.spanId(HexCodec.lowerHexToUnsignedLong(getter.get(request, "myCustomSpanId"))).build());
}

/**
* @deprecated end users and instrumentation should never call this, and instead use
* {@link #get()}. This only remains to avoid rev-lock upgrading to Brave 6.
*/
@Deprecated
@Override
public <K> Propagation<K> create(KeyFactory<K> keyFactory) {
return StringPropagationAdapter.create(this, keyFactory);
public <K> Propagation<K> create(KeyFactory<K> ignored) {
throw new UnsupportedOperationException("As of Brave 5.12, call PropagationFactory.get()");
}

@Override
public Propagation<String> get() {
return this;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.Collections;
import java.util.List;

import brave.internal.propagation.StringPropagationAdapter;
import brave.propagation.Propagation;
import brave.propagation.TraceContext;
import brave.propagation.TraceContextOrSamplingFlags;
Expand Down Expand Up @@ -93,9 +92,20 @@ public <R> TraceContext.Extractor<R> extractor(Getter<R, String> getter) {
return request -> TraceContextOrSamplingFlags.EMPTY;
}

/**
* @deprecated end users and instrumentation should never call this, and
* instead use {@link #get()}. This only remains to avoid rev-lock upgrading
* to Brave 6.
*/
@Deprecated
@Override
public <K> Propagation<K> create(KeyFactory<K> keyFactory) {
return StringPropagationAdapter.create(this, keyFactory);
public <K> Propagation<K> create(KeyFactory<K> ignored) {
throw new UnsupportedOperationException("As of Brave 5.12, call PropagationFactory.get()");
}

@Override
public Propagation<String> get() {
return this;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.util.Map;
import java.util.stream.Collectors;

import brave.internal.propagation.StringPropagationAdapter;
import brave.propagation.B3Propagation;
import brave.propagation.Propagation;
import brave.propagation.TraceContext;
Expand Down Expand Up @@ -128,9 +127,19 @@ public <R> TraceContext.Extractor<R> extractor(Getter<R, String> getter) {
};
}

/**
* @deprecated end users and instrumentation should never call this, and instead use
* {@link #get()}. This only remains to avoid rev-lock upgrading to Brave 6.
*/
@Deprecated
@Override
public <K> Propagation<K> create(KeyFactory<K> keyFactory) {
return StringPropagationAdapter.create(this, keyFactory);
public <K> Propagation<K> create(KeyFactory<K> ignored) {
throw new UnsupportedOperationException("As of Brave 5.12, call PropagationFactory.get()");
}

@Override
public Propagation<String> get() {
return this;
}

@Override
Expand Down Expand Up @@ -176,9 +185,19 @@ private Propagation.Factory propagationFactory() {
return this.propagationFactory;
}

/**
* @deprecated end users and instrumentation should never call this, and instead
* use {@link #get()}. This only remains to avoid rev-lock upgrading to Brave 6.
*/
@Deprecated
@Override
public <K> Propagation<K> create(KeyFactory<K> keyFactory) {
return propagationFactory().create(keyFactory);
public <K> Propagation<K> create(KeyFactory<K> ignored) {
throw new UnsupportedOperationException("As of Brave 5.12, call PropagationFactory.get()");
}

@Override
public Propagation<String> get() {
return new LazyPropagation(this);
}

@Override
Expand All @@ -191,11 +210,6 @@ public boolean requires128BitTraceId() {
return propagationFactory().requires128BitTraceId();
}

@Override
public Propagation<String> get() {
return new LazyPropagation(this);
}

@Override
public TraceContext decorate(TraceContext context) {
return propagationFactory().decorate(context);
Expand Down Expand Up @@ -259,9 +273,19 @@ public <R> TraceContext.Extractor<R> extractor(Getter<R, String> getter) {
return request -> TraceContextOrSamplingFlags.EMPTY;
}

/**
* @deprecated end users and instrumentation should never call this, and instead
* use {@link #get()}. This only remains to avoid rev-lock upgrading to Brave 6.
*/
@Deprecated
@Override
public <K> Propagation<K> create(KeyFactory<K> keyFactory) {
return StringPropagationAdapter.create(this, keyFactory);
public <K> Propagation<K> create(KeyFactory<K> ignored) {
throw new UnsupportedOperationException("As of Brave 5.12, call PropagationFactory.get()");
}

@Override
public Propagation<String> get() {
return this;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import brave.baggage.BaggagePropagation;
import brave.baggage.BaggagePropagationConfig;
import brave.internal.baggage.BaggageFields;
import brave.internal.propagation.StringPropagationAdapter;
import brave.propagation.Propagation;
import brave.propagation.TraceContext;
import brave.propagation.TraceContextOrSamplingFlags;
Expand Down Expand Up @@ -128,9 +127,19 @@ class W3CPropagation extends Propagation.Factory implements Propagation<String>
this.braveBaggageManager = braveBaggageManager;
}

/**
* @deprecated end users and instrumentation should never call this, and instead use
* {@link #get()}. This only remains to avoid rev-lock upgrading to Brave 6.
*/
@Deprecated
@Override
public <K> Propagation<K> create(KeyFactory<K> ignored) {
throw new UnsupportedOperationException("As of Brave 5.12, call PropagationFactory.get()");
}

@Override
public <K> Propagation<K> create(KeyFactory<K> keyFactory) {
return StringPropagationAdapter.create(this, keyFactory);
public Propagation<String> get() {
return this;
}

@Override
Expand Down Expand Up @@ -320,8 +329,19 @@ class W3CBaggagePropagator {

private BaggagePropagation.FactoryBuilder factory() {
return BaggagePropagation.newFactoryBuilder(new Propagation.Factory() {
/**
* @deprecated end users and instrumentation should never call this, and
* instead use {@link #get()}. This only remains to avoid rev-lock upgrading
* to Brave 6.
*/
@Deprecated
@Override
public <K> Propagation<K> create(Propagation.KeyFactory<K> ignored) {
throw new UnsupportedOperationException("As of Brave 5.12, call PropagationFactory.get()");
}

@Override
public <K> Propagation<K> create(Propagation.KeyFactory<K> keyFactory) {
public Propagation<String> get() {
return null;
}
});
Expand Down
4 changes: 2 additions & 2 deletions spring-cloud-sleuth-dependencies/.flattened-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@
<downloadUrl>https://github.com/spring-cloud</downloadUrl>
</distributionManagement>
<properties>
<brave.opentracing.version>0.37.4</brave.opentracing.version>
<brave.opentracing.version>1.0.1</brave.opentracing.version>
<grpc.spring.boot.version>4.2.2</grpc.spring.boot.version>
<brave.version>5.13.9</brave.version>
<brave.version>5.17.1</brave.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions spring-cloud-sleuth-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
</scm>

<properties>
<brave.version>5.13.11</brave.version>
<brave.opentracing.version>0.37.5</brave.opentracing.version>
<brave.version>5.17.1</brave.version>
<brave.opentracing.version>1.0.1</brave.opentracing.version>
<grpc.spring.boot.version>4.2.3</grpc.spring.boot.version>
</properties>
<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import brave.Span;
import brave.internal.collect.Lists;
import brave.internal.propagation.StringPropagationAdapter;
import brave.propagation.B3Propagation;
import brave.propagation.Propagation;
import brave.propagation.TraceContext;
Expand Down Expand Up @@ -51,9 +50,19 @@ public <R> TraceContext.Extractor<R> extractor(Getter<R, String> getter) {
return multi.extractor(getter);
}

/**
* @deprecated end users and instrumentation should never call this, and instead use
* {@link #get()}. This only remains to avoid rev-lock upgrading to Brave 6.
*/
@Deprecated
@Override
public <K> Propagation<K> create(KeyFactory<K> keyFactory) {
return StringPropagationAdapter.create(this, keyFactory);
public <K> Propagation<K> create(KeyFactory<K> ignored) {
throw new UnsupportedOperationException("As of Brave 5.12, call PropagationFactory.get()");
}

@Override
public Propagation<String> get() {
return this;
}

}

0 comments on commit d3c80d1

Please sign in to comment.