use of io.perfmark.TaskCloseable in project zuul by Netflix.
the class BaseZuulFilterRunner method invokeNextStage.
protected final void invokeNextStage(final O zuulMesg, final HttpContent chunk) {
if (nextStage != null) {
try (TaskCloseable ignored = traceTask(this, s -> s.getClass().getSimpleName() + ".invokeNextStageChunk")) {
addPerfMarkTags(zuulMesg);
nextStage.filter(zuulMesg, chunk);
}
} else {
// Next stage is Netty channel handler
try (TaskCloseable ignored = traceTask(this, s -> s.getClass().getSimpleName() + ".fireChannelReadChunk")) {
addPerfMarkTags(zuulMesg);
getChannelHandlerContext(zuulMesg).fireChannelRead(chunk);
}
}
}
use of io.perfmark.TaskCloseable in project zuul by Netflix.
the class ZuulEndPointRunner method filter.
@Override
public void filter(final HttpRequestMessage zuulReq) {
if (zuulReq.getContext().isCancelled()) {
PerfMark.event(getClass().getName(), "filterCancelled");
zuulReq.disposeBufferedBody();
logger.debug("Request was cancelled, UUID {}", zuulReq.getContext().getUUID());
return;
}
final String endpointName = getEndPointName(zuulReq.getContext());
try (TaskCloseable ignored = PerfMark.traceTask(this, s -> s.getClass().getSimpleName() + ".filter")) {
Preconditions.checkNotNull(zuulReq, "input message");
addPerfMarkTags(zuulReq);
final ZuulFilter<HttpRequestMessage, HttpResponseMessage> endpoint = getEndpoint(endpointName, zuulReq);
logger.debug("Got endpoint {}, UUID {}", endpoint.filterName(), zuulReq.getContext().getUUID());
setEndpoint(zuulReq, endpoint);
final HttpResponseMessage zuulResp = filter(endpoint, zuulReq);
if ((zuulResp != null) && (!(endpoint instanceof ProxyEndpoint))) {
// EdgeProxyEndpoint calls invokeNextStage internally
logger.debug("Endpoint calling invokeNextStage, UUID {}", zuulReq.getContext().getUUID());
invokeNextStage(zuulResp);
}
} catch (Exception ex) {
handleException(zuulReq, endpointName, ex);
}
}
use of io.perfmark.TaskCloseable in project zuul by Netflix.
the class ZuulFilterChainRunner method resume.
@Override
protected void resume(final T inMesg) {
try (TaskCloseable ignored = PerfMark.traceTask(this, s -> s.getClass().getSimpleName() + ".resume")) {
final AtomicInteger runningFilterIdx = getRunningFilterIndex(inMesg);
runningFilterIdx.incrementAndGet();
runFilters(inMesg, runningFilterIdx);
}
}
use of io.perfmark.TaskCloseable in project zuul by Netflix.
the class ZuulFilterChainRunner method filter.
@Override
public void filter(final T inMesg) {
try (TaskCloseable ignored = PerfMark.traceTask(this, s -> s.getClass().getSimpleName() + ".filter")) {
addPerfMarkTags(inMesg);
runFilters(inMesg, initRunningFilterIndex(inMesg));
}
}
use of io.perfmark.TaskCloseable in project zuul by Netflix.
the class ClientRequestReceiver method write.
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
try (TaskCloseable ignored = PerfMark.traceTask("CRR.write")) {
if (msg instanceof HttpResponse) {
promise.addListener((future) -> {
if (!future.isSuccess()) {
fireWriteError("response headers", future.cause(), ctx);
}
});
super.write(ctx, msg, promise);
} else if (msg instanceof HttpContent) {
promise.addListener((future) -> {
if (!future.isSuccess()) {
fireWriteError("response content", future.cause(), ctx);
}
});
super.write(ctx, msg, promise);
} else {
// should never happen
ReferenceCountUtil.release(msg);
throw new ZuulException("Attempt to write invalid content type to client: " + msg.getClass().getSimpleName(), true);
}
}
}
Aggregations