Commit 23671600 authored by Yorick Peterse's avatar Yorick Peterse

Make the metrics sampler interval configurable

parent 83ad5fa5
...@@ -73,6 +73,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -73,6 +73,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:metrics_pool_size, :metrics_pool_size,
:metrics_timeout, :metrics_timeout,
:metrics_method_call_threshold, :metrics_method_call_threshold,
:metrics_sample_interval,
:recaptcha_enabled, :recaptcha_enabled,
:recaptcha_site_key, :recaptcha_site_key,
:recaptcha_private_key, :recaptcha_private_key,
......
...@@ -202,6 +202,13 @@ ...@@ -202,6 +202,13 @@
.help-block .help-block
A method call is only tracked when it takes longer to complete than A method call is only tracked when it takes longer to complete than
the given amount of milliseconds. the given amount of milliseconds.
.form-group
= f.label :metrics_sample_interval, 'Sampler Interval (sec)', class: 'control-label col-sm-2'
.col-sm-10
= f.number_field :metrics_sample_interval, class: 'form-control'
.help-block
The sampling interval in seconds. Sampled data includes memory usage,
retained Ruby objects, file descriptors and so on.
%fieldset %fieldset
%legend Spam and Anti-bot Protection %legend Spam and Anti-bot Protection
......
class AddMetricsSampleInterval < ActiveRecord::Migration
def change
add_column :application_settings, :metrics_sample_interval, :integer,
default: 15
end
end
This diff is collapsed.
...@@ -13,7 +13,8 @@ module Gitlab ...@@ -13,7 +13,8 @@ module Gitlab
timeout: current_application_settings[:metrics_timeout], timeout: current_application_settings[:metrics_timeout],
method_call_threshold: current_application_settings[:metrics_method_call_threshold], method_call_threshold: current_application_settings[:metrics_method_call_threshold],
host: current_application_settings[:metrics_host], 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
} }
end end
......
...@@ -7,7 +7,7 @@ module Gitlab ...@@ -7,7 +7,7 @@ module Gitlab
# statistics, etc. # statistics, etc.
class Sampler class Sampler
# interval - The sampling interval in seconds. # interval - The sampling interval in seconds.
def initialize(interval = 15) def initialize(interval = Metrics.settings[:sample_interval])
@interval = interval @interval = interval
@metrics = [] @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