Skip to content

Commit b06a2f2

Browse files
committed
removed other api methods
1 parent c655769 commit b06a2f2

File tree

4 files changed

+1
-190
lines changed

4 files changed

+1
-190
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

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

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` and `NewRelic::Agent::External.get_response_metadata` have also been removed. [PR#3333](https://github.com/newrelic/newrelic-ruby-agent/pull/3333)
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)
1212

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

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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ module SupportabilityHelper
2323
:disable_all_tracing,
2424
:disable_sql_recording,
2525
:drop_buffered_data,
26-
:get_response_metadata,
2726
:get_transaction_name,
2827
:ignore_apdex,
2928
:ignore_enduser,
@@ -38,7 +37,6 @@ module SupportabilityHelper
3837
:notice_sql,
3938
:notice_statement,
4039
:perform_action_with_newrelic_trace,
41-
:process_response_metadata,
4240
:record_custom_event,
4341
:record_metric,
4442
:record_llm_feedback_event,

test/new_relic/agent/transaction/external_request_segment_test.rb

Lines changed: 0 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -452,122 +452,6 @@ def test_uri_recorded_as_tt_attribute
452452
assert_equal uri, node.params[:uri]
453453
end
454454

455-
# --- get_request_metadata
456-
457-
def test_get_request_metadata_with_cross_app_tracing_disabled
458-
with_config(cat_config.merge(:'cross_application_tracer.enabled' => false)) do
459-
in_transaction do |txn|
460-
rmd = external_request_segment { |s| s.get_request_metadata }
461-
462-
refute rmd, '`get_request_metadata` should return nil with cross app tracing disabled'
463-
end
464-
end
465-
end
466-
467-
def test_get_request_metadata_not_in_transaction
468-
with_config(cat_config) do
469-
refute external_request_segment { |s| s.get_request_metadata }
470-
end
471-
end
472-
473-
# --- process_response_metadata
474-
475-
def test_process_response_metadata
476-
with_config(cat_config) do
477-
in_transaction do |txn|
478-
rmd = @obfuscator.obfuscate(::JSON.dump({
479-
NewRelicAppData: [
480-
NewRelic::Agent.config[:cross_process_id],
481-
'Controller/root/index',
482-
0.001,
483-
0.5,
484-
60,
485-
txn.guid
486-
]
487-
}))
488-
489-
segment = external_request_segment { |s| s.process_response_metadata(rmd); s }
490-
491-
assert_equal 'ExternalTransaction/example.com/269975#22824/Controller/root/index', segment.name
492-
end
493-
end
494-
end
495-
496-
def test_process_response_metadata_not_in_transaction
497-
with_config(cat_config) do
498-
rmd = @obfuscator.obfuscate(::JSON.dump({
499-
NewRelicAppData: [
500-
NewRelic::Agent.config[:cross_process_id],
501-
'Controller/root/index',
502-
0.001,
503-
0.5,
504-
60,
505-
'abcdef'
506-
]
507-
}))
508-
509-
segment = external_request_segment { |s| s.process_response_metadata(rmd); s }
510-
511-
assert_equal 'External/example.com/foo/get', segment.name
512-
end
513-
end
514-
515-
def test_process_response_metadata_with_invalid_cross_app_id
516-
with_config(cat_config) do
517-
in_transaction do |txn|
518-
rmd = @obfuscator.obfuscate(::JSON.dump({
519-
NewRelicAppData: [
520-
'bugz',
521-
'Controller/root/index',
522-
0.001,
523-
0.5,
524-
60,
525-
txn.guid
526-
]
527-
}))
528-
529-
segment = nil
530-
l = with_array_logger do
531-
segment = external_request_segment { |s| s.process_response_metadata(rmd); s }
532-
end
533-
534-
refute_empty l.array, 'process_response_metadata should log error on invalid ID'
535-
assert_includes l.array.first, 'invalid/non-trusted ID'
536-
537-
assert_equal 'External/example.com/foo/get', segment.name
538-
end
539-
end
540-
end
541-
542-
def test_process_response_metadata_with_untrusted_cross_app_id
543-
with_config(cat_config) do
544-
in_transaction do |txn|
545-
rmd = @obfuscator.obfuscate(::JSON.dump({
546-
NewRelicAppData: [
547-
'190#666',
548-
'Controller/root/index',
549-
0.001,
550-
0.5,
551-
60,
552-
txn.guid
553-
]
554-
}))
555-
556-
segment = nil
557-
l = with_array_logger do
558-
segment = external_request_segment { |s| s.process_response_metadata(rmd); s }
559-
end
560-
561-
refute_empty l.array, 'process_response_metadata should log error on invalid ID'
562-
assert_includes l.array.first, 'invalid/non-trusted ID'
563-
564-
assert_equal 'External/example.com/foo/get', segment.name
565-
end
566-
end
567-
end
568-
569-
# ---
570-
571455
def test_segment_adds_distributed_trace_header
572456
distributed_tracing_config = {
573457
:'distributed_tracing.enabled' => true,

0 commit comments

Comments
 (0)