Class: Aikido::Zen::DetachedAgent::FrontObject
- Inherits:
-
Object
- Object
- Aikido::Zen::DetachedAgent::FrontObject
- Defined in:
- lib/aikido/zen/detached_agent/front_object.rb
Defined Under Namespace
Classes: RequestKind
Instance Method Summary collapse
- #calculate_rate_limits(route_data, ip, actor_data) ⇒ Object
-
#initialize(config: Aikido::Zen.config, runtime_settings: Aikido::Zen.runtime_settings, collector: Aikido::Zen.collector, rate_limiter: Aikido::Zen::RateLimiter.new) ⇒ FrontObject
constructor
A new instance of FrontObject.
- #send_collector_events(events_data) ⇒ Object
-
#updated_settings ⇒ Object
Method called by child processes to get an up-to-date version of the runtime_settings.
Constructor Details
#initialize(config: Aikido::Zen.config, runtime_settings: Aikido::Zen.runtime_settings, collector: Aikido::Zen.collector, rate_limiter: Aikido::Zen::RateLimiter.new) ⇒ FrontObject
Returns a new instance of FrontObject.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/aikido/zen/detached_agent/front_object.rb', line 8 def initialize( config: Aikido::Zen.config, runtime_settings: Aikido::Zen.runtime_settings, collector: Aikido::Zen.collector, rate_limiter: Aikido::Zen::RateLimiter.new ) @config = config @runtime_settings = runtime_settings @collector = collector @rate_limiter = rate_limiter end |
Instance Method Details
#calculate_rate_limits(route_data, ip, actor_data) ⇒ Object
35 36 37 38 39 |
# File 'lib/aikido/zen/detached_agent/front_object.rb', line 35 def calculate_rate_limits(route_data, ip, actor_data) actor = Aikido::Zen::Actor.from_json(actor_data) if actor_data route = Aikido::Zen::Route.from_json(route_data) @rate_limiter.calculate_rate_limits(RequestKind.new(route, nil, ip, actor)) end |
#send_collector_events(events_data) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/aikido/zen/detached_agent/front_object.rb', line 22 def send_collector_events(events_data) events_data.each do |event_data| event = Aikido::Zen::Collector::Event.from_json(event_data) @collector.add_event(event) end end |
#updated_settings ⇒ Object
Method called by child processes to get an up-to-date version of the runtime_settings
31 32 33 |
# File 'lib/aikido/zen/detached_agent/front_object.rb', line 31 def updated_settings @runtime_settings end |