use of io.vertx.core.spi.tracing.VertxTracer in project vert.x by eclipse.
the class Http2ServerRequest method onClose.
@Override
void onClose() {
VertxTracer tracer = context.tracer();
Object trace = this.trace;
if (tracer != null && trace != null) {
Throwable failure;
synchronized (conn) {
if (!streamEnded && (!ended || !response.ended())) {
failure = ConnectionBase.CLOSED_EXCEPTION;
} else {
failure = null;
}
}
tracer.sendResponse(context, failure == null ? response : null, trace, failure, HttpUtils.SERVER_RESPONSE_TAG_EXTRACTOR);
}
super.onClose();
}
use of io.vertx.core.spi.tracing.VertxTracer in project vert.x by eclipse.
the class ReplyHandler method trace.
private void trace(Object reply, Throwable failure) {
VertxTracer tracer = context.tracer();
Object trace = this.trace;
if (tracer != null && src && trace != null) {
tracer.receiveResponse(context, reply, trace, failure, TagExtractor.empty());
}
}
use of io.vertx.core.spi.tracing.VertxTracer in project vert.x by eclipse.
the class Http1xClientConnection method handleResponseEnd.
private void handleResponseEnd(Stream stream, LastHttpContent trailer) {
boolean check;
synchronized (this) {
if (stream.response == null) {
// 100-continue
return;
}
responses.pop();
close |= !options.isKeepAlive();
stream.responseEnded = true;
check = requests.peek() != stream;
}
VertxTracer tracer = context.tracer();
if (tracer != null) {
tracer.receiveResponse(stream.context, stream.response, stream.trace, null, HttpUtils.CLIENT_RESPONSE_TAG_EXTRACTOR);
}
if (metrics != null) {
metrics.responseEnd(stream.metric, stream.bytesRead);
}
flushBytesRead();
if (check) {
checkLifecycle();
}
lastResponseReceivedTimestamp = System.currentTimeMillis();
stream.context.execute(trailer, stream::handleEnd);
}
use of io.vertx.core.spi.tracing.VertxTracer in project vert.x by eclipse.
the class Http1xServerRequest method reportRequestBegin.
private void reportRequestBegin() {
HttpServerMetrics metrics = conn.metrics;
if (metrics != null) {
metric = metrics.requestBegin(conn.metric(), this);
}
VertxTracer tracer = context.tracer();
if (tracer != null) {
trace = tracer.receiveRequest(context, SpanKind.RPC, conn.tracingPolicy(), this, request.method().name(), request.headers(), HttpUtils.SERVER_REQUEST_TAG_EXTRACTOR);
}
}
use of io.vertx.core.spi.tracing.VertxTracer in project vert.x by eclipse.
the class VertxFactoryTest method testFactoryTracerFactoryOverridesOptions.
@Test
public void testFactoryTracerFactoryOverridesOptions() {
FakeTracer tracer = new FakeTracer();
TracingOptions tracingOptions = new TracingOptions().setFactory(new VertxTracerFactory() {
@Override
public VertxTracer tracer(TracingOptions options) {
throw new AssertionError();
}
});
VertxBuilder factory = new VertxBuilder(new VertxOptions().setTracingOptions(tracingOptions));
factory.tracer(tracer);
factory.init();
Vertx vertx = factory.vertx();
assertSame(tracer, ((VertxInternal) vertx).getOrCreateContext().tracer());
}
Aggregations