Search in sources :

Example 1 with InboundWrapper

use of com.nr.agent.instrumentation.rabbitamqp500.InboundWrapper in project newrelic-java-agent by newrelic.

the class Consumer_Instrumentation method handleDelivery.

@Trace(dispatcher = true)
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
    RabbitAMQPMetricUtil.nameTransaction(envelope.getExchange());
    AgentBridge.getAgent().getTransaction().provideHeaders(new InboundWrapper(properties.getHeaders()));
    AgentBridge.getAgent().getTransaction(false).setTransportType(TransportType.AMQP);
    RabbitAMQPMetricUtil.addConsumeAttributes(null, envelope.getRoutingKey(), properties);
    Weaver.callOriginal();
}
Also used : InboundWrapper(com.nr.agent.instrumentation.rabbitamqp500.InboundWrapper) Trace(com.newrelic.api.agent.Trace)

Example 2 with InboundWrapper

use of com.nr.agent.instrumentation.rabbitamqp500.InboundWrapper in project newrelic-java-agent by newrelic.

the class HttpAsyncResponseConsumer_Instrumentation method responseReceived.

/**
 * Invoked when a HTTP response message is received.
 */
public void responseReceived(HttpResponse response) throws IOException, HttpException {
    inboundHeaders = new InboundWrapper(response);
    httpResponse = response;
    Weaver.callOriginal();
}
Also used : InboundWrapper(com.nr.agent.instrumentation.httpasyncclient4.InboundWrapper)

Example 3 with InboundWrapper

use of com.nr.agent.instrumentation.rabbitamqp500.InboundWrapper in project newrelic-java-agent by newrelic.

the class HttpClient method processResponse.

private static void processResponse(URI requestURI, HttpResponse response) {
    InboundWrapper inboundCatWrapper = new InboundWrapper(response);
    NewRelic.getAgent().getTracedMethod().reportAsExternal(HttpParameters.library(LIBRARY).uri(requestURI).procedure(PROCEDURE).inboundHeaders(inboundCatWrapper).status(response.getStatusLine().getStatusCode(), response.getStatusLine().getReasonPhrase()).build());
}
Also used : InboundWrapper(com.nr.agent.instrumentation.httpclient40.InboundWrapper)

Example 4 with InboundWrapper

use of com.nr.agent.instrumentation.rabbitamqp500.InboundWrapper in project newrelic-java-agent by newrelic.

the class HttpMethodBase method execute.

@Trace(leaf = true)
public int execute(HttpState state, HttpConnection conn) throws IOException {
    String host = null;
    String uri = null;
    TracedMethod method = AgentBridge.getAgent().getTracedMethod();
    Transaction tx = AgentBridge.getAgent().getTransaction();
    if (!checkForIgnoredSocketCall(method)) {
        // URI calculation logic migrated from old pointcut to maintain parity
        URI methodURI = getURI();
        String scheme = methodURI.getScheme();
        if (scheme == null) {
            scheme = conn.getProtocol().getScheme();
            host = conn.getHost();
            String path = methodURI.getPath();
            if ("null".equals(path)) {
                path = null;
            }
            uri = URISupport.getURI(scheme, host, conn.getPort(), path);
        } else {
            host = methodURI.getHost();
            uri = URISupport.getURI(methodURI.getScheme(), host, conn.getPort(), methodURI.getPath());
        }
        // Set cross process headers for this outbound request
        method.addOutboundRequestHeaders(new OutboundWrapper(this));
    }
    int responseCode = Weaver.callOriginal();
    if (!checkForIgnoredSocketCall(method) && uri != null) {
        try {
            InboundWrapper inboundHeaders = new InboundWrapper(this);
            java.net.URI netURI = java.net.URI.create(uri);
            method.reportAsExternal(HttpParameters.library(LIBRARY).uri(netURI).procedure("execute").inboundHeaders(inboundHeaders).status(responseCode, this.getStatusText()).build());
        } catch (Throwable e) {
            AgentBridge.getAgent().getLogger().log(Level.FINER, e, "Unable to reportAsExternal for execute()");
        }
    }
    return responseCode;
}
Also used : Transaction(com.newrelic.agent.bridge.Transaction) InboundWrapper(com.nr.agent.instrumentation.httpclient31.InboundWrapper) TracedMethod(com.newrelic.agent.bridge.TracedMethod) OutboundWrapper(com.nr.agent.instrumentation.httpclient31.OutboundWrapper) Trace(com.newrelic.api.agent.Trace)

Aggregations

Trace (com.newrelic.api.agent.Trace)2 TracedMethod (com.newrelic.agent.bridge.TracedMethod)1 Transaction (com.newrelic.agent.bridge.Transaction)1 InboundWrapper (com.nr.agent.instrumentation.httpasyncclient4.InboundWrapper)1 InboundWrapper (com.nr.agent.instrumentation.httpclient31.InboundWrapper)1 OutboundWrapper (com.nr.agent.instrumentation.httpclient31.OutboundWrapper)1 InboundWrapper (com.nr.agent.instrumentation.httpclient40.InboundWrapper)1 InboundWrapper (com.nr.agent.instrumentation.rabbitamqp500.InboundWrapper)1