Class: Bigcommerce::Prometheus::Servers::Thin::Controllers::BaseController
- Inherits:
-
Object
- Object
- Bigcommerce::Prometheus::Servers::Thin::Controllers::BaseController
- Defined in:
- lib/bigcommerce/prometheus/servers/thin/controllers/base_controller.rb
Overview
Base thin controller for prometheus metrics
Direct Known Subclasses
ErrorController, MetricsController, NotFoundController, SendMetricsController
Instance Method Summary collapse
- #handle ⇒ Object
-
#initialize(request:, response:, server_metrics:, collector:, logger:) ⇒ BaseController
constructor
A new instance of BaseController.
- #set_header(key, value) ⇒ Object
Constructor Details
#initialize(request:, response:, server_metrics:, collector:, logger:) ⇒ BaseController
Returns a new instance of BaseController.
34 35 36 37 38 39 40 |
# File 'lib/bigcommerce/prometheus/servers/thin/controllers/base_controller.rb', line 34 def initialize(request:, response:, server_metrics:, collector:, logger:) @request = request @response = response @collector = collector @server_metrics = server_metrics @logger = logger end |
Instance Method Details
#handle ⇒ Object
42 43 44 45 |
# File 'lib/bigcommerce/prometheus/servers/thin/controllers/base_controller.rb', line 42 def handle call @response.finish end |
#set_header(key, value) ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/bigcommerce/prometheus/servers/thin/controllers/base_controller.rb', line 51 def set_header(key, value) if @response.respond_to?(:add_header) # rack 2.0+ @response.add_header(key.to_s, value.to_s) else @response[key.to_s] = value.to_s end end |