yabeda-rails
yabeda-rails copied to clipboard
Limit the set of controller metrics
Hi! Is it possible to do that? I tried smth like that
Yabeda::Rails.on_controller_action do |event, labels|
next unless Rails.configuration.measured_actions.include? "#{labels[:controller]}##{labels[:action]}"
...
and
config.measured_actions = [
'api/entry#index',
'api/offers#index'
]
but not working, I see all controllers in /metrics
It is not possible at the moment.
Yabeda::Rails.on_controller_action
is a hook to adding measure of new custom metrics and can't limit builtin ones.
For now you can fork this gem and experiment with adding some guard clauses (like next unless event.payload[:params]["controller"].in? %w[your whitelisted controllers]
) between lines 42 and 43 of lib/yabeda/rails.rb
, here:
https://github.com/yabeda-rb/yabeda-rails/blob/1fd00e1a976d39704ac065ca66bb389481fdf6b8/lib/yabeda/rails.rb#L42-L43
And you can add ability to configure it via AnywayConfig and make a Pull Request! :wink:
Hi, no, I did nothing)
сб, 16 окт. 2021 г. в 15:53, Danh Manh Nguyen @.***>:
@Merff https://github.com/Merff Hi Alex, I had the same problem with you. Beside @Envek https://github.com/Envek answer, did you solve it? Thanks.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/yabeda-rb/yabeda-rails/issues/16#issuecomment-944883180, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD5M3NY34YHH4GWFPJ64NFTUHE4QHANCNFSM4SS5B64A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.