Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

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)

- **Breaking Change: Removal of Cross Application Tracing (CAT)**

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)

- **Feature: Add `logger` as a dependency**
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)

Expand Down
1 change: 0 additions & 1 deletion lib/new_relic/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ module Agent
require 'new_relic/agent/rules_engine'
require 'new_relic/agent/http_clients/uri_util'
require 'new_relic/agent/system_info'
require 'new_relic/agent/external'
require 'new_relic/agent/deprecator'
require 'new_relic/agent/logging'
require 'new_relic/agent/distributed_tracing'
Expand Down
12 changes: 0 additions & 12 deletions lib/new_relic/agent/configuration/default_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1127,18 +1127,6 @@ def self.enforce_fallback(allowed_values: nil, fallback: nil)
:description => "If `true`, the agent will report source code level metrics for traced methods.\n\tSee: " \
'https://docs.newrelic.com/docs/apm/agents/ruby-agent/features/ruby-codestream-integration/'
},
# Cross application tracer
:"cross_application_tracer.enabled" => {
:default => false,
:public => true,
:type => Boolean,
:allowed_from_server => true,
:deprecated => true,
:description => deprecated_description(
:'distributed_tracing.enabled',
' If `true`, enables [cross-application tracing](/docs/agents/ruby-agent/features/cross-application-tracing-ruby/) when `distributed_tracing.enabled` is set to `false`.'
)
},
# Custom attributes
:'custom_attributes.enabled' => {
:default => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ def valid_encoding_key?
end

def cross_application_tracer_enabled?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do the other methods in this module give us if a customer can't enable CAT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we won't be keeping these long term, but I'm not ripping out everything in this PR, just force disabling CAT and removing publicly documented api methods.

!NewRelic::Agent.config[:"distributed_tracing.enabled"] &&
NewRelic::Agent.config[:"cross_application_tracer.enabled"]
false
end

def obfuscator
Expand Down
112 changes: 0 additions & 112 deletions lib/new_relic/agent/external.rb

This file was deleted.

71 changes: 0 additions & 71 deletions lib/new_relic/agent/transaction/external_request_segment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,77 +106,6 @@ def cross_process_transaction_name # :nodoc:
@app_data && @app_data[1]
end

# Obtain an obfuscated +String+ suitable for delivery across public networks that identifies this application
# and transaction to another application which is also running a New Relic agent. This +String+ can be processed
# by +process_request_metadata+ on the receiving application.
#
# @return [String] obfuscated request metadata to send
#
# @api public
#
def get_request_metadata
NewRelic::Agent.record_api_supportability_metric(:get_request_metadata)
return unless CrossAppTracing.cross_app_enabled?

if transaction

# build hash of CAT metadata
#
rmd = {
NewRelicID: NewRelic::Agent.config[:cross_process_id],
NewRelicTransaction: [
transaction.guid,
false,
transaction.distributed_tracer.cat_trip_id,
transaction.distributed_tracer.cat_path_hash
]
}

# flag cross app in the state so transaction knows to add bits to payload
#
transaction.distributed_tracer.is_cross_app_caller = true

# add Synthetics header if we have it
#
rmd[:NewRelicSynthetics] = transaction.raw_synthetics_header if transaction.raw_synthetics_header

# obfuscate the generated request metadata JSON
#
obfuscator.obfuscate(::JSON.dump(rmd))

end
rescue => e
NewRelic::Agent.logger.error('error during get_request_metadata', e)
end

# Process obfuscated +String+ sent from a called application that is also running a New Relic agent and
# save information in current transaction for inclusion in a trace. This +String+ is generated by
# +get_response_metadata+ on the receiving application.
#
# @param response_metadata [String] received obfuscated response metadata
#
# @api public
#
def process_response_metadata(response_metadata)
NewRelic::Agent.record_api_supportability_metric(:process_response_metadata)
if transaction
app_data = ::JSON.parse(obfuscator.deobfuscate(response_metadata))[APP_DATA_KEY]

# validate cross app id
#
if Array === app_data and CrossAppTracing.trusted_valid_cross_app_id?(app_data[0])
@app_data = app_data
update_segment_name
else
NewRelic::Agent.logger.error('error processing response metadata: invalid/non-trusted ID')
end
end

nil
rescue => e
NewRelic::Agent.logger.error('error during process_response_metadata', e)
end

def record_metrics
add_unscoped_metrics
super
Expand Down
4 changes: 0 additions & 4 deletions lib/new_relic/supportability_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ module SupportabilityHelper
:disable_all_tracing,
:disable_sql_recording,
:drop_buffered_data,
:get_request_metadata,
:get_response_metadata,
:get_transaction_name,
:ignore_apdex,
:ignore_enduser,
Expand All @@ -39,8 +37,6 @@ module SupportabilityHelper
:notice_sql,
:notice_statement,
:perform_action_with_newrelic_trace,
:process_request_metadata,
:process_response_metadata,
:record_custom_event,
:record_metric,
:record_llm_feedback_event,
Expand Down
104 changes: 0 additions & 104 deletions test/multiverse/suites/agent_only/cross_application_tracing_test.rb

This file was deleted.

30 changes: 0 additions & 30 deletions test/multiverse/suites/rails/request_statistics_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,36 +94,6 @@ def test_request_should_include_guid_if_cross_app
end
end

def test_request_should_include_referring_guid_if_needed
with_config(:'cross_application_tracer.enabled' => true,
:'distributed_tracing.enabled' => false,
:'analytics_events.enabled' => true,
:'cross_process_id' => 'boo',
:'encoding_key' => "\0",
:'trusted_account_ids' => [1]) do
rack_env = {
'HTTP_X_NEWRELIC_ID' => NewRelic::Base64.encode64('1#234'),
'HTTP_X_NEWRELIC_TRANSACTION' => NewRelic::Base64.encode64('["8badf00d",1]')
}

get('/request_stats/cross_app_action', headers: rack_env)

NewRelic::Agent.agent.send(:harvest_and_send_analytic_event_data)

post = $collector.calls_for('analytic_event_data').first

refute_nil(post)
assert_kind_of Array, post.events
assert_kind_of Array, post.events.first

sample = post.events.first.first

assert_kind_of Hash, sample
assert_kind_of String, sample['nr.guid']
assert_equal('8badf00d', sample['nr.referringTransactionGuid'])
end
end

def test_custom_params_should_be_reported_with_events_and_coerced_to_safe_types
with_config(:'analytics_events.enabled' => true) do
5.times { get('/request_stats/stats_action_with_custom_params') }
Expand Down
Loading