com.github.kristofa.brave.AbstractSpanCollector Maven / Gradle / Ivy
package com.github.kristofa.brave;
import com.twitter.zipkin.gen.Span;
import com.twitter.zipkin.gen.SpanCodec;
import java.io.IOException;
import java.util.List;
/**
* Implemented {@link #sendSpans} to transport a encoded list of spans to Zipkin.
*
* @deprecated replaced by {@link zipkin.reporter.AsyncReporter}
*/
@Deprecated
public abstract class AbstractSpanCollector extends FlushingSpanCollector {
private final SpanCodec codec;
/**
* @param flushInterval in seconds. 0 implies spans are {@link #flush() flushed externally.
*/
public AbstractSpanCollector(SpanCodec codec, SpanCollectorMetricsHandler metrics,
int flushInterval) {
super(metrics, flushInterval);
this.codec = codec;
}
@Override
protected void reportSpans(List drained) throws IOException {
byte[] encoded = codec.writeSpans(drained);
sendSpans(encoded);
}
/**
* Sends a encoded list of spans over the current transport.
*
* @throws IOException when thrown, drop metrics will increment accordingly
*/
protected abstract void sendSpans(byte[] encoded) throws IOException;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy