Changed Zipkin API a bit, now requires a TraceContext rather than a Span before sync/async calls.
This commit is contained in:
parent
cbc246f1c0
commit
f008a33e53
5 changed files with 11 additions and 11 deletions
2
pom.xml
2
pom.xml
|
@ -5,7 +5,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.helenus</groupId>
|
||||
<artifactId>helenus-core</artifactId>
|
||||
<version>2.0.9-SNAPSHOT</version>
|
||||
<version>2.0.10-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>helenus</name>
|
||||
|
|
|
@ -53,7 +53,7 @@ public abstract class AbstractOptionalOperation<E, O extends AbstractOptionalOpe
|
|||
|
||||
public Optional<E> sync() {
|
||||
Tracer tracer = this.sessionOps.getZipkinTracer();
|
||||
final Span cassandraSpan = (tracer != null && span != null) ? tracer.newChild(span.context()) : null;
|
||||
final Span cassandraSpan = (tracer != null && traceContext != null) ? tracer.newChild(traceContext) : null;
|
||||
if (cassandraSpan != null) {
|
||||
cassandraSpan.name("cassandra");
|
||||
cassandraSpan.start();
|
||||
|
@ -71,7 +71,7 @@ public abstract class AbstractOptionalOperation<E, O extends AbstractOptionalOpe
|
|||
|
||||
public ListenableFuture<Optional<E>> async() {
|
||||
final Tracer tracer = this.sessionOps.getZipkinTracer();
|
||||
final Span cassandraSpan = (tracer != null && span != null) ? tracer.newChild(span.context()) : null;
|
||||
final Span cassandraSpan = (tracer != null && traceContext != null) ? tracer.newChild(traceContext) : null;
|
||||
if (cassandraSpan != null) {
|
||||
cassandraSpan.name("cassandra");
|
||||
cassandraSpan.start();
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
*/
|
||||
package net.helenus.core.operation;
|
||||
|
||||
import brave.Span;
|
||||
import brave.Tracer;
|
||||
import brave.propagation.TraceContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -44,7 +44,7 @@ public abstract class AbstractStatementOperation<E, O extends AbstractStatementO
|
|||
public abstract Statement buildStatement();
|
||||
|
||||
protected boolean showValues = true;
|
||||
protected Span span;
|
||||
protected TraceContext traceContext;
|
||||
private ConsistencyLevel consistencyLevel;
|
||||
private ConsistencyLevel serialConsistencyLevel;
|
||||
private RetryPolicy retryPolicy;
|
||||
|
@ -215,11 +215,11 @@ public abstract class AbstractStatementOperation<E, O extends AbstractStatementO
|
|||
return statement;
|
||||
}
|
||||
|
||||
public O withinSpan(Span span) {
|
||||
if (span != null) {
|
||||
public O zipkinContext(TraceContext traceContext) {
|
||||
if (traceContext != null) {
|
||||
Tracer tracer = this.sessionOps.getZipkinTracer();
|
||||
if (tracer != null) {
|
||||
this.span = span;
|
||||
this.traceContext = traceContext;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperati
|
|||
|
||||
public Stream<E> sync() {
|
||||
Tracer tracer = this.sessionOps.getZipkinTracer();
|
||||
final Span cassandraSpan = (tracer != null && span != null) ? tracer.newChild(span.context()) : null;
|
||||
final Span cassandraSpan = (tracer != null && traceContext != null) ? tracer.newChild(traceContext) : null;
|
||||
if (cassandraSpan != null) {
|
||||
cassandraSpan.name("cassandra");
|
||||
cassandraSpan.start();
|
||||
|
@ -72,7 +72,7 @@ public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperati
|
|||
|
||||
public ListenableFuture<Stream<E>> async() {
|
||||
Tracer tracer = this.sessionOps.getZipkinTracer();
|
||||
final Span cassandraSpan = (tracer != null && span != null) ? tracer.newChild(span.context()) : null;
|
||||
final Span cassandraSpan = (tracer != null && traceContext != null) ? tracer.newChild(traceContext) : null;
|
||||
if (cassandraSpan != null) {
|
||||
cassandraSpan.name("cassandra");
|
||||
cassandraSpan.start();
|
||||
|
|
|
@ -107,7 +107,7 @@ public class MapperInvocationHandler<E> implements InvocationHandler {
|
|||
|
||||
} else if (returnType.isEnum() && (value.getClass() == Integer.class || value.getClass() == int.class)) {
|
||||
try {
|
||||
value = returnType.getClass().getEnumConstants()[(int) value];
|
||||
value = Class.forName(returnType.getName()).getEnumConstants()[(Integer) value];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
throw new IllegalArgumentException("invalid ordinal " + value + " for enum type " + returnType.getSimpleName());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue