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
2ebae2aaef
3 changed files with 9 additions and 9 deletions
|
@ -53,7 +53,7 @@ public abstract class AbstractOptionalOperation<E, O extends AbstractOptionalOpe
|
||||||
|
|
||||||
public Optional<E> sync() {
|
public Optional<E> sync() {
|
||||||
Tracer tracer = this.sessionOps.getZipkinTracer();
|
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) {
|
if (cassandraSpan != null) {
|
||||||
cassandraSpan.name("cassandra");
|
cassandraSpan.name("cassandra");
|
||||||
cassandraSpan.start();
|
cassandraSpan.start();
|
||||||
|
@ -71,7 +71,7 @@ public abstract class AbstractOptionalOperation<E, O extends AbstractOptionalOpe
|
||||||
|
|
||||||
public ListenableFuture<Optional<E>> async() {
|
public ListenableFuture<Optional<E>> async() {
|
||||||
final Tracer tracer = this.sessionOps.getZipkinTracer();
|
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) {
|
if (cassandraSpan != null) {
|
||||||
cassandraSpan.name("cassandra");
|
cassandraSpan.name("cassandra");
|
||||||
cassandraSpan.start();
|
cassandraSpan.start();
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package net.helenus.core.operation;
|
package net.helenus.core.operation;
|
||||||
|
|
||||||
import brave.Span;
|
|
||||||
import brave.Tracer;
|
import brave.Tracer;
|
||||||
|
import brave.propagation.TraceContext;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public abstract class AbstractStatementOperation<E, O extends AbstractStatementO
|
||||||
public abstract Statement buildStatement();
|
public abstract Statement buildStatement();
|
||||||
|
|
||||||
protected boolean showValues = true;
|
protected boolean showValues = true;
|
||||||
protected Span span;
|
protected TraceContext traceContext;
|
||||||
private ConsistencyLevel consistencyLevel;
|
private ConsistencyLevel consistencyLevel;
|
||||||
private ConsistencyLevel serialConsistencyLevel;
|
private ConsistencyLevel serialConsistencyLevel;
|
||||||
private RetryPolicy retryPolicy;
|
private RetryPolicy retryPolicy;
|
||||||
|
@ -215,11 +215,11 @@ public abstract class AbstractStatementOperation<E, O extends AbstractStatementO
|
||||||
return statement;
|
return statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public O withinSpan(Span span) {
|
public O zipkinContext(TraceContext traceContext) {
|
||||||
if (span != null) {
|
if (traceContext != null) {
|
||||||
Tracer tracer = this.sessionOps.getZipkinTracer();
|
Tracer tracer = this.sessionOps.getZipkinTracer();
|
||||||
if (tracer != null) {
|
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() {
|
public Stream<E> sync() {
|
||||||
Tracer tracer = this.sessionOps.getZipkinTracer();
|
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) {
|
if (cassandraSpan != null) {
|
||||||
cassandraSpan.name("cassandra");
|
cassandraSpan.name("cassandra");
|
||||||
cassandraSpan.start();
|
cassandraSpan.start();
|
||||||
|
@ -72,7 +72,7 @@ public abstract class AbstractStreamOperation<E, O extends AbstractStreamOperati
|
||||||
|
|
||||||
public ListenableFuture<Stream<E>> async() {
|
public ListenableFuture<Stream<E>> async() {
|
||||||
Tracer tracer = this.sessionOps.getZipkinTracer();
|
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) {
|
if (cassandraSpan != null) {
|
||||||
cassandraSpan.name("cassandra");
|
cassandraSpan.name("cassandra");
|
||||||
cassandraSpan.start();
|
cassandraSpan.start();
|
||||||
|
|
Loading…
Reference in a new issue