BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
902d2600
Commit
902d2600
authored
Mar 24, 2017
by
Jose Ivan Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a number input to provide a way to format the number of
desired decimals for the cpu metrics
parent
8efd2301
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
8 deletions
+25
-8
dispatcher.js
app/assets/javascripts/dispatcher.js
+0
-1
prometheus_graph.js
app/assets/javascripts/monitoring/prometheus_graph.js
+15
-5
metrics.html.haml
app/views/projects/environments/metrics.html.haml
+10
-2
No files found.
app/assets/javascripts/dispatcher.js
View file @
902d2600
...
...
@@ -43,7 +43,6 @@ import GroupsList from './groups_list';
import
ProjectsList
from
'./projects_list'
;
import
MiniPipelineGraph
from
'./mini_pipeline_graph_dropdown'
;
import
BlobLinePermalinkUpdater
from
'./blob/blob_line_permalink_updater'
;
import
PrometheusGraph
from
'./monitoring/prometheus_graph'
;
import
UserCallout
from
'./user_callout'
;
const
ShortcutsBlob
=
require
(
'./shortcuts_blob'
);
...
...
app/assets/javascripts/monitoring/prometheus_graph.js
View file @
902d2600
...
...
@@ -25,6 +25,7 @@ class PrometheusGraph {
this
.
width
=
parentContainerWidth
-
this
.
margin
.
left
-
this
.
margin
.
right
;
this
.
height
=
this
.
originalHeight
-
this
.
margin
.
top
-
this
.
margin
.
bottom
;
this
.
backOffRequestCounter
=
0
;
this
.
cpuNumberFormatInput
=
$
(
'input[graph-type="cpu_values"]'
);
this
.
configureGraph
();
this
.
init
();
}
...
...
@@ -270,8 +271,15 @@ class PrometheusGraph {
.
attr
(
'y'
,
maxMetricValue
+
15
)
.
text
(
dayFormat
(
currentData
.
time
));
let
currentMetricValue
=
currentData
.
value
;
if
(
key
===
'cpu_values'
)
{
currentMetricValue
=
Number
(
currentMetricValue
).
toFixed
(
this
.
cpuNumberFormatInput
.
val
());
currentMetricValue
=
`
${
currentMetricValue
}
%`
;
}
else
{
currentMetricValue
=
currentMetricValue
.
substring
(
0
,
8
);
}
d3
.
select
(
`
${
currentPrometheusGraphContainer
}
.text-metric-usage`
)
.
text
(
current
Data
.
value
.
substring
(
0
,
8
)
);
.
text
(
current
MetricValue
);
});
}
...
...
@@ -344,10 +352,12 @@ class PrometheusGraph {
Object
.
keys
(
metricsResponse
.
metrics
).
forEach
((
key
)
=>
{
if
(
key
===
'cpu_values'
||
key
===
'memory_values'
)
{
const
metricValues
=
(
metricsResponse
.
metrics
[
key
])[
0
];
this
.
graphSpecificProperties
[
key
].
data
=
metricValues
.
values
.
map
(
metric
=>
({
time
:
new
Date
(
metric
[
0
]
*
1000
),
value
:
metric
[
1
],
}));
if
(
typeof
metricValues
!==
'undefined'
)
{
this
.
graphSpecificProperties
[
key
].
data
=
metricValues
.
values
.
map
(
metric
=>
({
time
:
new
Date
(
metric
[
0
]
*
1000
),
value
:
metric
[
1
],
}));
}
}
});
}
...
...
app/views/projects/environments/metrics.html.haml
View file @
902d2600
...
...
@@ -19,8 +19,16 @@
=
render
'projects/deployments/actions'
,
deployment:
@environment
.
last_deployment
.row
.col-sm-12
%h4
CPU utilization
.row
.col-sm-10
%h4
CPU utilization
.col-sm-2.form-horizontal
.form-group
%label
{
for:
'decimal_format'
,
class
:'control-label col-sm-6'
}
Format
.col-sm-6
%input
.form-control
{
name:
'decimal_format'
,
type:
'number'
,
value:
'4'
,
'graph-type'
:
'cpu_values'
,
min:
'1'
}
%svg
.prometheus-graph
{
'graph-type'
=>
'cpu_values'
}
.row
.col-sm-12
...
...
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