Class: GovukPrometheusExporter::SinatraMiddleware

Inherits:
PrometheusExporter::Middleware
  • Object
show all
Defined in:
lib/govuk_app_config/govuk_prometheus_exporter.rb

Instance Method Summary collapse

Instance Method Details

#custom_labels(env) ⇒ Object



23
24
25
# File 'lib/govuk_app_config/govuk_prometheus_exporter.rb', line 23

def custom_labels(env)
  env.fetch("govuk.prometheus_labels", {})
end

#default_labels(_env, _result) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/govuk_app_config/govuk_prometheus_exporter.rb', line 14

def default_labels(_env, _result)
  # The default prometheus exporter middleware uses the controller and
  # action as labels.  These aren't meaningful in Sinatra applications, and
  # other options (such as request.path_info) have potentially very high
  # cardinality.  For now, just accept that we can't be more specific than
  # the application / pod and don't provide any other labels
  {}
end