Search in sources :

Example 1 with ResponseWrapper

use of com.agent.instrumentation.akka.http.ResponseWrapper in project newrelic-java-agent by newrelic.

the class AkkaHttpMarshallerMapper method apply.

@Override
@Trace(async = true)
public HttpResponse apply(HttpResponse httpResponse) {
    try {
        if (token != null) {
            token.linkAndExpire();
        }
        ResponseWrapper responseWrapper = new ResponseWrapper(httpResponse);
        Transaction transaction = NewRelic.getAgent().getTransaction();
        transaction.setWebResponse(responseWrapper);
        transaction.addOutboundResponseHeaders();
        transaction.markResponseSent();
        return responseWrapper.response();
    } catch (Throwable t) {
        AgentBridge.instrumentation.noticeInstrumentationError(t, Weaver.getImplementationTitle());
        return httpResponse;
    }
}
Also used : Transaction(com.newrelic.api.agent.Transaction) ResponseWrapper(com.agent.instrumentation.akka.http.ResponseWrapper) Trace(com.newrelic.api.agent.Trace)

Aggregations

ResponseWrapper (com.agent.instrumentation.akka.http.ResponseWrapper)1 Trace (com.newrelic.api.agent.Trace)1 Transaction (com.newrelic.api.agent.Transaction)1