Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to Prometheus histograms, not summaries #318

Merged
merged 3 commits into from
Sep 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/govuk_app_config/govuk_prometheus_exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@ def self.should_configure
end
end

def self.configure(collectors: [])
def self.configure(collectors: [], default_aggregation: Prometheus::Metric::Histogram)
return unless should_configure

require "prometheus_exporter"
require "prometheus_exporter/server"
require "prometheus_exporter/middleware"

# PrometheusExporter::Metric::Histogram.DEFAULT_BUCKETS tops out at 10 but
# we have a few controller actions which are slower than this, so we add a
# few extra buckets for slower requests
PrometheusExporter::Metric::Histogram.default_buckets = [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 15, 25, 50].freeze
PrometheusExporter::Metric::Base.default_aggregation = default_aggregation

if defined?(Sidekiq)
Sidekiq.configure_server do |config|
require "sidekiq/api"
Expand Down