Commit 229f3ce9 authored by Yorick Peterse's avatar Yorick Peterse

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.
parent bfa16dbc
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
v 8.7.0 (unreleased) v 8.7.0 (unreleased)
- The number of InfluxDB points stored per UDP packet can now be configured
- Transactions for /internal/allowed now have an "action" tag set - Transactions for /internal/allowed now have an "action" tag set
- Method instrumentation now uses Module#prepend instead of aliasing methods - Method instrumentation now uses Module#prepend instead of aliasing methods
- Repository.clean_old_archives is now instrumented - Repository.clean_old_archives is now instrumented
......
...@@ -93,6 +93,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController ...@@ -93,6 +93,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
:akismet_api_key, :akismet_api_key,
:email_author_in_body, :email_author_in_body,
:repository_checks_enabled, :repository_checks_enabled,
:metrics_packet_size,
restricted_visibility_levels: [], restricted_visibility_levels: [],
import_sources: [] import_sources: []
) )
......
...@@ -218,6 +218,13 @@ ...@@ -218,6 +218,13 @@
.help-block .help-block
The sampling interval in seconds. Sampled data includes memory usage, The sampling interval in seconds. Sampled data includes memory usage,
retained Ruby objects, file descriptors and so on. retained Ruby objects, file descriptors and so on.
.form-group
= f.label :metrics_packet_size, 'Metrics per packet', class: 'control-label col-sm-2'
.col-sm-10
= f.number_field :metrics_packet_size, class: 'form-control'
.help-block
The amount of points to store in a single UDP packet. More points
results in fewer but larger UDP packets being sent.
%fieldset %fieldset
%legend Spam and Anti-bot Protection %legend Spam and Anti-bot Protection
......
class AddMetricsPacketSize < ActiveRecord::Migration
def change
add_column :application_settings, :metrics_packet_size, :integer, default: 1
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160415133440) do ActiveRecord::Schema.define(version: 20160419120017) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -78,6 +78,7 @@ ActiveRecord::Schema.define(version: 20160415133440) do ...@@ -78,6 +78,7 @@ ActiveRecord::Schema.define(version: 20160415133440) do
t.boolean "email_author_in_body", default: false t.boolean "email_author_in_body", default: false
t.integer "default_group_visibility" t.integer "default_group_visibility"
t.boolean "repository_checks_enabled", default: true t.boolean "repository_checks_enabled", default: true
t.integer "metrics_packet_size", default: 1
t.text "shared_runners_text" t.text "shared_runners_text"
end end
......
...@@ -14,7 +14,8 @@ module Gitlab ...@@ -14,7 +14,8 @@ module Gitlab
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 sample_interval: current_application_settings[:metrics_sample_interval] || 15,
packet_size: current_application_settings[:metrics_packet_size] || 1
} }
end end
...@@ -41,9 +42,9 @@ module Gitlab ...@@ -41,9 +42,9 @@ module Gitlab
prepared = prepare_metrics(metrics) prepared = prepare_metrics(metrics)
pool.with do |connection| pool.with do |connection|
prepared.each do |metric| prepared.each_slice(settings[:packet_size]) do |slice|
begin begin
connection.write_points([metric]) connection.write_points(slice)
rescue StandardError rescue StandardError
end end
end end
......
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