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.
This commit is contained in:
Yorick Peterse
2016-04-19 14:35:25 +02:00
parent bfa16dbcfb
commit 229f3ce9ce
6 changed files with 40 additions and 24 deletions
+4 -3
View File
@@ -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