Class: Bigcommerce::Prometheus::Servers::Thin::Server

Inherits:
Thin::Server
  • Object
show all
Defined in:
lib/bigcommerce/prometheus/servers/thin/server.rb

Overview

Thin adapter for server

Instance Method Summary collapse

Constructor Details

#initialize(port: nil, host: nil, timeout: nil, logger: nil, thread_pool_size: nil) ⇒ Server

Returns a new instance of Server.



26
27
28
29
30
31
32
33
34
35
# File 'lib/bigcommerce/prometheus/servers/thin/server.rb', line 26

def initialize(port: nil, host: nil, timeout: nil, logger: nil, thread_pool_size: nil)
  @port = port || ::Bigcommerce::Prometheus.server_port
  @host = host || ::Bigcommerce::Prometheus.server_host
  @timeout = timeout || ::Bigcommerce::Prometheus.server_timeout
  @logger = logger || ::Bigcommerce::Prometheus.logger
  @rack_app = ::Bigcommerce::Prometheus::Servers::Thin::RackApp.new(timeout: timeout, logger: logger)
  super(@host, @port, @rack_app)
  ::Thin::Logging.logger = @logger
  self.threadpool_size = (thread_pool_size || ::Bigcommerce::Prometheus.server_thread_pool_size).to_i
end

Instance Method Details

#add_type_collector(collector) ⇒ Object

Add a type collector to this server

Parameters:

  • collector (PrometheusExporter::Server::TypeCollector)


42
43
44
# File 'lib/bigcommerce/prometheus/servers/thin/server.rb', line 42

def add_type_collector(collector)
  @rack_app.add_type_collector(collector)
end