Class: Ask::Observability::MetricsApp

Inherits:
Object
  • Object
show all
Defined in:
lib/ask/observability/metrics_app.rb

Overview

Rack endpoint rendering the registry in Prometheus text format. Mounted by the railtie at Configuration#metrics_path; the collector scrapes it and ships to OpenObserve/Grafana.

Instance Method Summary collapse

Instance Method Details

#call(_env) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/ask/observability/metrics_app.rb', line 9

def call(_env)
  body = Prometheus::Client::Formats::Text.marshal(Ask::Observability.registry)
  [200,
   { 'Content-Type' => 'text/plain; version=0.0.4; charset=utf-8',
     'Content-Length' => body.bytesize.to_s },
   [body]]
end