Class: Fluent::Plugin::CwmHttpInput
- Inherits:
-
Input
- Object
- Input
- Fluent::Plugin::CwmHttpInput
- Defined in:
- lib/fluent/plugin/in_http_cwm.rb
Overview
Custom HTTP Input Plugin class for CWM
Instance Method Summary collapse
- #configure(conf) ⇒ Object
-
#initialize ⇒ CwmHttpInput
constructor
A new instance of CwmHttpInput.
- #start ⇒ Object
Constructor Details
#initialize ⇒ CwmHttpInput
Returns a new instance of CwmHttpInput.
69 70 71 72 73 74 75 76 77 |
# File 'lib/fluent/plugin/in_http_cwm.rb', line 69 def initialize super @redis = nil @deployment_api_metrics = default_api_metrics_hash @last_action_queue = Queue.new @last_action_entry = [] end |
Instance Method Details
#configure(conf) ⇒ Object
79 80 81 82 83 |
# File 'lib/fluent/plugin/in_http_cwm.rb', line 79 def configure(conf) super set_up_redis end |
#start ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/fluent/plugin/in_http_cwm.rb', line 85 def start super # start interval timer to flush api metrics timer_execute(:api_metrics_flush_timer, @redis_config.flush_interval) do flush_api_metrics end # start interval timer to flush last action entry timer_execute(:last_action_flush_timer, '1s') do flush_last_action end log.info("Starting HTTP server [#{@host}:#{@port}]...") http_server_create_http_server(:http_server, addr: @host, port: @port, logger: log) do |server| server.post("/#{tag}") do |req| data = parse_data(req.body) route(data) if update_deployment_metrics(data) # return HTTP 200 OK response with emtpy body [200, { 'Content-Type' => 'text/plain' }, nil] end end end |