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
3a9eea3c
Commit
3a9eea3c
authored
Feb 28, 2020
by
Tristan Read
Committed by
Natalia Tepluhina
Feb 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove underscore from prometheus metrics files
parent
353dd40c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
app/assets/javascripts/prometheus_metrics/prometheus_metrics.js
...sets/javascripts/prometheus_metrics/prometheus_metrics.js
+3
-3
ee/app/assets/javascripts/prometheus_metrics/prometheus_metrics.js
...sets/javascripts/prometheus_metrics/prometheus_metrics.js
+10
-10
No files found.
app/assets/javascripts/prometheus_metrics/prometheus_metrics.js
View file @
3a9eea3c
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
_
from
'
underscore
'
;
import
{
escape
}
from
'
lodash
'
;
import
{
s__
,
n__
,
sprintf
}
from
'
~/locale
'
;
import
{
s__
,
n__
,
sprintf
}
from
'
~/locale
'
;
import
axios
from
'
../lib/utils/axios_utils
'
;
import
axios
from
'
../lib/utils/axios_utils
'
;
import
PANEL_STATE
from
'
./constants
'
;
import
PANEL_STATE
from
'
./constants
'
;
...
@@ -69,13 +69,13 @@ export default class PrometheusMetrics {
...
@@ -69,13 +69,13 @@ export default class PrometheusMetrics {
if
(
metric
.
active_metrics
>
0
)
{
if
(
metric
.
active_metrics
>
0
)
{
totalExporters
+=
1
;
totalExporters
+=
1
;
this
.
$monitoredMetricsList
.
append
(
this
.
$monitoredMetricsList
.
append
(
`<li>
${
_
.
escape
(
metric
.
group
)}
<span class="badge">
${
_
.
escape
(
`<li>
${
escape
(
metric
.
group
)}
<span class="badge">
${
escape
(
metric
.
active_metrics
,
metric
.
active_metrics
,
)}
</span></li>`
,
)}
</span></li>`
,
);
);
totalMonitoredMetrics
+=
metric
.
active_metrics
;
totalMonitoredMetrics
+=
metric
.
active_metrics
;
if
(
metric
.
metrics_missing_requirements
>
0
)
{
if
(
metric
.
metrics_missing_requirements
>
0
)
{
this
.
$missingEnvVarMetricsList
.
append
(
`<li>
${
_
.
escape
(
metric
.
group
)}
</li>`
);
this
.
$missingEnvVarMetricsList
.
append
(
`<li>
${
escape
(
metric
.
group
)}
</li>`
);
totalMissingEnvVarMetrics
+=
1
;
totalMissingEnvVarMetrics
+=
1
;
}
}
}
}
...
...
ee/app/assets/javascripts/prometheus_metrics/prometheus_metrics.js
View file @
3a9eea3c
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
_
from
'
underscore
'
;
import
{
escape
,
sortBy
}
from
'
lodash
'
;
import
PrometheusMetrics
from
'
~/prometheus_metrics/prometheus_metrics
'
;
import
PrometheusMetrics
from
'
~/prometheus_metrics/prometheus_metrics
'
;
import
PANEL_STATE
from
'
./constants
'
;
import
PANEL_STATE
from
'
./constants
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
...
@@ -61,7 +61,7 @@ export default class EEPrometheusMetrics extends PrometheusMetrics {
...
@@ -61,7 +61,7 @@ export default class EEPrometheusMetrics extends PrometheusMetrics {
}
}
setVisible
(...
els
)
{
setVisible
(...
els
)
{
this
.
setHidden
(
_
.
difference
(
this
.
$els
,
els
));
this
.
setHidden
(
this
.
$els
.
filter
(
el
=>
!
els
.
includes
(
el
)
));
els
.
forEach
(
el
=>
el
.
removeClass
(
'
hidden
'
));
els
.
forEach
(
el
=>
el
.
removeClass
(
'
hidden
'
));
}
}
...
@@ -90,12 +90,12 @@ export default class EEPrometheusMetrics extends PrometheusMetrics {
...
@@ -90,12 +90,12 @@ export default class EEPrometheusMetrics extends PrometheusMetrics {
}
}
populateCustomMetrics
()
{
populateCustomMetrics
()
{
const
sortedMetrics
=
_
(
this
.
customMetrics
)
const
capitalizeGroup
=
metric
=>
({
.
chain
()
.
..
metric
,
.
map
(
metric
=>
({
...
metric
,
group
:
capitalizeFirstCharacter
(
metric
.
group
)
}))
group
:
capitalizeFirstCharacter
(
metric
.
group
),
.
sortBy
(
'
title
'
)
});
.
sortBy
(
'
group
'
)
.
value
(
);
const
sortedMetrics
=
sortBy
(
this
.
customMetrics
.
map
(
capitalizeGroup
),
[
'
group
'
,
'
title
'
]
);
sortedMetrics
.
forEach
(
metric
=>
{
sortedMetrics
.
forEach
(
metric
=>
{
this
.
$monitoredCustomMetricsList
.
append
(
EEPrometheusMetrics
.
customMetricTemplate
(
metric
));
this
.
$monitoredCustomMetricsList
.
append
(
EEPrometheusMetrics
.
customMetricTemplate
(
metric
));
...
@@ -146,8 +146,8 @@ export default class EEPrometheusMetrics extends PrometheusMetrics {
...
@@ -146,8 +146,8 @@ export default class EEPrometheusMetrics extends PrometheusMetrics {
static
customMetricTemplate
(
metric
)
{
static
customMetricTemplate
(
metric
)
{
return
`
return
`
<li class="custom-metric">
<li class="custom-metric">
<a href="
${
_
.
escape
(
metric
.
edit_path
)}
" class="custom-metric-link-bold">
<a href="
${
escape
(
metric
.
edit_path
)}
" class="custom-metric-link-bold">
${
_
.
escape
(
metric
.
group
)}
/
${
_
.
escape
(
metric
.
title
)}
(
${
_
.
escape
(
metric
.
unit
)}
)
${
escape
(
metric
.
group
)}
/
${
escape
(
metric
.
title
)}
(
${
escape
(
metric
.
unit
)}
)
</a>
</a>
</li>
</li>
`
;
`
;
...
...
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