Skip to content
Snippets Groups Projects
Commit 17e746cd authored by Adrien Kohlbecker's avatar Adrien Kohlbecker Committed by DJ Mountney
Browse files

Rename gitlab-monitor to gitlab-exporter

parent ce4ad814
No related branches found
No related tags found
No related merge requests found
Showing
with 94 additions and 66 deletions
Loading
Loading
@@ -13,9 +13,9 @@ gitlab-workhorse:
gitlab-pages:
remote: "git@dev.gitlab.org:gitlab/gitlab-pages.git"
alternative: "https://gitlab.com/gitlab-org/gitlab-pages.git"
gitlab-monitor:
gitlab-exporter:
remote: "git@dev.gitlab.org:gitlab-org/gitlab-monitor.git"
alternative: "https://gitlab.com/gitlab-org/gitlab-monitor.git"
alternative: "https://gitlab.com/gitlab-org/gitlab-exporter.git"
docker-distribution-pruner:
remote: "git@dev.gitlab.org:gitlab/docker-distribution-pruner.git"
alternative: "https://gitlab.com/gitlab-org/docker-distribution-pruner.git"
Loading
Loading
---
title: Rename gitlab-monitor to gitlab-exporter. Service name, log directory, prometheus job names and more have been updated
merge_request: 3517
author:
type: other
Loading
Loading
@@ -99,7 +99,7 @@ dependency 'grafana-dashboards'
dependency 'node-exporter'
dependency 'redis-exporter'
dependency 'postgres-exporter'
dependency 'gitlab-monitor'
dependency 'gitlab-exporter'
dependency 'gitlab-workhorse'
dependency 'gitlab-shell'
dependency 'gitlab-ctl'
Loading
Loading
Loading
Loading
@@ -14,8 +14,8 @@
# limitations under the License.
#
 
name 'gitlab-monitor'
default_version '4.2.0'
name 'gitlab-exporter'
default_version '5.0.0'
license 'MIT'
license_file 'LICENSE'
 
Loading
Loading
@@ -27,5 +27,5 @@ dependency 'postgresql'
 
build do
env = with_standard_compiler_flags(with_embedded_path)
gem "install gitlab-monitor --no-document --version #{version}", env: env
gem "install gitlab-exporter --no-document --version #{version}", env: env
end
Loading
Loading
@@ -156,8 +156,8 @@ repos:
replace_in_files:
config/software/exiftool.rb: version = Gitlab::Version.new('exiftool', '{version_clean}')
 
# gitlab-monitor
- url: https://gitlab.com/gitlab-org/gitlab-monitor.git
# gitlab-exporter
- url: https://gitlab.com/gitlab-org/gitlab-exporter.git
installed: v3.2.0
replace_in_files:
config/software/gitlab-monitor.rb: version = Gitlab::Version.new('gitlab-monitor', '{version_clean}')
config/software/gitlab-exporter.rb: version = Gitlab::Version.new('gitlab-exporter', '{version_clean}')
Loading
Loading
@@ -22,7 +22,7 @@ by default:
| <a name="redis-exporter"></a> Redis exporter | Yes | Port | X | 9121 |
| <a name="postgres-exporter"></a> Postgres exporter | Yes | Port | X | 9187 |
| <a name="pgbouncer-exporter"></a> PgBouncer exporter | No | Port | X | 9188 |
| <a name="gitlab-monitor"></a> GitLab Monitor | Yes | Port | X | 9168 |
| <a name="gitlab-exporter"></a> GitLab Exporter | Yes | Port | X | 9168 |
| <a name="sidekiq-exporter"></a> Sidekiq exporter | Yes | Port | X | 8082 |
| <a name="geo-postgresql"></a> Geo PostgreSQL | No | Socket | Port (5431) | X |
| <a name="redis-sentinel"></a> Redis Sentinel | No | Port | X | 26379 |
Loading
Loading
Loading
Loading
@@ -487,7 +487,7 @@ Run `sudo gitlab-ctl reconfigure` for the change to take effect.
 
## Configuring runtime directory
 
When Prometheus monitoring is enabled, GitLab-monitor will conduct measurements
When Prometheus monitoring is enabled, gitlab-exporter will conduct measurements
of each Unicorn process (Rails metrics). Every Unicorn process will need to write
a metrics file to a temporary location for each controller request.
Prometheus will then collect all these files and process their values.
Loading
Loading
Loading
Loading
@@ -1608,22 +1608,22 @@ external_url 'GENERATED_EXTERNAL_URL'
# }
 
################################################################################
## Prometheus Gitlab monitor
##! Docs: https://docs.gitlab.com/ce/administration/monitoring/prometheus/gitlab_monitor_exporter.html
## Prometheus Gitlab exporter
##! Docs: https://docs.gitlab.com/ce/administration/monitoring/prometheus/gitlab_exporter.html
################################################################################
 
 
# gitlab_monitor['enable'] = true
# gitlab_monitor['log_directory'] = "/var/log/gitlab/gitlab-monitor"
# gitlab_monitor['home'] = "/var/opt/gitlab/gitlab-monitor"
# gitlab_exporter['enable'] = true
# gitlab_exporter['log_directory'] = "/var/log/gitlab/gitlab-exporter"
# gitlab_exporter['home'] = "/var/opt/gitlab/gitlab-exporter"
 
##! Advanced settings. Should be changed only if absolutely needed.
# gitlab_monitor['listen_address'] = 'localhost'
# gitlab_monitor['listen_port'] = '9168'
# gitlab_exporter['listen_address'] = 'localhost'
# gitlab_exporter['listen_port'] = '9168'
 
##! Manage gitlab-monitor sidekiq probes. false by default when Sentinels are
##! Manage gitlab-exporter sidekiq probes. false by default when Sentinels are
##! found.
# gitlab_monitor['probe_sidekiq'] = true
# gitlab_exporter['probe_sidekiq'] = true
 
# To completely disable prometheus, and all of it's exporters, set to false
# prometheus_monitoring['enable'] = true
Loading
Loading
Loading
Loading
@@ -98,7 +98,7 @@ class AccountHelper
'geo-logcursor' => { username: gitlab_user, group: gitlab_group },
'geo-postgresql' => { username: postgresql_user, group: postgresql_group },
'gitaly' => { username: gitlab_user, group: gitlab_group },
'gitlab-monitor' => { username: gitlab_user, group: gitlab_group },
'gitlab-exporter' => { username: gitlab_user, group: gitlab_group },
'gitlab-pages' => { username: gitlab_user, group: gitlab_group },
'gitlab-rails' => { username: gitlab_user, group: gitlab_group },
'gitlab-shell' => { username: gitlab_user, group: gitlab_group },
Loading
Loading
Loading
Loading
@@ -17,19 +17,30 @@
require_relative 'redis_uri.rb'
require_relative 'redis_helper.rb'
 
module GitlabMonitor
module GitlabExporter
class << self
def parse_variables
parse_gitlab_monitor_settings
convert_legacy_settings
parse_gitlab_exporter_settings
end
 
def parse_gitlab_monitor_settings
# By default, disable sidekiq probe of gitlab-monitor if Redis sentinels
# The `gitlab_monitor` settings entry is deprecated and will be removed in Gitlab 13.0
# Remove this method when preparing this release
def convert_legacy_settings
return unless Gitlab.key?('gitlab_monitor')
Gitlab['gitlab_monitor'].keys.each do |key|
Gitlab['gitlab_exporter'][key] = Gitlab['gitlab_monitor'][key] unless Gitlab['gitlab_exporter'].key?(key)
end
end
def parse_gitlab_exporter_settings
# By default, disable sidekiq probe of gitlab-exporter if Redis sentinels
# are found. If user has explicitly specified something in gitlab.rb, use
# that.
return if Gitlab['gitlab_monitor'].key?('probe_sidekiq') && !Gitlab['gitlab_monitor']['probe_sidekiq'].nil?
return if Gitlab['gitlab_exporter'].key?('probe_sidekiq') && !Gitlab['gitlab_exporter']['probe_sidekiq'].nil?
 
Gitlab['gitlab_monitor']['probe_sidekiq'] = !RedisHelper::Checks.has_sentinels?
Gitlab['gitlab_exporter']['probe_sidekiq'] = !RedisHelper::Checks.has_sentinels?
end
end
end
Loading
Loading
@@ -43,7 +43,7 @@ module Logging
gitlab-pages
gitlab-shell
gitlab-workhorse
gitlab-monitor
gitlab-exporter
grafana
logrotate
mailroom
Loading
Loading
Loading
Loading
@@ -78,14 +78,14 @@ default['monitoring']['postgres-exporter']['env'] = {
}
 
####
# Gitlab monitor
# Gitlab exporter
###
default['monitoring']['gitlab-monitor']['enable'] = false
default['monitoring']['gitlab-monitor']['log_directory'] = "/var/log/gitlab/gitlab-monitor"
default['monitoring']['gitlab-monitor']['home'] = "/var/opt/gitlab/gitlab-monitor"
default['monitoring']['gitlab-monitor']['listen_address'] = 'localhost'
default['monitoring']['gitlab-monitor']['listen_port'] = '9168'
default['monitoring']['gitlab-monitor']['probe_sidekiq'] = true
default['monitoring']['gitlab-exporter']['enable'] = false
default['monitoring']['gitlab-exporter']['log_directory'] = "/var/log/gitlab/gitlab-exporter"
default['monitoring']['gitlab-exporter']['home'] = "/var/opt/gitlab/gitlab-exporter"
default['monitoring']['gitlab-exporter']['listen_address'] = 'localhost'
default['monitoring']['gitlab-exporter']['listen_port'] = '9168'
default['monitoring']['gitlab-exporter']['probe_sidekiq'] = true
 
# To completely disable prometheus, and all of it's exporters, set to false
default['gitlab']['prometheus-monitoring']['enable'] = true
Loading
Loading
Loading
Loading
@@ -224,7 +224,7 @@ module Prometheus
return unless Services.enabled?('prometheus')
 
gitaly_scrape_config
gitlab_monitor_scrape_configs
gitlab_exporter_scrape_configs
registry_scrape_config
sidekiq_scrape_config
rails_scrape_configs
Loading
Loading
@@ -266,34 +266,34 @@ module Prometheus
Gitlab['prometheus']['scrape_configs'] = default_scrape_configs.compact.flatten
end
 
def gitlab_monitor_scrape_configs
# Don't parse if gitlab_monitor is explicitly disabled
return unless Services.enabled?('gitlab_monitor')
def gitlab_exporter_scrape_configs
# Don't parse if gitlab_exporter is explicitly disabled
return unless Services.enabled?('gitlab_exporter')
 
default_config = Gitlab['node']['monitoring']['gitlab-monitor'].to_hash
user_config = Gitlab['gitlab_monitor']
default_config = Gitlab['node']['monitoring']['gitlab-exporter'].to_hash
user_config = Gitlab['gitlab_exporter']
 
listen_address = user_config['listen_address'] || default_config['listen_address']
listen_port = user_config['listen_port'] || default_config['listen_port']
prometheus_target = [listen_address, listen_port].join(':')
 
# Include gitlab-monitor defaults scrape config.
# Include gitlab-exporter defaults scrape config.
database = {
'job_name' => 'gitlab_monitor_database',
'job_name' => 'gitlab_exporter_database',
'metrics_path' => '/database',
'static_configs' => [
'targets' => [prometheus_target],
]
}
sidekiq = {
'job_name' => 'gitlab_monitor_sidekiq',
'job_name' => 'gitlab_exporter_sidekiq',
'metrics_path' => '/sidekiq',
'static_configs' => [
'targets' => [prometheus_target],
]
}
process = {
'job_name' => 'gitlab_monitor_process',
'job_name' => 'gitlab_exporter_process',
'metrics_path' => '/process',
'static_configs' => [
'targets' => [prometheus_target],
Loading
Loading
Loading
Loading
@@ -18,16 +18,27 @@
account_helper = AccountHelper.new(node)
redis_helper = RedisHelper.new(node)
gitlab_user = account_helper.gitlab_user
gitlab_monitor_dir = node['monitoring']['gitlab-monitor']['home']
gitlab_monitor_log_dir = node['monitoring']['gitlab-monitor']['log_directory']
gitlab_exporter_dir = node['monitoring']['gitlab-exporter']['home']
gitlab_exporter_log_dir = node['monitoring']['gitlab-exporter']['log_directory']
 
directory gitlab_monitor_dir do
directory gitlab_exporter_dir do
owner gitlab_user
mode "0755"
recursive true
end
 
directory gitlab_monitor_log_dir do
# This runit service was made obsolete in 12.3
runit_service "gitlab-monitor" do
action :disable
end
# This legacy directory was made obsolete in 12.3
directory '/var/opt/gitlab/gitlab-monitor' do
action :delete
recursive true
end
directory gitlab_exporter_log_dir do
owner gitlab_user
mode "0700"
recursive true
Loading
Loading
@@ -43,34 +54,34 @@ connection_string += if node['postgresql']['enabled']
 
redis_url = redis_helper.redis_url(support_sentinel_groupname: false)
 
template "#{gitlab_monitor_dir}/gitlab-monitor.yml" do
source "gitlab-monitor.yml.erb"
template "#{gitlab_exporter_dir}/gitlab-exporter.yml" do
source "gitlab-exporter.yml.erb"
owner gitlab_user
mode "0600"
notifies :restart, "service[gitlab-monitor]"
notifies :restart, "service[gitlab-exporter]"
variables(
probe_sidekiq: node['monitoring']['gitlab-monitor']['probe_sidekiq'],
probe_sidekiq: node['monitoring']['gitlab-exporter']['probe_sidekiq'],
redis_url: redis_url,
connection_string: connection_string,
redis_enable_client: node['gitlab']['gitlab-rails']['redis_enable_client']
)
end
 
# If a version of ruby changes restart gitlab-monitor
file File.join(gitlab_monitor_dir, 'RUBY_VERSION') do
# If a version of ruby changes restart gitlab-exporter
file File.join(gitlab_exporter_dir, 'RUBY_VERSION') do
content VersionHelper.version('/opt/gitlab/embedded/bin/ruby --version')
notifies :restart, 'service[gitlab-monitor]'
notifies :restart, 'service[gitlab-exporter]'
end
 
runit_service "gitlab-monitor" do
runit_service "gitlab-exporter" do
options({
log_directory: gitlab_monitor_log_dir
log_directory: gitlab_exporter_log_dir
}.merge(params))
log_options node['gitlab']['logging'].to_hash.merge(node['monitoring']['gitlab-monitor'].to_hash)
log_options node['gitlab']['logging'].to_hash.merge(node['monitoring']['gitlab-exporter'].to_hash)
end
 
if node['gitlab']['bootstrap']['enable']
execute "/opt/gitlab/bin/gitlab-ctl start gitlab-monitor" do
execute "/opt/gitlab/bin/gitlab-ctl start gitlab-exporter" do
retries 20
end
end
Loading
Loading
@@ -16,6 +16,6 @@
# limitations under the License.
#
 
runit_service "gitlab-monitor" do
runit_service "gitlab-exporter" do
action :disable
end
Loading
Loading
@@ -6,8 +6,8 @@ db_common: &db_common
 
# Web server config
server:
listen_address: <%= node['monitoring']['gitlab-monitor']['listen_address'] %>
listen_port: <%= node['monitoring']['gitlab-monitor']['listen_port'] %>
listen_address: <%= node['monitoring']['gitlab-exporter']['listen_address'] %>
listen_port: <%= node['monitoring']['gitlab-exporter']['listen_port'] %>
 
# Probes config
probes:
Loading
Loading
Loading
Loading
@@ -5,5 +5,5 @@ umask 077
exec chpst -P \
-U <%= node['gitlab']['user']['username'] %>:<%= node['gitlab']['user']['group'] %> \
-u <%= node['gitlab']['user']['username'] %>:<%= node['gitlab']['user']['group'] %> \
/opt/gitlab/embedded/bin/gitlab-mon web \
-c <%= node['monitoring']['gitlab-monitor']['home'] %>/gitlab-monitor.yml
/opt/gitlab/embedded/bin/gitlab-exporter web \
-c <%= node['monitoring']['gitlab-exporter']['home'] %>/gitlab-exporter.yml
Loading
Loading
@@ -64,7 +64,8 @@ module Gitlab
attribute('node_exporter', priority: 30)
attribute('redis_exporter', priority: 30)
attribute('postgres_exporter', priority: 30)
attribute('gitlab_monitor', priority: 30).use { GitlabMonitor }
attribute('gitlab_exporter', priority: 30).use { GitlabExporter }
attribute('gitlab_monitor', priority: 30) # legacy, remove in 13.0
end
 
## Attributes under node['gitlab']
Loading
Loading
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