我们可以在工作端而不是客户端配置哨兵 dsn 吗?

Can we configure sentry dsn on the worker side instead of the client side?

我必须构建一个中央工作者,它可以有多个服务将哨兵事件推送给它。因此每个服务都会有自己的 dsn,是否可以在 central worker 而不是客户端上配置 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

得到答案,是的,可以从工作人员而不是客户端配置哨兵 dsn。 Raven 不关心配置更新的位置。