Search in sources :

Example 1 with CrossProcessNameFormat

use of com.newrelic.agent.tracers.CrossProcessNameFormat in project newrelic-java-agent by newrelic.

the class CrossProcessTransactionStateImpl method processResponseMetadata.

@Override
public void processResponseMetadata(String responseMetadata, URI uri) {
    if (tx.getAgentConfig().getDistributedTracingConfig().isEnabled()) {
        Agent.LOG.log(Level.FINEST, "Distributed tracing is enabled. Ignoring processResponseMetadata call.");
        return;
    }
    if (!tx.getCrossProcessConfig().isCrossApplicationTracing()) {
        return;
    }
    if (responseMetadata == null) {
        return;
    }
    Tracer lastTracer = tx.getTransactionActivity().getLastTracer();
    if (lastTracer == null) {
        return;
    }
    InboundHeaders NRHeaders = decodeMetadata(responseMetadata);
    if (NRHeaders != null) {
        /*
              One of our public APIs doesn't have a URI parameter, so we may not know the host or URI.

              See {@link com.newrelic.api.agent.Transaction#processResponseMetadata(String)}
             */
        String host = (uri == null || uri.getHost() == null) ? UNKNOWN_HOST : uri.getHost();
        String uriString = (uri == null) ? null : uri.toString();
        String decodedAppData = HeadersUtil.getAppDataHeader(NRHeaders);
        CrossProcessNameFormat crossProcessFormat = CrossProcessNameFormat.create(host, uriString, decodedAppData);
        doProcessInboundResponseHeaders(lastTracer, crossProcessFormat, host, true);
        MetricNames.recordApiSupportabilityMetric(MetricNames.SUPPORTABILITY_API_PROCESS_RESPONSE_METADATA);
    }
}
Also used : CrossProcessNameFormat(com.newrelic.agent.tracers.CrossProcessNameFormat) DefaultTracer(com.newrelic.agent.tracers.DefaultTracer) Tracer(com.newrelic.agent.tracers.Tracer) InboundHeaders(com.newrelic.api.agent.InboundHeaders)

Aggregations

CrossProcessNameFormat (com.newrelic.agent.tracers.CrossProcessNameFormat)1 DefaultTracer (com.newrelic.agent.tracers.DefaultTracer)1 Tracer (com.newrelic.agent.tracers.Tracer)1 InboundHeaders (com.newrelic.api.agent.InboundHeaders)1