Skip to content

Commit

Permalink
Deprecate CAT (#465)
Browse files Browse the repository at this point in the history
* Deprecating TracedMethod.addOutboundRequestHeaders
* Disabling CAT by default
  • Loading branch information
meiao authored Oct 11, 2021
1 parent dfbc7cb commit 1530a7a
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ protected void doStart() {
getLogger().warning(msg);
}

boolean isCrossApplicationTracing = localAgentConfig.getCrossProcessConfig().isCrossApplicationTracing();
if (isCrossApplicationTracing) {
String msg = "Distributed tracing is replacing cross application tracing as the default means of tracing between services. " +
"To continue using cross application tracing, enable it with cross_application_tracer.enabled=true and distributed_tracing.enabled=false. ";
getLogger().info(msg);
}

localAgentConfig.logDeprecatedProperties(fileSettings);

ServiceFactory.getHarvestService().addHarvestListener(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public final class CrossProcessConfigImpl extends BaseConfig implements CrossPro
public static final String ENCODING_KEY = "encoding_key";
public static final String TRUSTED_ACCOUNT_IDS = "trusted_account_ids";
public static final String APPLICATION_ID = "application_id";
public static final boolean DEFAULT_ENABLED = true;
public static final boolean DEFAULT_ENABLED = false;
public static final String SYSTEM_PROPERTY_ROOT = "newrelic.config.cross_application_tracer.";

private final boolean isCrossApplicationTracing;
Expand Down
11 changes: 8 additions & 3 deletions newrelic-agent/src/main/resources/newrelic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,16 @@ common: &default_settings
# Cross Application Tracing adds request and response headers to
# external calls using supported HTTP libraries to provide better
# performance data when calling applications monitored by other New Relic Agents.
#
# Distributed tracing is replacing cross application tracing as the default
# means of tracing between services. To continue using cross application
# tracing, enable it with `cross_application_tracer.enabled = true` and
# `distributed_tracing.enabled = false`
cross_application_tracer:

# Set to false to disable cross application tracing.
# Default is true.
enabled: true
# Set to true to enable cross application tracing.
# Default is false.
enabled: false

# Thread profiler measures wall clock time, CPU time, and method call counts
# in your application's threads as they run.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private String makeYmlFilePath(String fileName) {

@Test
public void testConfig1() throws Exception {
testConfig(makeYmlFilePath("newrelic.yml"), true, true);
testConfig(makeYmlFilePath("newrelic.yml"), false, true);
}

@Test
Expand All @@ -140,7 +140,7 @@ public void testConfig4() throws Exception {

@Test
public void testConfig5() throws Exception {
testConfig(makeYmlFilePath("newrelicWithCrossAppTracingNotSpecified.yml"), true, true);
testConfig(makeYmlFilePath("newrelicWithCrossAppTracingNotSpecified.yml"), false, true);
}

// The "expected value" arguments are all about the newrelic.yml. We're not varying the collector JSON here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,16 @@ public void serverSideOverride() throws Exception {
@Test
public void crossProcess() throws Exception {
Map<String, Object> localSettings = createMap();
Map<String, Object> catSettings = createMap();
Map<String, Object> serverData = createMap();

// cat must be enabled for the other properties to be returned
catSettings.put(CrossProcessConfigImpl.ENABLED, true);
localSettings.put(AgentConfigImpl.CROSS_APPLICATION_TRACER, catSettings);

List<String> trustedIds = new ArrayList<>();
trustedIds.add("12345");
serverData.put(CrossProcessConfigImpl.CROSS_APPLICATION_TRACING, false); // deprecated setting
serverData.put(CrossProcessConfigImpl.CROSS_APPLICATION_TRACING, false); // deprecated setting is ignored when coming from the server
serverData.put(CrossProcessConfigImpl.CROSS_PROCESS_ID, "1234#5678");
serverData.put(CrossProcessConfigImpl.TRUSTED_ACCOUNT_IDS, trustedIds);
serverData.put(CrossProcessConfigImpl.ENCODING_KEY, "test");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ public void trustedIds() throws Exception {
@Test
public void encodingKey() throws Exception {
Map<String, Object> serverSettings = new HashMap<>();

// CAT must be enabled, or the encoding key will be null
serverSettings.put(CrossProcessConfigImpl.ENABLED, true);

String encodingKey = "test";
ServerProp serverProp = ServerProp.createPropObject(encodingKey);
serverSettings.put(CrossProcessConfigImpl.ENCODING_KEY, serverProp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ common: &default_settings

wait_for_rpm_connect: false

cross_application_tracer:
enabled: true

# activemerchant instrumentation: only report dollar amounts (business data)
# if the following is present and true; otherwise, only response times
# and throughput to the gateway are reported
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ common: &default_settings

wait_for_rpm_connect: false

cross_application_tracer:
enabled: true

# activemerchant instrumentation: only report dollar amounts (business data)
# if the following is present and true; otherwise, only response times
# and throughput to the gateway are reported
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ public interface TracedMethod extends AttributeHolder {
* @param outboundHeaders The headers that will be written to the output stream for the external request. This also
* determines if the external call is HTTP or JMS.
* @since 3.36.0
* @deprecated Instead, use the Distributed Tracing API {@link Transaction#insertDistributedTraceHeaders(Headers)} to create a
* distributed tracing payload
*/
@Deprecated
void addOutboundRequestHeaders(OutboundHeaders outboundHeaders);

}

0 comments on commit 1530a7a

Please sign in to comment.