From cf932df2348dc3ccd06ca557b68edc60f518c893 Mon Sep 17 00:00:00 2001 From: Pawel Chojnacki Date: Fri, 19 May 2017 15:10:15 +0200 Subject: [PATCH] Add Prometheus metrics configuration + Cleanup Gemfile --- Gemfile | 4 ++++ .../application_settings/_form.html.haml | 19 +++++++++++++++++-- ...prometheus_settings_to_metrics_settings.rb | 13 +++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20170519102115_add_prometheus_settings_to_metrics_settings.rb diff --git a/Gemfile b/Gemfile index c49b60ffc23..a6b0a20ef61 100644 --- a/Gemfile +++ b/Gemfile @@ -268,6 +268,10 @@ group :metrics do gem 'allocations', '~> 1.0', require: false, platform: :mri gem 'method_source', '~> 0.8', require: false gem 'influxdb', '~> 0.2', require: false + +# Prometheus + gem 'mmap2', '~> 2.2.6' + gem 'prometheus-client-mmap' end group :development do diff --git a/app/views/admin/application_settings/_form.html.haml b/app/views/admin/application_settings/_form.html.haml index e1b4e34cd2b..3c020c71832 100644 --- a/app/views/admin/application_settings/_form.html.haml +++ b/app/views/admin/application_settings/_form.html.haml @@ -232,9 +232,9 @@ = f.number_field :container_registry_token_expire_delay, class: 'form-control' %fieldset - %legend Metrics + %legend Metrics - Influx %p - Setup InfluxDB to measure a wide variety of statistics like the time spent + Setup Influx to measure a wide variety of statistics like the time spent in running SQL queries. These settings require a = link_to 'restart', help_page_path('administration/restart_gitlab') to take effect. @@ -296,6 +296,21 @@ The amount of points to store in a single UDP packet. More points results in fewer but larger UDP packets being sent. + %fieldset + %legend Metrics - Prometheus + %p + Setup Prometheus to measure a variety of statistics that partially overlap and complement Influx based metrics. + This setting requires a + = link_to 'restart', help_page_path('administration/restart_gitlab') + to take effect. + = link_to icon('question-circle'), help_page_path('administration/monitoring/performance/introduction') + .form-group + .col-sm-offset-2.col-sm-10 + .checkbox + = f.label :prometheus_metrics_enabled do + = f.check_box :prometheus_metrics_enabled + Enable Prometheus Metrics + %fieldset %legend Background Jobs %p diff --git a/db/migrate/20170519102115_add_prometheus_settings_to_metrics_settings.rb b/db/migrate/20170519102115_add_prometheus_settings_to_metrics_settings.rb new file mode 100644 index 00000000000..e675fb7cd58 --- /dev/null +++ b/db/migrate/20170519102115_add_prometheus_settings_to_metrics_settings.rb @@ -0,0 +1,13 @@ +class AddPrometheusSettingsToMetricsSettings < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + + def up + add_column_with_default(:application_settings, :prometheus_metrics_enabled, :boolean, + default: false, allow_null: false) + end + + def down + remove_column(:application_settings, :prometheus_metrics_enabled) + end +end