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);
}
}
Aggregations