Exclude API status and health endpoints, scheduled jobs from NewRelic monitoring, update APM agent [SCI-11212] (#7987)

This commit is contained in:
Alex Kriuchykhin 2024-10-23 16:58:03 +02:00 committed by GitHub
parent 4859557212
commit 9c524d8e0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 18 additions and 5 deletions

View file

@ -456,7 +456,7 @@ GEM
timeout
net-smtp (0.5.0)
net-protocol
newrelic_rpm (9.2.2)
newrelic_rpm (9.14.0)
nio4r (2.7.3)
nokogiri (1.16.7-arm64-darwin)
racc (~> 1.4)

View file

@ -8,6 +8,8 @@ module Api
before_action :authenticate_request!, except: %i(status health)
newrelic_ignore only: %i(health status)
rescue_from StandardError do |e|
logger.error e.message
logger.error e.backtrace.join("\n")

View file

@ -2,6 +2,8 @@
module MyModules
class DueDateReminderJob < ApplicationJob
newrelic_ignore
def perform
my_modules = MyModule.uncomplete.approaching_due_dates

View file

@ -1,6 +1,8 @@
# frozen_string_literal: true
class NotificationCleanupJob < ApplicationJob
newrelic_ignore
def perform
Notification.where('created_at < ?', 3.months.ago).delete_all
end

View file

@ -1,6 +1,8 @@
# frozen_string_literal: true
class RepositoryItemDateReminderJob < ApplicationJob
newrelic_ignore
queue_as :default
def perform

View file

@ -9,6 +9,7 @@ module LabelPrinters
end
def sync_templates!
NewRelic::Agent.ignore_transaction
LabelPrinter.fluics.each do |printer|
api_client = ApiClient.new(printer.fluics_api_key)
templates = api_client.list_templates

View file

@ -49,6 +49,7 @@ class TemplatesService
end
def update_all_templates
NewRelic::Agent.ignore_transaction
processed_counter = 0
updated_counter = 0
Team.find_each do |team|

View file

@ -73,7 +73,7 @@ Rails.application.configure do
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = ENV['RAILS_FORCE_SSL'].present?
config.ssl_options = { redirect: { exclude: ->(request) { request.path =~ %r{api\/health} } } }
config.ssl_options = { redirect: { exclude: ->(request) { request.path =~ %r{api/health|status} } } }
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.

View file

@ -8,7 +8,8 @@ Rails.application.configure do
silence: [
# Silence WickedPDF rendering in logs
%r{/projects/[0-9]*/reports/generate.pdf},
'/api/health'
'/api/health',
'/api/status'
]
)
end

View file

@ -3,6 +3,10 @@ Rails.application.routes.draw do
skip_controllers :applications, :authorized_applications, :token_info
end
# Global healthcheck endpoints
get 'api/health', to: 'api/api#health', as: 'api_health'
get 'api/status', to: 'api/api#status', as: 'api_status'
post 'access_tokens/revoke', to: 'doorkeeper/access_tokens#revoke'
# Addons
@ -901,8 +905,6 @@ Rails.application.routes.draw do
end
namespace :api, defaults: { format: 'json' } do
get 'health', to: 'api#health'
get 'status', to: 'api#status'
namespace :service do
post 'projects_json_export', to: 'projects_json_export#projects_json_export'
resources :teams, only: [] do