You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
412 B

  1. # frozen_string_literal: true
  2. StatsD.prefix = 'mastodon'
  3. StatsD.default_sample_rate = 1
  4. ActiveSupport::Notifications.subscribe(/performance/) do |name, _start, _finish, _id, payload|
  5. action = payload[:action] || :increment
  6. measurement = payload[:measurement]
  7. value = payload[:value]
  8. key_name = "#{name}.#{measurement}"
  9. StatsD.send(action.to_s, key_name, (value || 1))
  10. end