I have to build a central worker that can have multiple services pushing sentry events to it. Hence every service will have their own dsn, is it possible to configure the dsn on the central worker instead of the client?
Currently I have something like this on the application that will push the event to 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
and this on the worker:
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
Got the answer, yes it is possible to configure the sentry dsn from the worker instead of client side. Raven does not care where the config is updated.