2017-01-18 23:44:29 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
StatsD.prefix = 'mastodon'
|
|
|
|
StatsD.default_sample_rate = 1
|
|
|
|
|
2017-01-26 19:08:05 +01:00
|
|
|
ActiveSupport::Notifications.subscribe(/performance/) do |name, _start, _finish, _id, payload|
|
|
|
|
action = payload[:action] || :increment
|
|
|
|
measurement = payload[:measurement]
|
|
|
|
value = payload[:value]
|
|
|
|
key_name = "#{name}.#{measurement}"
|
2017-01-18 23:44:29 +01:00
|
|
|
|
2017-01-26 19:08:05 +01:00
|
|
|
StatsD.send(action.to_s, key_name, (value || 1))
|
2017-01-18 23:44:29 +01:00
|
|
|
end
|