class GRPCPrometheus::ServerMetrics::MonitorServlet

Public Class Methods

new(server, registry) click to toggle source
# File lib/grpc_prometheus/server_metrics.rb, line 65
def initialize(server, registry)
  @registry = registry
end

Public Instance Methods

do_GET(req, res) click to toggle source
# File lib/grpc_prometheus/server_metrics.rb, line 69
def do_GET(req, res)
  res.status = 200
  res['Content-Type'] = ::Prometheus::Client::Formats::Text::CONTENT_TYPE
  res.body = ::Prometheus::Client::Formats::Text.marshal(@registry)
rescue
  res.status = 500
  res['Content-Type'] = 'text/plain'
  res.body = $!.to_s
end