1
我必須建立一箇中央工作人員,可以有多種服務將哨兵事件推送給它。因此,每項服務都有自己的dsn,是否可以在中央工作人員而不是客戶端上配置dsn?我們可以在工作端而不是客戶端配置sentry dsn嗎?
目前我對應用程序是這樣的,這將推動該事件的Redis:
Raven.configure do |config|
configuration = {
dsn: Figaro.env.sentry_host,
environments: %w(production),
sanitize_fields: Rails.application.config.filter_parameters.map(&:to_s),
}
config.async = lambda { |event|
SentryNotifierJob.perform_async(event.to_hash, configuration)
}
config.logger = Rails.logger
end
,這對工人:
class SentryNotifierJob
include Sidekiq::Worker
sidekiq_options :retry => true, queue: :default
def perform(event, config)
Raven.configure do |config|
config.dsn = config[:dsn]
config.sanitize_fields = configuration[:sanitize_fields]
config.processors = [Raven::Processor::SanitizeData]
config.sanitize_fields.push('Authorization', 'tokenId', 'Client-Id', 'Pass-Key', 'gcmKey', 'deviceToken')
config.logger = Rails.logger
end
Raven.send_event(event)
end
end