Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate Apartment compatibility with New Relic #2426

Open
hannahramadan opened this issue Feb 2, 2024 · 1 comment
Open

Investigate Apartment compatibility with New Relic #2426

hannahramadan opened this issue Feb 2, 2024 · 1 comment

Comments

@hannahramadan
Copy link
Contributor

hannahramadan commented Feb 2, 2024

Description

The Apartment gem helps Rails applications achieve database multitenancy. There is a known incompatiability with New Relic and Apartment when the config setting active_record_log = true is present. This config unsubscribes from ActiveRecord notifications, which Ruby agent instrumentation relies on. We are unable to provide insights into ActiveRecord calls when that config setting is enabled, which it isn't by default.

    config.after_initialize do
      # NOTE: Load the custom log subscriber if enabled
      if Apartment.active_record_log
        ActiveSupport::Notifications.notifier.listeners_for('sql.active_record').each do |listener|
          next unless listener.instance_variable_get('@delegate').is_a?(ActiveRecord::LogSubscriber)

          ActiveSupport::Notifications.unsubscribe listener
        end

        Apartment::LogSubscriber.attach_to :active_record
      end
    end

Customers can disable this configuration value and recieve New Relic insights into their database calls.

Acceptance Criteria

We should understand why this configuration setting needs to disable ActiveRecord notifications, and from there decide if we add our findings to a troubleshooting guide that instructs turning off this config setting for New Relic to report database calls, or programatically work around this issue in the agent.

Post-completion

The GTSE team created a KCS article describing the fix of removing the config. Whatever we decided to do with this ticket, we should update teh GTSE team so they can edit that article if needed.

@workato-integration
Copy link

@kford-newrelic kford-newrelic added the estimate Issue needing estimation label Feb 16, 2024
@kford-newrelic kford-newrelic removed the estimate Issue needing estimation label Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants