Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-04-19 15:27:08 +0300
committerYorick Peterse <yorickpeterse@gmail.com>2016-04-19 15:35:25 +0300
commit229f3ce9cec8d525d960cabc7a915b47dfdcd910 (patch)
tree7707c50a6f115275c9c59efa29287ffbd972a928 /lib/gitlab/metrics.rb
parentbfa16dbcfba2a3233209f6403a0074d42e664df6 (diff)
Configuring of points per UDP packet
This allows users to configure the number of points stored in a single UDP packet. This in turn can be used to reduce the number of UDP packets being sent at the cost of these packets being somewhat larger. The default setting is 1 point per packet so nothing changes for existing users.
Diffstat (limited to 'lib/gitlab/metrics.rb')
-rw-r--r--lib/gitlab/metrics.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/gitlab/metrics.rb b/lib/gitlab/metrics.rb
index 484970c5a10..f82dce14865 100644
--- a/lib/gitlab/metrics.rb
+++ b/lib/gitlab/metrics.rb
@@ -14,7 +14,8 @@ module Gitlab
method_call_threshold: current_application_settings[:metrics_method_call_threshold],
host: current_application_settings[:metrics_host],
port: current_application_settings[:metrics_port],
- sample_interval: current_application_settings[:metrics_sample_interval] || 15
+ sample_interval: current_application_settings[:metrics_sample_interval] || 15,
+ packet_size: current_application_settings[:metrics_packet_size] || 1
}
end
@@ -41,9 +42,9 @@ module Gitlab
prepared = prepare_metrics(metrics)
pool.with do |connection|
- prepared.each do |metric|
+ prepared.each_slice(settings[:packet_size]) do |slice|
begin
- connection.write_points([metric])
+ connection.write_points(slice)
rescue StandardError
end
end