Class: Sbmt::Strangler::MetricTracker
- Inherits:
-
Object
- Object
- Sbmt::Strangler::MetricTracker
- Defined in:
- lib/sbmt/strangler/metric_tracker.rb
Instance Attribute Summary collapse
-
#rails_controller ⇒ Object
readonly
Returns the value of attribute rails_controller.
Instance Method Summary collapse
-
#initialize(rails_controller) ⇒ MetricTracker
constructor
A new instance of MetricTracker.
- #log_unallowed_params ⇒ Object
- #track_compare_call(success) ⇒ Object
- #track_compare_call_result(value) ⇒ Object
- #track_mirror_call(success) ⇒ Object
- #track_params_usage ⇒ Object
- #track_render_call(success) ⇒ Object
- #track_work_mode(mode) ⇒ Object
Constructor Details
#initialize(rails_controller) ⇒ MetricTracker
Returns a new instance of MetricTracker.
8 9 10 |
# File 'lib/sbmt/strangler/metric_tracker.rb', line 8 def initialize(rails_controller) @rails_controller = rails_controller end |
Instance Attribute Details
#rails_controller ⇒ Object (readonly)
Returns the value of attribute rails_controller.
6 7 8 |
# File 'lib/sbmt/strangler/metric_tracker.rb', line 6 def rails_controller @rails_controller end |
Instance Method Details
#log_unallowed_params ⇒ Object
16 17 18 19 20 21 |
# File 'lib/sbmt/strangler/metric_tracker.rb', line 16 def log_unallowed_params unallowed_params = all_request_params - allowed_request_params Sbmt::Strangler.logger.log_warn(<<~WARN.strip) if unallowed_params.any? Not allowed parameters in #{controller_path}##{action_name}: #{unallowed_params} WARN end |
#track_compare_call(success) ⇒ Object
33 34 35 36 |
# File 'lib/sbmt/strangler/metric_tracker.rb', line 33 def track_compare_call(success) = .merge(success: success.to_s) ::Yabeda.sbmt_strangler.compare_call.increment() end |
#track_compare_call_result(value) ⇒ Object
38 39 40 41 |
# File 'lib/sbmt/strangler/metric_tracker.rb', line 38 def track_compare_call_result(value) = .merge(value: value.to_s) ::Yabeda.sbmt_strangler.compare_call_result.increment() end |
#track_mirror_call(success) ⇒ Object
28 29 30 31 |
# File 'lib/sbmt/strangler/metric_tracker.rb', line 28 def track_mirror_call(success) = .merge(success: success.to_s) ::Yabeda.sbmt_strangler.mirror_call.increment() end |
#track_params_usage ⇒ Object
12 13 14 |
# File 'lib/sbmt/strangler/metric_tracker.rb', line 12 def track_params_usage ::Yabeda.sbmt_strangler.params_usage.increment() end |
#track_render_call(success) ⇒ Object
43 44 45 46 |
# File 'lib/sbmt/strangler/metric_tracker.rb', line 43 def track_render_call(success) = .merge(success: success.to_s) ::Yabeda.sbmt_strangler.render_call.increment() end |
#track_work_mode(mode) ⇒ Object
23 24 25 26 |
# File 'lib/sbmt/strangler/metric_tracker.rb', line 23 def track_work_mode(mode) = .merge(mode: mode.to_s) ::Yabeda.sbmt_strangler.work_mode.increment() end |