Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a9d0deeb
Commit
a9d0deeb
authored
May 07, 2018
by
Felipe Artur
Committed by
Douwe Maan
May 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable prometheus metrics by default
parent
1492cf8f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
6 deletions
+29
-6
changelogs/unreleased/issue_43660.yml
changelogs/unreleased/issue_43660.yml
+5
-0
config/initializers/8_metrics.rb
config/initializers/8_metrics.rb
+8
-1
db/migrate/20180503200320_enable_prometheus_metrics_by_default.rb
...te/20180503200320_enable_prometheus_metrics_by_default.rb
+11
-0
db/schema.rb
db/schema.rb
+2
-2
spec/db/production/settings_spec.rb
spec/db/production/settings_spec.rb
+3
-3
No files found.
changelogs/unreleased/issue_43660.yml
0 → 100644
View file @
a9d0deeb
---
title
:
Enable prometheus monitoring by default
merge_request
:
author
:
type
:
other
config/initializers/8_metrics.rb
View file @
a9d0deeb
...
...
@@ -119,7 +119,14 @@ def instrument_classes(instrumentation)
end
# rubocop:enable Metrics/AbcSize
if
Gitlab
::
Metrics
.
enabled?
# With prometheus enabled by default this breaks all specs
# that stubs methods using `any_instance_of` for the models reloaded here.
#
# We should deprecate the usage of `any_instance_of` in the future
# check: https://github.com/rspec/rspec-mocks#settings-mocks-or-stubs-on-any-instance-of-a-class
#
# Related issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/33587
if
Gitlab
::
Metrics
.
enabled?
&&
!
Rails
.
env
.
test?
require
'pathname'
require
'influxdb'
require
'connection_pool'
...
...
db/migrate/20180503200320_enable_prometheus_metrics_by_default.rb
0 → 100644
View file @
a9d0deeb
class
EnablePrometheusMetricsByDefault
<
ActiveRecord
::
Migration
DOWNTIME
=
false
def
up
change_column_default
:application_settings
,
:prometheus_metrics_enabled
,
true
end
def
down
change_column_default
:application_settings
,
:prometheus_metrics_enabled
,
false
end
end
db/schema.rb
View file @
a9d0deeb
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20180503
175054
)
do
ActiveRecord
::
Schema
.
define
(
version:
20180503
200320
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -134,7 +134,7 @@ ActiveRecord::Schema.define(version: 20180503175054) do
t
.
integer
"cached_markdown_version"
t
.
boolean
"clientside_sentry_enabled"
,
default:
false
,
null:
false
t
.
string
"clientside_sentry_dsn"
t
.
boolean
"prometheus_metrics_enabled"
,
default:
fals
e
,
null:
false
t
.
boolean
"prometheus_metrics_enabled"
,
default:
tru
e
,
null:
false
t
.
boolean
"help_page_hide_commercial_content"
,
default:
false
t
.
string
"help_page_support_url"
t
.
integer
"performance_bar_allowed_group_id"
...
...
spec/db/production/settings_spec.rb
View file @
a9d0deeb
...
...
@@ -48,15 +48,15 @@ describe 'seed production settings' do
end
end
context
'GITLAB_PROMETHEUS_METRICS_ENABLED is
false
'
do
context
'GITLAB_PROMETHEUS_METRICS_ENABLED is
default
'
do
before
do
stub_env
(
'GITLAB_PROMETHEUS_METRICS_ENABLED'
,
''
)
end
it
'prometheus_metrics_enabled is set to
fals
e'
do
it
'prometheus_metrics_enabled is set to
tru
e'
do
load
(
settings_file
)
expect
(
settings
.
prometheus_metrics_enabled
).
to
eq
(
fals
e
)
expect
(
settings
.
prometheus_metrics_enabled
).
to
eq
(
tru
e
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment