From 48e95536b5d82e4939cec4a1ae9883390a7b1ad8 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 25 Jul 2022 08:32:56 -0500 Subject: [PATCH] Sentry hotfixes --- sgx_jmp.rb | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/sgx_jmp.rb b/sgx_jmp.rb index 70f6d13..607bb76 100644 --- a/sgx_jmp.rb +++ b/sgx_jmp.rb @@ -120,17 +120,6 @@ BANDWIDTH_VOICE = Bandwidth::Client.new( voice_basic_auth_password: CONFIG[:creds][:password] ).voice_client.client -def new_sentry_hub(stanza, name: nil) - hub = Sentry.get_current_hub&.new_from_top - raise "Sentry.init has not been called" unless hub - - hub.push_scope - hub.current_scope.clear_breadcrumbs - hub.current_scope.set_transaction_name(name) if name - hub.current_scope.set_user(jid: stanza.from.stripped.to_s) - hub -end - class AuthError < StandardError; end # Braintree is not async, so wrap in EM.defer for now @@ -286,7 +275,7 @@ before( before nil, to: /\Acustomer_/, from: /(\A|@)#{CONFIG[:sgx]}(\/|\Z)/ do |s| StatsD.increment("stanza_customer") - Sentry.set_transaction_name("stanza_customer") + Sentry.get_current_scope.set_transaction_name("stanza_customer") CustomerRepo.new(set_user: Sentry.method(:set_user)).find( s.to.node.delete_prefix("customer_") ).then { |customer| customer.stanza_to(s) } @@ -300,7 +289,7 @@ message( from: /(\A|@)#{CONFIG[:sgx]}(\/|\Z)/ ) do |m| StatsD.increment("inbound_group_text") - Sentry.set_transaction_name("inbound_group_text") + Sentry.get_current_scope.set_transaction_name("inbound_group_text") address = m.find("ns:addresses", ns: ADDRESSES_NS).first &.find("ns:address", ns: ADDRESSES_NS) @@ -308,7 +297,7 @@ message( pass unless address CustomerRepo - .new(set_user: sentry_hub.current_scope.method(:set_user)) + .new(set_user: Sentry.method(:set_user)) .find_by_jid(address["jid"]).then { |customer| m.from = m.from.with(domain: CONFIG[:component][:jid]) m.to = m.to.with(domain: customer.jid.domain) -- 2.45.2