---
title: Update deprecated API calls
source: https://docs.newrelic.com/docs/apm/agents/ruby-agent/troubleshooting/update-deprecated-api-calls
---

## Problem

We occasionally remove deprecated APIs. If you use any of the following methods, you must update your API calls with the recommended replacements before upgrading to certain Ruby agent versions.

## Ruby agent 9.0.0

The following APIs were removed with Ruby agent 9.0.0. Update your API with the following recommended replacements:

**`NewRelic::Agent#disable_transaction_tracing`**

Replace with `NewRelic::Agent#disable_all_tracing` or `NewRelic::Agent#ignore_transaction`

## Ruby agent 4.0.0

The following APIs were removed with Ruby agent 4.0.0. Update your API with the following recommended replacements:

**`ActionController#newrelic_notice_error`**

Replace with `NewRelic::Agent#notice_error`

**`NewRelic::Agent.abort_transaction!`**

Replace with `NewRelic::Agent.ignore_transaction`

**`NewRelic::Agent.add_custom_parameters`**

Replace with `NewRelic::Agent.add_custom_attributes`

**`NewRelic::Agent.add_request_parameters`**

Replace with `NewRelic::Agent.add_custom_attributes`

**`NewRelic::Agent.browser_timing_footer`**

Delete the method call as it is no longer needed and had been returning an empty string.

**`NewRelic::Agent.get_stats`**

-   If you had chained `get_stats` with `increment_count`, use:

    `NewRelic::Agent.increment_metric`
-   If you had chained `get_stats` with `record_data_point`, use:

    `NewRelic::Agent.record_metric`

**`NewRelic::Agent.get_stats_no_scope`**

-   If you had chained `get_stats_no_scope` with `increment_count`, use:

    `NewRelic::Agent.increment_metric`
-   If you had chained `get_stats_no_scope` with `record_data_point`, use:

    `NewRelic::Agent.record_metric`

**`NewRelic::Agent.record_transaction`**

Delete the method call as it only logs a warning message to the agent log.

**`NewRelic::Agent.reset_stats`**

Replace with `NewRelic::Agent.drop_buffered_data`

**`NewRelic::Agent.set_user_attributes`**

Replace with `NewRelic::Agent.add_custom_attributes`

**`NewRelic::Agent::Instrumentation::ActiveRecordHelper.rollup_metrics_for`**

Replace with `NewRelic::Agent::Datastores::MetricHelper.metrics_for`

**`NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction?`**

Replace with `NewRelic::Agent::Transaction.recording_web_transaction?`

**`NewRelic::Agent::Instrumentation::MetricFrame.abort_transaction!`**

Replace with `NewRelic::Agent::Transaction.abort_transaction!`

**`NewRelic::Agent::Instrumentation::Rack`**

Delete inclusions of this module. As of Ruby agent version 3.9.0, New Relic instruments Rack middlewares by default. As a result, this entire module has been deprecated.

**`NewRelic::Agent::MethodTracer.get_stats_scoped`**

Replace with `NewRelic::Agent.record_metric`

**`NewRelic::Agent::MethodTracer.get_stats_unscoped`**

Replace with `NewRelic::Agent.record_metric`

**`NewRelic::Agent::MethodTracer.trace_method_execution`**

Replace with either of these methods:

-   `NewRelic::Agent::MethodTracer.trace_execution_scoped`
-   `NewRelic::Agent::MethodTracer.trace_execution_unscoped`

**`NewRelic::Agent::MethodTracer.trace_method_execution_no_scope`**

Replace with `NewRelic::Agent::MethodTracer.trace_execution_unscoped`

**`NewRelic::Agent::MethodTracer.trace_method_execution_with_scope`**

Replace with `NewRelic::Agent::MethodTracer.trace_execution_scoped`

**`NewRelic::Agent::StatsEngine::MetricStats#get_stats`**

Replace with `NewRelic::Agent.record_metric`

**`NewRelic::Agent::StatsEngine::MetricStats#get_stats_no_scope`**

Replace with `NewRelic::Agent.record_metric`

**`NewRelic::Agent::StatsEngine::Samplers.add_sampler`**

Delete the method call as it only logs a warning message to the agent log.

**`NewRelic::Agent::StatsEngine::Samplers.add_harvest_sampler`**

Delete the method call as it only logs a warning message to the agent log.

**`NewRelic::MetricSpec#sub`**

Delete the method call as it is no longer supported

**`NewRelic::NoticedError#exception_class`**

Replace with `NewRelic::NoticedError#exception_class_name`

**`NewRelic::Rack::ErrorCollector`**

Delete inclusions of this module. The Ruby agent automatically collect errors for all Rack applications in either of these situations:

-   If automatic Rack middleware instrumentation is enabled
-   If you have manually added any New Relic middlewares into your middleware stack
