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
Boxiang Sun
gitlab-ce
Commits
5cccbde4
Commit
5cccbde4
authored
May 31, 2017
by
kushalpandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Populate Missing env var panel
parent
c3c644c7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
5 deletions
+26
-5
app/assets/javascripts/prometheus_metrics/prometheus_metrics.js
...sets/javascripts/prometheus_metrics/prometheus_metrics.js
+15
-1
app/views/projects/services/prometheus/_show.html.haml
app/views/projects/services/prometheus/_show.html.haml
+11
-4
No files found.
app/assets/javascripts/prometheus_metrics/prometheus_metrics.js
View file @
5cccbde4
...
@@ -12,7 +12,10 @@ export default class PrometheusMetrics {
...
@@ -12,7 +12,10 @@ export default class PrometheusMetrics {
this
.
$monitoredMetricsEmpty
=
this
.
$monitoredMetricsPanel
.
find
(
'
.js-empty-metrics
'
);
this
.
$monitoredMetricsEmpty
=
this
.
$monitoredMetricsPanel
.
find
(
'
.js-empty-metrics
'
);
this
.
$monitoredMetricsList
=
this
.
$monitoredMetricsPanel
.
find
(
'
.js-metrics-list
'
);
this
.
$monitoredMetricsList
=
this
.
$monitoredMetricsPanel
.
find
(
'
.js-metrics-list
'
);
this
.
$panelToggle
=
this
.
$wrapper
.
find
(
'
.js-panel-toggle
'
);
this
.
$missingEnvVarPanel
=
this
.
$wrapper
.
find
(
'
.js-panel-missing-env-vars
'
);
this
.
$panelToggle
=
this
.
$missingEnvVarPanel
.
find
(
'
.js-panel-toggle
'
);
this
.
$missingEnvVarMetricCount
=
this
.
$missingEnvVarPanel
.
find
(
'
.js-env-var-count
'
);
this
.
$missingEnvVarMetricsList
=
this
.
$missingEnvVarPanel
.
find
(
'
.js-missing-var-metrics-list
'
);
this
.
activeMetricsEndpoint
=
this
.
$monitoredMetricsPanel
.
data
(
'
active-metrics
'
);
this
.
activeMetricsEndpoint
=
this
.
$monitoredMetricsPanel
.
data
(
'
active-metrics
'
);
}
}
...
@@ -35,14 +38,25 @@ export default class PrometheusMetrics {
...
@@ -35,14 +38,25 @@ export default class PrometheusMetrics {
populateActiveMetrics
(
metrics
)
{
populateActiveMetrics
(
metrics
)
{
let
totalMonitoredMetrics
=
0
;
let
totalMonitoredMetrics
=
0
;
let
totalMissingEnvVarMetrics
=
0
;
metrics
.
forEach
((
metric
)
=>
{
metrics
.
forEach
((
metric
)
=>
{
this
.
$monitoredMetricsList
.
append
(
`<li>
${
metric
.
group
}
<span class="badge-count">
${
metric
.
active_metrics
}
</span></li>`
);
this
.
$monitoredMetricsList
.
append
(
`<li>
${
metric
.
group
}
<span class="badge-count">
${
metric
.
active_metrics
}
</span></li>`
);
totalMonitoredMetrics
+=
metric
.
active_metrics
;
totalMonitoredMetrics
+=
metric
.
active_metrics
;
if
(
metric
.
metrics_missing_requirements
>
0
)
{
this
.
$missingEnvVarMetricsList
.
append
(
`<li>
${
metric
.
group
}
</li>`
);
totalMissingEnvVarMetrics
+=
1
;
}
});
});
this
.
$monitoredMetricsCount
.
text
(
totalMonitoredMetrics
);
this
.
$monitoredMetricsCount
.
text
(
totalMonitoredMetrics
);
this
.
$monitoredMetricsLoading
.
addClass
(
'
hidden
'
);
this
.
$monitoredMetricsLoading
.
addClass
(
'
hidden
'
);
this
.
$monitoredMetricsList
.
removeClass
(
'
hidden
'
);
this
.
$monitoredMetricsList
.
removeClass
(
'
hidden
'
);
if
(
totalMissingEnvVarMetrics
>
0
)
{
this
.
$missingEnvVarPanel
.
removeClass
(
'
hidden
'
);
this
.
$missingEnvVarMetricCount
.
text
(
totalMissingEnvVarMetrics
);
}
}
}
loadActiveMetrics
()
{
loadActiveMetrics
()
{
...
...
app/views/projects/services/prometheus/_show.html.haml
View file @
5cccbde4
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
%p
%p
Metrics are automatically configured and monitored
Metrics are automatically configured and monitored
based on a library of metrics from popular exporters.
based on a library of metrics from popular exporters.
More information
=
link_to
'More information'
,
'#'
.col-lg-9
.col-lg-9
.panel.panel-default.js-panel-monitored-metrics
{
data:
{
"active-metrics"
=>
"#{namespace_project_prometheus_active_metrics_path(@project.namespace, @project)}.json"
}
}
.panel.panel-default.js-panel-monitored-metrics
{
data:
{
"active-metrics"
=>
"#{namespace_project_prometheus_active_metrics_path(@project.namespace, @project)}.json"
}
}
...
@@ -27,12 +27,19 @@
...
@@ -27,12 +27,19 @@
View environments
View environments
%ul
.metrics-list.hidden.js-metrics-list
%ul
.metrics-list.hidden.js-metrics-list
.panel.panel-default.js-panel-missing-env-vars
.panel.panel-default.
hidden.
js-panel-missing-env-vars
.panel-heading
.panel-heading
%h3
.panel-title
%h3
.panel-title
=
icon
(
'caret-right lg'
,
class:
'panel-toggle js-panel-toggle'
,
'aria-label'
=>
'Toggle panel'
)
=
icon
(
'caret-right lg'
,
class:
'panel-toggle js-panel-toggle'
,
'aria-label'
=>
'Toggle panel'
)
Missing environment variable(s)
Missing environment variable(s)
%span
.badge-count.js-env-var-count
0
%span
.badge-count.js-env-var-count
0
.panel-body.hidden
.panel-body.hidden
.empty-metrics
.flash-container
%p
Nothing to show here at the moment
.flash-notice
\ No newline at end of file
.flash-text
To set up automatic monitoring, add the environment variable
%code
$CI_ENVIRONMENT_SLUG
to exporter's queries.
=
link_to
'More information'
,
'#'
%ul
.metrics-list.js-missing-var-metrics-list
\ No newline at end of file
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