prometheus_exporter
prometheus_exporter copied to clipboard
Custom quantile for pre-defined metrics, example
Hi,
I'm trying to add custom quantile for pre-defined metrics the code:
on_worker_boot do
ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
if ENV.fetch('PROMETHEUS_ENABLED', 'false') == 'true'
require 'prometheus_exporter/client'
require 'prometheus_exporter/metric'
require 'prometheus_exporter/instrumentation'
client = PrometheusExporter::Client.new(host: 'localhost', port:9394)
PrometheusExporter::Client.default = client
PrometheusExporter::Instrumentation::Process.start(type: 'puma_worker')
PrometheusExporter::Instrumentation::ActiveRecord.start(
custom_labels: { type: 'active_record' },
config_labels: [:database, :host]
)
end
end
In the README there are examples for custom metrics - https://github.com/discourse/prometheus_exporter/blob/master/README.md#custom-quantiles-and-buckets
How can I add quantiles for pre-defined metrics, like response time, i.e. override this constant and add 95 percentile:
DEFAULT_QUANTILES = [0.99, 0.9, 0.5, 0.1, 0.01]
Thank you