statsd.rb 478 B

123456789101112131415
  1. # frozen_string_literal: true
  2. if ENV['STATSD_ADDR'].present?
  3. host, port = ENV['STATSD_ADDR'].split(':')
  4. $statsd = ::Statsd.new(host, port)
  5. $statsd.namespace = ENV.fetch('STATSD_NAMESPACE') { ['Mastodon', Rails.env].join('.') }
  6. ::NSA.inform_statsd($statsd) do |informant|
  7. informant.collect(:action_controller, :web)
  8. informant.collect(:active_record, :db)
  9. informant.collect(:active_support_cache, :cache)
  10. informant.collect(:sidekiq, :sidekiq)
  11. end
  12. end