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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
3b9ab3f5
Commit
3b9ab3f5
authored
Dec 17, 2018
by
Joshua Lambert
Committed by
Mike Greiling
Dec 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add NGINX 0.16.0 and above metrics
parent
735d24f3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
96 additions
and
18 deletions
+96
-18
app/assets/javascripts/monitoring/utils/multiple_time_series.js
...sets/javascripts/monitoring/utils/multiple_time_series.js
+18
-14
app/models/prometheus_metric.rb
app/models/prometheus_metric.rb
+5
-2
changelogs/unreleased/add-new-nginx-metrics.yml
changelogs/unreleased/add-new-nginx-metrics.yml
+5
-0
config/prometheus/common_metrics.yml
config/prometheus/common_metrics.yml
+47
-1
db/importers/common_metrics_importer.rb
db/importers/common_metrics_importer.rb
+3
-1
db/migrate/20181006004100_import_common_metrics_nginx_vts.rb
db/migrate/20181006004100_import_common_metrics_nginx_vts.rb
+15
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
No files found.
app/assets/javascripts/monitoring/utils/multiple_time_series.js
View file @
3b9ab3f5
...
...
@@ -92,7 +92,11 @@ function queryTimeSeries(query, graphDrawData, lineStyle) {
if
(
seriesCustomizationData
)
{
metricTag
=
seriesCustomizationData
.
value
||
timeSeriesMetricLabel
;
[
lineColor
,
areaColor
]
=
pickColor
(
seriesCustomizationData
.
color
);
shouldRenderLegend
=
false
;
if
(
timeSeriesParsed
.
length
>
0
)
{
shouldRenderLegend
=
false
;
}
else
{
shouldRenderLegend
=
true
;
}
}
else
{
metricTag
=
timeSeriesMetricLabel
||
query
.
label
||
`series
${
timeSeriesNumber
+
1
}
`
;
[
lineColor
,
areaColor
]
=
pickColor
();
...
...
@@ -101,19 +105,6 @@ function queryTimeSeries(query, graphDrawData, lineStyle) {
}
}
if
(
!
shouldRenderLegend
)
{
if
(
!
timeSeriesParsed
[
0
].
tracksLegend
)
{
timeSeriesParsed
[
0
].
tracksLegend
=
[];
}
timeSeriesParsed
[
0
].
tracksLegend
.
push
({
max
:
maximumValue
,
average
:
accum
/
timeSeries
.
values
.
length
,
lineStyle
,
lineColor
,
metricTag
,
});
}
const
values
=
datesWithoutGaps
.
map
(
time
=>
({
time
,
value
:
findByDate
(
timeSeries
.
values
,
time
),
...
...
@@ -135,6 +126,19 @@ function queryTimeSeries(query, graphDrawData, lineStyle) {
shouldRenderLegend
,
renderCanary
,
});
if
(
!
shouldRenderLegend
)
{
if
(
!
timeSeriesParsed
[
0
].
tracksLegend
)
{
timeSeriesParsed
[
0
].
tracksLegend
=
[];
}
timeSeriesParsed
[
0
].
tracksLegend
.
push
({
max
:
maximumValue
,
average
:
accum
/
timeSeries
.
values
.
length
,
lineStyle
,
lineColor
,
metricTag
,
});
}
});
return
timeSeriesParsed
;
...
...
app/models/prometheus_metric.rb
View file @
3b9ab3f5
...
...
@@ -5,11 +5,12 @@ class PrometheusMetric < ActiveRecord::Base
enum
group:
{
# built-in groups
nginx_ingress:
-
1
,
nginx_ingress
_vts
:
-
1
,
ha_proxy:
-
2
,
aws_elb:
-
3
,
nginx:
-
4
,
kubernetes:
-
5
,
nginx_ingress:
-
6
,
# custom/user groups
business:
0
,
...
...
@@ -30,6 +31,7 @@ class PrometheusMetric < ActiveRecord::Base
GROUP_TITLES
=
{
# built-in groups
nginx_ingress_vts:
_
(
'Response metrics (NGINX Ingress VTS)'
),
nginx_ingress:
_
(
'Response metrics (NGINX Ingress)'
),
ha_proxy:
_
(
'Response metrics (HA Proxy)'
),
aws_elb:
_
(
'Response metrics (AWS ELB)'
),
...
...
@@ -43,7 +45,8 @@ class PrometheusMetric < ActiveRecord::Base
}.
freeze
REQUIRED_METRICS
=
{
nginx_ingress:
%w(nginx_upstream_responses_total nginx_upstream_response_msecs_avg)
,
nginx_ingress_vts:
%w(nginx_upstream_responses_total nginx_upstream_response_msecs_avg)
,
nginx_ingress:
%w(nginx_ingress_controller_requests nginx_ingress_controller_ingress_upstream_latency_seconds_sum)
,
ha_proxy:
%w(haproxy_frontend_http_requests_total haproxy_frontend_http_responses_total)
,
aws_elb:
%w(aws_elb_request_count_sum aws_elb_latency_average aws_elb_httpcode_backend_5_xx_sum)
,
nginx:
%w(nginx_server_requests nginx_server_requestMsec)
,
...
...
changelogs/unreleased/add-new-nginx-metrics.yml
0 → 100644
View file @
3b9ab3f5
---
title
:
Add NGINX 0.16.0 and above metrics
merge_request
:
22133
author
:
type
:
added
config/prometheus/common_metrics.yml
View file @
3b9ab3f5
-
group
:
Response metrics (NGINX Ingress)
# NGINX Ingress metrics for pre-0.16.0 versions
-
group
:
Response metrics (NGINX Ingress VTS)
priority
:
10
metrics
:
-
title
:
"
Throughput"
...
...
@@ -40,6 +41,51 @@
query_range
:
'
sum(rate(nginx_upstream_responses_total{status_code="5xx",
upstream=~"%{kube_namespace}-%{ci_environment_slug}-.*"}[2m]))
/
sum(rate(nginx_upstream_responses_total{upstream=~"%{kube_namespace}-%{ci_environment_slug}-.*"}[2m]))
*
100'
label
:
5xx Errors
unit
:
"
%"
# NGINX Ingress metrics for post-0.16.0 versions
-
group
:
Response metrics (NGINX Ingress)
priority
:
10
metrics
:
-
title
:
"
Throughput"
y_label
:
"
Requests
/
Sec"
required_metrics
:
-
nginx_ingress_controller_requests
weight
:
1
queries
:
-
id
:
response_metrics_nginx_ingress_16_throughput_status_code
query_range
:
'
sum(label_replace(rate(nginx_ingress_controller_requests{namespace="%{kube_namespace}",ingress=~".*%{ci_environment_slug}.*"}[2m]),
"status_code",
"${1}xx",
"status",
"(.).."))
by
(status_code)'
unit
:
req / sec
label
:
Status Code
series
:
-
label
:
status_code
when
:
-
value
:
2xx
color
:
green
-
value
:
3xx
color
:
blue
-
value
:
4xx
color
:
orange
-
value
:
5xx
color
:
red
-
title
:
"
Latency"
y_label
:
"
Latency
(ms)"
required_metrics
:
-
nginx_ingress_controller_ingress_upstream_latency_seconds_sum
weight
:
1
queries
:
-
id
:
response_metrics_nginx_ingress_16_latency_pod_average
query_range
:
'
sum(rate(nginx_ingress_controller_ingress_upstream_latency_seconds_sum{namespace="%{kube_namespace}",ingress=~".*%{ci_environment_slug}.*"}[2m]))
/
sum(rate(nginx_ingress_controller_ingress_upstream_latency_seconds_count{namespace="%{kube_namespace}",ingress=~".*%{ci_environment_slug}.*"}[2m]))
*
1000'
label
:
Pod average
unit
:
ms
-
title
:
"
HTTP
Error
Rate"
y_label
:
"
HTTP
Errors"
required_metrics
:
-
nginx_ingress_controller_requests
weight
:
1
queries
:
-
id
:
response_metrics_nginx_ingress_16_http_error_rate
query_range
:
'
sum(rate(nginx_ingress_controller_requests{status=~"5.*",namespace="%{kube_namespace}",ingress=~".*%{ci_environment_slug}.*"}[2m]))
/
sum(rate(nginx_ingress_controller_requests{namespace="%{kube_namespace}",ingress=~".*%{ci_environment_slug}.*"}[2m]))
*
100'
label
:
5xx Errors
unit
:
"
%"
-
group
:
Response metrics (HA Proxy)
priority
:
10
metrics
:
...
...
db/importers/common_metrics_importer.rb
View file @
3b9ab3f5
...
...
@@ -4,11 +4,12 @@ module Importers
class
PrometheusMetric
<
ActiveRecord
::
Base
enum
group:
{
# built-in groups
nginx_ingress:
-
1
,
nginx_ingress
_vts
:
-
1
,
ha_proxy:
-
2
,
aws_elb:
-
3
,
nginx:
-
4
,
kubernetes:
-
5
,
nginx_ingress:
-
6
,
# custom groups
business:
0
,
...
...
@@ -22,6 +23,7 @@ module Importers
business:
_
(
'Business metrics (Custom)'
),
response:
_
(
'Response metrics (Custom)'
),
system:
_
(
'System metrics (Custom)'
),
nginx_ingress_vts:
_
(
'Response metrics (NGINX Ingress VTS)'
),
nginx_ingress:
_
(
'Response metrics (NGINX Ingress)'
),
ha_proxy:
_
(
'Response metrics (HA Proxy)'
),
aws_elb:
_
(
'Response metrics (AWS ELB)'
),
...
...
db/migrate/20181006004100_import_common_metrics_nginx_vts.rb
0 → 100644
View file @
3b9ab3f5
class
ImportCommonMetricsNginxVts
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
require
Rails
.
root
.
join
(
'db/importers/common_metrics_importer.rb'
)
DOWNTIME
=
false
def
up
Importers
::
CommonMetricsImporter
.
new
.
execute
end
def
down
# no-op
end
end
locale/gitlab.pot
View file @
3b9ab3f5
...
...
@@ -5647,6 +5647,9 @@ msgstr ""
msgid "Response metrics (HA Proxy)"
msgstr ""
msgid "Response metrics (NGINX Ingress VTS)"
msgstr ""
msgid "Response metrics (NGINX Ingress)"
msgstr ""
...
...
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