Skip to content

Commit 9bbb3fc

Browse files
authored
Merge pull request #3333 from newrelic/remove_cat
Force Disable CAT
2 parents 9f4b007 + 437dd7c commit 9bbb3fc

File tree

16 files changed

+5
-1381
lines changed

16 files changed

+5
-1381
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
Support for Ruby versions 2.4 and 2.5 has been removed. The new minimum required Ruby version is now 2.6. [PR#3314](https://github.com/newrelic/newrelic-ruby-agent/pull/3314)
88

9+
- **Breaking Change: Removal of Cross Application Tracing (CAT)**
10+
11+
Previously, Cross Application Tracing (CAT) was deprecated in favor of Distributed Tracing. CAT functionality has now been removed. The configuration option `cross_application_tracer.enabled` has been removed. Public API methods `NewRelic::Agent::External.process_request_metadata`, `NewRelic::Agent::External.get_response_metadata`, `NewRelic::Agent::Transaction::ExternalRequestSegment#process_response_metadata`, and `NewRelic::Agent::Transaction::ExternalRequestSegment#get_request_metadata` have also been removed. [PR#3333](https://github.com/newrelic/newrelic-ruby-agent/pull/3333)
12+
913
- **Feature: Add `logger` as a dependency**
1014
The `logger` gem is now listed as a dependency of the agent to ensure continued logging functionality and support for Ruby 4.0.0 and newer versions. [PR#3293](https://github.com/newrelic/newrelic-ruby-agent/pull/3293)
1115

lib/new_relic/agent.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ module Agent
5555
require 'new_relic/agent/rules_engine'
5656
require 'new_relic/agent/http_clients/uri_util'
5757
require 'new_relic/agent/system_info'
58-
require 'new_relic/agent/external'
5958
require 'new_relic/agent/deprecator'
6059
require 'new_relic/agent/logging'
6160
require 'new_relic/agent/distributed_tracing'

lib/new_relic/agent/configuration/default_source.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,18 +1127,6 @@ def self.enforce_fallback(allowed_values: nil, fallback: nil)
11271127
:description => "If `true`, the agent will report source code level metrics for traced methods.\n\tSee: " \
11281128
'https://docs.newrelic.com/docs/apm/agents/ruby-agent/features/ruby-codestream-integration/'
11291129
},
1130-
# Cross application tracer
1131-
:"cross_application_tracer.enabled" => {
1132-
:default => false,
1133-
:public => true,
1134-
:type => Boolean,
1135-
:allowed_from_server => true,
1136-
:deprecated => true,
1137-
:description => deprecated_description(
1138-
:'distributed_tracing.enabled',
1139-
' If `true`, enables [cross-application tracing](/docs/agents/ruby-agent/features/cross-application-tracing-ruby/) when `distributed_tracing.enabled` is set to `false`.'
1140-
)
1141-
},
11421130
# Custom attributes
11431131
:'custom_attributes.enabled' => {
11441132
:default => true,

lib/new_relic/agent/distributed_tracing/cross_app_tracing.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ def valid_encoding_key?
164164
end
165165

166166
def cross_application_tracer_enabled?
167-
!NewRelic::Agent.config[:"distributed_tracing.enabled"] &&
168-
NewRelic::Agent.config[:"cross_application_tracer.enabled"]
167+
false
169168
end
170169

171170
def obfuscator

lib/new_relic/agent/external.rb

Lines changed: 0 additions & 112 deletions
This file was deleted.

lib/new_relic/agent/transaction/external_request_segment.rb

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -106,77 +106,6 @@ def cross_process_transaction_name # :nodoc:
106106
@app_data && @app_data[1]
107107
end
108108

109-
# Obtain an obfuscated +String+ suitable for delivery across public networks that identifies this application
110-
# and transaction to another application which is also running a New Relic agent. This +String+ can be processed
111-
# by +process_request_metadata+ on the receiving application.
112-
#
113-
# @return [String] obfuscated request metadata to send
114-
#
115-
# @api public
116-
#
117-
def get_request_metadata
118-
NewRelic::Agent.record_api_supportability_metric(:get_request_metadata)
119-
return unless CrossAppTracing.cross_app_enabled?
120-
121-
if transaction
122-
123-
# build hash of CAT metadata
124-
#
125-
rmd = {
126-
NewRelicID: NewRelic::Agent.config[:cross_process_id],
127-
NewRelicTransaction: [
128-
transaction.guid,
129-
false,
130-
transaction.distributed_tracer.cat_trip_id,
131-
transaction.distributed_tracer.cat_path_hash
132-
]
133-
}
134-
135-
# flag cross app in the state so transaction knows to add bits to payload
136-
#
137-
transaction.distributed_tracer.is_cross_app_caller = true
138-
139-
# add Synthetics header if we have it
140-
#
141-
rmd[:NewRelicSynthetics] = transaction.raw_synthetics_header if transaction.raw_synthetics_header
142-
143-
# obfuscate the generated request metadata JSON
144-
#
145-
obfuscator.obfuscate(::JSON.dump(rmd))
146-
147-
end
148-
rescue => e
149-
NewRelic::Agent.logger.error('error during get_request_metadata', e)
150-
end
151-
152-
# Process obfuscated +String+ sent from a called application that is also running a New Relic agent and
153-
# save information in current transaction for inclusion in a trace. This +String+ is generated by
154-
# +get_response_metadata+ on the receiving application.
155-
#
156-
# @param response_metadata [String] received obfuscated response metadata
157-
#
158-
# @api public
159-
#
160-
def process_response_metadata(response_metadata)
161-
NewRelic::Agent.record_api_supportability_metric(:process_response_metadata)
162-
if transaction
163-
app_data = ::JSON.parse(obfuscator.deobfuscate(response_metadata))[APP_DATA_KEY]
164-
165-
# validate cross app id
166-
#
167-
if Array === app_data and CrossAppTracing.trusted_valid_cross_app_id?(app_data[0])
168-
@app_data = app_data
169-
update_segment_name
170-
else
171-
NewRelic::Agent.logger.error('error processing response metadata: invalid/non-trusted ID')
172-
end
173-
end
174-
175-
nil
176-
rescue => e
177-
NewRelic::Agent.logger.error('error during process_response_metadata', e)
178-
end
179-
180109
def record_metrics
181110
add_unscoped_metrics
182111
super

lib/new_relic/supportability_helper.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ module SupportabilityHelper
2323
:disable_all_tracing,
2424
:disable_sql_recording,
2525
:drop_buffered_data,
26-
:get_request_metadata,
27-
:get_response_metadata,
2826
:get_transaction_name,
2927
:ignore_apdex,
3028
:ignore_enduser,
@@ -39,8 +37,6 @@ module SupportabilityHelper
3937
:notice_sql,
4038
:notice_statement,
4139
:perform_action_with_newrelic_trace,
42-
:process_request_metadata,
43-
:process_response_metadata,
4440
:record_custom_event,
4541
:record_metric,
4642
:record_llm_feedback_event,

test/multiverse/suites/agent_only/cross_application_tracing_test.rb

Lines changed: 0 additions & 104 deletions
This file was deleted.

test/multiverse/suites/rails/request_statistics_test.rb

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -94,36 +94,6 @@ def test_request_should_include_guid_if_cross_app
9494
end
9595
end
9696

97-
def test_request_should_include_referring_guid_if_needed
98-
with_config(:'cross_application_tracer.enabled' => true,
99-
:'distributed_tracing.enabled' => false,
100-
:'analytics_events.enabled' => true,
101-
:'cross_process_id' => 'boo',
102-
:'encoding_key' => "\0",
103-
:'trusted_account_ids' => [1]) do
104-
rack_env = {
105-
'HTTP_X_NEWRELIC_ID' => NewRelic::Base64.encode64('1#234'),
106-
'HTTP_X_NEWRELIC_TRANSACTION' => NewRelic::Base64.encode64('["8badf00d",1]')
107-
}
108-
109-
get('/request_stats/cross_app_action', headers: rack_env)
110-
111-
NewRelic::Agent.agent.send(:harvest_and_send_analytic_event_data)
112-
113-
post = $collector.calls_for('analytic_event_data').first
114-
115-
refute_nil(post)
116-
assert_kind_of Array, post.events
117-
assert_kind_of Array, post.events.first
118-
119-
sample = post.events.first.first
120-
121-
assert_kind_of Hash, sample
122-
assert_kind_of String, sample['nr.guid']
123-
assert_equal('8badf00d', sample['nr.referringTransactionGuid'])
124-
end
125-
end
126-
12797
def test_custom_params_should_be_reported_with_events_and_coerced_to_safe_types
12898
with_config(:'analytics_events.enabled' => true) do
12999
5.times { get('/request_stats/stats_action_with_custom_params') }

0 commit comments

Comments
 (0)