Class: ThreeScale::Backend::WorkerMetrics

Inherits:
Object
  • Object
show all
Includes:
Configurable
Defined in:
lib/3scale/backend/worker_metrics.rb

Class Method Summary collapse

Methods included from Configurable

#configuration, #configuration=, included

Class Method Details

.increase_job_count(job_class_name) ⇒ Object



34
35
36
37
38
# File 'lib/3scale/backend/worker_metrics.rb', line 34

def self.increase_job_count(job_class_name)
  Yabeda.apisonator_worker.job_count.increment(
      { type: job_class_name }, by: 1
  )
end

.report_runtime(job_class_name, runtime) ⇒ Object



40
41
42
# File 'lib/3scale/backend/worker_metrics.rb', line 40

def self.report_runtime(job_class_name, runtime)
  Yabeda.apisonator_worker.job_runtime.measure({ type: job_class_name }, runtime)
end

.start_metrics_serverObject



26
27
28
29
30
31
32
# File 'lib/3scale/backend/worker_metrics.rb', line 26

def self.start_metrics_server
  # Yabeda does not accept the port as a param
  port = configuration.worker_prometheus_metrics.port
  ENV['PROMETHEUS_EXPORTER_PORT'] = port.to_s if port

  Yabeda::Prometheus::Exporter.start_metrics_server!
end