Search in sources :

Example 1 with VertxTracer

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();
}
Also used : VertxTracer(io.vertx.core.spi.tracing.VertxTracer)

Example 2 with VertxTracer

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());
    }
}
Also used : VertxTracer(io.vertx.core.spi.tracing.VertxTracer)

Example 3 with VertxTracer

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);
}
Also used : VertxTracer(io.vertx.core.spi.tracing.VertxTracer)

Example 4 with VertxTracer

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);
    }
}
Also used : VertxTracer(io.vertx.core.spi.tracing.VertxTracer) HttpServerMetrics(io.vertx.core.spi.metrics.HttpServerMetrics)

Example 5 with VertxTracer

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());
}
Also used : VertxTracer(io.vertx.core.spi.tracing.VertxTracer) FakeTracer(io.vertx.test.faketracer.FakeTracer) TracingOptions(io.vertx.core.tracing.TracingOptions) VertxTracerFactory(io.vertx.core.spi.VertxTracerFactory) Vertx(io.vertx.core.Vertx) VertxOptions(io.vertx.core.VertxOptions) Test(org.junit.Test)

Aggregations

VertxTracer (io.vertx.core.spi.tracing.VertxTracer)12 io.vertx.core (io.vertx.core)2 Logger (io.vertx.core.impl.logging.Logger)2 LoggerFactory (io.vertx.core.impl.logging.LoggerFactory)2 HttpClientMetrics (io.vertx.core.spi.metrics.HttpClientMetrics)2 WriteStream (io.vertx.core.streams.WriteStream)2 ByteBuf (io.netty.buffer.ByteBuf)1 Unpooled (io.netty.buffer.Unpooled)1 io.netty.channel (io.netty.channel)1 DecoderResult (io.netty.handler.codec.DecoderResult)1 ZlibCodecFactory (io.netty.handler.codec.compression.ZlibCodecFactory)1 io.netty.handler.codec.http (io.netty.handler.codec.http)1 HttpHeaders (io.netty.handler.codec.http.HttpHeaders)1 io.netty.handler.codec.http.websocketx (io.netty.handler.codec.http.websocketx)1 WebSocketFrame (io.netty.handler.codec.http.websocketx.WebSocketFrame)1 V00 (io.netty.handler.codec.http.websocketx.WebSocketVersion.V00)1 V07 (io.netty.handler.codec.http.websocketx.WebSocketVersion.V07)1 V08 (io.netty.handler.codec.http.websocketx.WebSocketVersion.V08)1 V13 (io.netty.handler.codec.http.websocketx.WebSocketVersion.V13)1 WebSocketClientExtensionHandler (io.netty.handler.codec.http.websocketx.extensions.WebSocketClientExtensionHandler)1