Skip to content
Snippets Groups Projects
Commit cb9550bb authored by John Cai's avatar John Cai
Browse files

Add praefect prometheus_exclude_database_from_default_metrics config value

Praefect has a new configuration value to control whether or not it will
hit the database for metrics. This change adds the
prometheus_exclude_database_from_default_metrics config value and writes
it into the right place in the praefect config toml.

Changelog: added
parent bd7cff9c
No related branches found
No related tags found
Loading
......@@ -37,6 +37,7 @@ default['praefect']['database_direct_sslmode'] = nil
default['praefect']['database_direct_sslcert'] = nil
default['praefect']['database_direct_sslkey'] = nil
default['praefect']['database_direct_sslrootcert'] = nil
default['praefect']['separate_database_metrics'] = false
default['praefect']['tls_listen_addr'] = nil
default['praefect']['certificate_path'] = nil
default['praefect']['key_path'] = nil
......
......@@ -19,6 +19,12 @@ socket_path = '<%= @socket_path %>'
prometheus_listen_addr = '<%= @prometheus_listen_addr %>'
<% end %>
<% if @separate_database_metrics %>
# Optional: when set to true, metrics that query the database will no longer be
# available on the /metrics endpoint but will be available on the /db_metrics endpoint
prometheus_exclude_database_from_default_metrics = <%= @separate_database_metrics %>
<% end %>
<% if @tls_listen_addr %>
# Optional: listen on a secure TCP socket
tls_listen_addr = '<%= @tls_listen_addr %>'
......
......@@ -49,7 +49,7 @@ RSpec.describe 'praefect' do
'session_pooled' => {},
},
'reconciliation' => {},
'failover' => { 'enabled' => true }
'failover' => { 'enabled' => true },
}
expect(chef_run).to render_file(config_path).with_content { |content|
......@@ -118,6 +118,7 @@ RSpec.describe 'praefect' do
let(:database_direct_port) { 1234 }
let(:reconciliation_scheduling_interval) { '1m' }
let(:reconciliation_histogram_buckets) { '[1.0, 2.0]' }
let(:separate_database_metrics) { true }
before do
stub_gitlab_rb(praefect: {
......@@ -150,7 +151,8 @@ RSpec.describe 'praefect' do
database_direct_host: database_direct_host,
database_direct_port: database_direct_port,
reconciliation_scheduling_interval: reconciliation_scheduling_interval,
reconciliation_histogram_buckets: reconciliation_histogram_buckets
reconciliation_histogram_buckets: reconciliation_histogram_buckets,
separate_database_metrics: separate_database_metrics
})
end
......@@ -186,7 +188,7 @@ RSpec.describe 'praefect' do
},
'listen_addr' => 'localhost:4444',
'prometheus' => {
'grpc_latency_buckets' => [0.001, 0.005, 0.025, 0.1, 0.5, 1.0, 10.0, 30.0, 60.0, 300.0, 1500.0]
'grpc_latency_buckets' => [0.001, 0.005, 0.025, 0.1, 0.5, 1.0, 10.0, 30.0, 60.0, 300.0, 1500.0],
},
'reconciliation' => {
'histogram_buckets' => [1.0, 2.0],
......@@ -203,6 +205,7 @@ RSpec.describe 'praefect' do
'key_path' => '/path/to/key.pem'
},
'tls_listen_addr' => 'localhost:5555',
'prometheus_exclude_database_from_default_metrics' => true,
'virtual_storage' => [
{
'name' => 'default',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment