Commit 23671600 authored by Yorick Peterse's avatar Yorick Peterse

Make the metrics sampler interval configurable

parent 83ad5fa5
......@@ -73,6 +73,7 @@ def application_setting_params
......@@ -202,6 +202,13 @@
A method call is only tracked when it takes longer to complete than
the given amount of milliseconds.
= f.label :metrics_sample_interval, 'Sampler Interval (sec)', class: 'control-label col-sm-2'
= f.number_field :metrics_sample_interval, class: 'form-control'
The sampling interval in seconds. Sampled data includes memory usage,
retained Ruby objects, file descriptors and so on.
%legend Spam and Anti-bot Protection
class AddMetricsSampleInterval < ActiveRecord::Migration
def change
add_column :application_settings, :metrics_sample_interval, :integer,
default: 15
This diff is collapsed.
......@@ -13,7 +13,8 @@ def self.settings
timeout: current_application_settings[:metrics_timeout],
method_call_threshold: current_application_settings[:metrics_method_call_threshold],
host: current_application_settings[:metrics_host],
port: current_application_settings[:metrics_port]
port: current_application_settings[:metrics_port],
sample_interval: current_application_settings[:metrics_sample_interval] || 15
......@@ -7,7 +7,7 @@ module Metrics
# statistics, etc.
class Sampler
# interval - The sampling interval in seconds.
def initialize(interval = 15)
def initialize(interval = Metrics.settings[:sample_interval])
@interval = interval
@metrics = []
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment