From 1939902eb1633e608ace5159d2e2959266d936d7 Mon Sep 17 00:00:00 2001 From: Alex Kriuchykhin Date: Thu, 24 Oct 2024 13:22:21 +0200 Subject: [PATCH] Fix NewRelic ignore calls for ActiveJobs [SCI-11212] (#7988) --- app/jobs/my_modules/due_date_reminder_job.rb | 3 +-- app/jobs/notification_cleanup_job.rb | 3 +-- app/jobs/repository_item_date_reminder_job.rb | 3 +-- app/services/templates_service.rb | 2 ++ 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/jobs/my_modules/due_date_reminder_job.rb b/app/jobs/my_modules/due_date_reminder_job.rb index 8db0409cc..9975a5436 100644 --- a/app/jobs/my_modules/due_date_reminder_job.rb +++ b/app/jobs/my_modules/due_date_reminder_job.rb @@ -2,9 +2,8 @@ module MyModules class DueDateReminderJob < ApplicationJob - newrelic_ignore - def perform + NewRelic::Agent.ignore_transaction my_modules = MyModule.uncomplete.approaching_due_dates my_modules.each do |task| diff --git a/app/jobs/notification_cleanup_job.rb b/app/jobs/notification_cleanup_job.rb index 61a939cb9..31c2380d4 100644 --- a/app/jobs/notification_cleanup_job.rb +++ b/app/jobs/notification_cleanup_job.rb @@ -1,9 +1,8 @@ # frozen_string_literal: true class NotificationCleanupJob < ApplicationJob - newrelic_ignore - def perform + NewRelic::Agent.ignore_transaction Notification.where('created_at < ?', 3.months.ago).delete_all end end diff --git a/app/jobs/repository_item_date_reminder_job.rb b/app/jobs/repository_item_date_reminder_job.rb index fe35ea0a8..555ca1e74 100644 --- a/app/jobs/repository_item_date_reminder_job.rb +++ b/app/jobs/repository_item_date_reminder_job.rb @@ -1,11 +1,10 @@ # frozen_string_literal: true class RepositoryItemDateReminderJob < ApplicationJob - newrelic_ignore - queue_as :default def perform + NewRelic::Agent.ignore_transaction process_repository_values(RepositoryDateTimeValue, DateTime.current) process_repository_values(RepositoryDateValue, Date.current) end diff --git a/app/services/templates_service.rb b/app/services/templates_service.rb index 5b2f5ba37..75a6d0c12 100644 --- a/app/services/templates_service.rb +++ b/app/services/templates_service.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'newrelic_rpm' + class TemplatesService def initialize(base_dir = nil) @base_dir = base_dir ? base_dir : "#{Rails.root}/app/assets/templates"