Class: Fluent::Plugin::PrometheusInput
- Inherits:
-
Input
- Object
- Input
- Fluent::Plugin::PrometheusInput
- Defined in:
- lib/fluent/plugin/in_prometheus.rb
Defined Under Namespace
Classes: MonitorServlet
Instance Attribute Summary collapse
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
Instance Method Summary collapse
- #configure(conf) ⇒ Object
-
#initialize ⇒ PrometheusInput
constructor
A new instance of PrometheusInput.
- #multi_workers_ready? ⇒ Boolean
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize ⇒ PrometheusInput
Returns a new instance of PrometheusInput.
17 18 19 20 |
# File 'lib/fluent/plugin/in_prometheus.rb', line 17 def initialize super @registry = ::Prometheus::Client.registry end |
Instance Attribute Details
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
15 16 17 |
# File 'lib/fluent/plugin/in_prometheus.rb', line 15 def registry @registry end |
Instance Method Details
#configure(conf) ⇒ Object
22 23 24 25 |
# File 'lib/fluent/plugin/in_prometheus.rb', line 22 def configure(conf) super @port += fluentd_worker_id end |
#multi_workers_ready? ⇒ Boolean
27 28 29 |
# File 'lib/fluent/plugin/in_prometheus.rb', line 27 def multi_workers_ready? true end |
#shutdown ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/fluent/plugin/in_prometheus.rb', line 48 def shutdown if @server @server.shutdown @server = nil end super end |
#start ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/fluent/plugin/in_prometheus.rb', line 31 def start super log.debug "listening prometheus http server on http://#{@bind}:#{@port}/#{@metrics_path} for worker#{fluentd_worker_id}" @server = WEBrick::HTTPServer.new( BindAddress: @bind, Port: @port, MaxClients: 5, Logger: WEBrick::Log.new(STDERR, WEBrick::Log::FATAL), AccessLog: [], ) @server.mount(@metrics_path, MonitorServlet, self) thread_create(:in_prometheus) do @server.start end end |