Class: PrometheusExporter::Server::WebCollector

Inherits:
TypeCollector show all
Defined in:
lib/prometheus_exporter/server/web_collector.rb

Instance Method Summary collapse

Constructor Details

#initializeWebCollector

Returns a new instance of WebCollector.



5
6
7
8
9
10
11
12
# File 'lib/prometheus_exporter/server/web_collector.rb', line 5

def initialize
  @metrics = {}
  @http_requests_total = nil
  @http_request_duration_seconds = nil
  @http_request_redis_duration_seconds = nil
  @http_request_sql_duration_seconds = nil
  @http_request_queue_duration_seconds = nil
end

Instance Method Details

#collect(obj) ⇒ Object



18
19
20
21
# File 'lib/prometheus_exporter/server/web_collector.rb', line 18

def collect(obj)
  ensure_metrics
  observe(obj)
end

#metricsObject



23
24
25
# File 'lib/prometheus_exporter/server/web_collector.rb', line 23

def metrics
  @metrics.values
end

#typeObject



14
15
16
# File 'lib/prometheus_exporter/server/web_collector.rb', line 14

def type
  "web"
end