From f82f77466a9780766ae9be6a4bd032b3f0e72070 Mon Sep 17 00:00:00 2001 From: Zach Gollwitzer Date: Sun, 18 May 2025 10:52:35 -0400 Subject: [PATCH] Fix Sentry context for security details exception --- app/jobs/fetch_security_info_job.rb | 21 --------------------- app/models/security/provided.rb | 2 +- 2 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 app/jobs/fetch_security_info_job.rb diff --git a/app/jobs/fetch_security_info_job.rb b/app/jobs/fetch_security_info_job.rb deleted file mode 100644 index e789222f..00000000 --- a/app/jobs/fetch_security_info_job.rb +++ /dev/null @@ -1,21 +0,0 @@ -class FetchSecurityInfoJob < ApplicationJob - queue_as :low_priority - - def perform(security_id) - return unless Security.provider.present? - - security = Security.find(security_id) - - params = { - ticker: security.ticker - } - params[:mic_code] = security.exchange_mic if security.exchange_mic.present? - params[:operating_mic] = security.exchange_operating_mic if security.exchange_operating_mic.present? - - security_info_response = Security.provider.fetch_security_info(**params) - - security.update( - name: security_info_response.info.dig("name") - ) - end -end diff --git a/app/models/security/provided.rb b/app/models/security/provided.rb index 221acde5..7927d6e6 100644 --- a/app/models/security/provided.rb +++ b/app/models/security/provided.rb @@ -75,7 +75,7 @@ module Security::Provided Rails.logger.warn("Failed to fetch security info for #{ticker} from #{provider.class.name}: #{response.error.message}") Sentry.capture_exception(SecurityInfoMissingError.new("Failed to get security info"), level: :warning) do |scope| scope.set_tags(security_id: self.id) - scope.set_context(provider_error: response.error.message) + scope.set_context("security", { id: self.id, provider_error: response.error.message }) end end end