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
13
# 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
  @http_request_memcache_duration_seconds = nil
end

Instance Method Details

#collect(obj) ⇒ Object



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

def collect(obj)
  ensure_metrics
  observe(obj)
end

#metricsObject



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

def metrics
  @metrics.values
end

#typeObject



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

def type
  "web"
end