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
b981540b
Commit
b981540b
authored
Aug 14, 2020
by
Sarah Yasonik
Committed by
Vitali Tatarintev
Aug 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set default type for alert embeds
parent
07c16be9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
6 deletions
+34
-6
app/services/metrics/dashboard/gitlab_alert_embed_service.rb
app/services/metrics/dashboard/gitlab_alert_embed_service.rb
+3
-1
changelogs/unreleased/sy-set-default-type-for-alert-embeds.yml
...elogs/unreleased/sy-set-default-type-for-alert-embeds.yml
+5
-0
doc/operations/incident_management/index.md
doc/operations/incident_management/index.md
+15
-0
spec/services/metrics/dashboard/gitlab_alert_embed_service_spec.rb
...ices/metrics/dashboard/gitlab_alert_embed_service_spec.rb
+11
-5
No files found.
app/services/metrics/dashboard/gitlab_alert_embed_service.rb
View file @
b981540b
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
module
Metrics
module
Metrics
module
Dashboard
module
Dashboard
class
GitlabAlertEmbedService
<
::
Metrics
::
Dashboard
::
BaseEmbedService
class
GitlabAlertEmbedService
<
::
Metrics
::
Dashboard
::
BaseEmbedService
include
Gitlab
::
Metrics
::
Dashboard
::
Defaults
include
Gitlab
::
Utils
::
StrongMemoize
include
Gitlab
::
Utils
::
StrongMemoize
SEQUENCE
=
[
SEQUENCE
=
[
...
@@ -63,7 +64,8 @@ module Metrics
...
@@ -63,7 +64,8 @@ module Metrics
{
{
title:
prometheus_metric
.
title
,
title:
prometheus_metric
.
title
,
y_label:
prometheus_metric
.
y_label
,
y_label:
prometheus_metric
.
y_label
,
metrics:
[
prometheus_metric
.
to_metric_hash
]
metrics:
[
prometheus_metric
.
to_metric_hash
],
type:
DEFAULT_PANEL_TYPE
}
}
end
end
...
...
changelogs/unreleased/sy-set-default-type-for-alert-embeds.yml
0 → 100644
View file @
b981540b
---
title
:
Link to logs from GitLab-managed alert metrics
merge_request
:
39487
author
:
type
:
added
doc/operations/incident_management/index.md
View file @
b981540b
...
@@ -303,6 +303,21 @@ for information on how to appropriately configure your alerting rules. See
...
@@ -303,6 +303,21 @@ for information on how to appropriately configure your alerting rules. See
[
External Prometheus instances
](
../metrics/alerts.md#external-prometheus-instances
)
[
External Prometheus instances
](
../metrics/alerts.md#external-prometheus-instances
)
for information on setting up alerts for your self-managed Prometheus instance.
for information on setting up alerts for your self-managed Prometheus instance.
### View an Alert's logs
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/217768) in GitLab 13.3.
To view the logs for an alert:
1.
Sign in as a user with Developer or higher
[
permissions
](
../../user/permissions.md
)
.
1.
Navigate to
**{cloud-gear}**
**Operations > Alerts**
.
1.
Click the alert you want to view.
1.
Below the title of the alert, click the
**Metrics**
tab.
1.
Click the
[
menu
](
../metrics/dashboards/index.md#chart-context-menu
)
of the metric chart to view options.
1.
Click
**View logs**
.
Read
[
View logs from metrics panel
](
#view-logs-from-metrics-panel
)
for additional information.
## Use cases for assigning alerts
## Use cases for assigning alerts
Consider a team formed by different sections of monitoring, collaborating on a
Consider a team formed by different sections of monitoring, collaborating on a
...
...
spec/services/metrics/dashboard/gitlab_alert_embed_service_spec.rb
View file @
b981540b
...
@@ -72,12 +72,18 @@ RSpec.describe Metrics::Dashboard::GitlabAlertEmbedService do
...
@@ -72,12 +72,18 @@ RSpec.describe Metrics::Dashboard::GitlabAlertEmbedService do
it_behaves_like
'valid embedded dashboard service response'
it_behaves_like
'valid embedded dashboard service response'
it_behaves_like
'raises error for users with insufficient permissions'
it_behaves_like
'raises error for users with insufficient permissions'
it
'
uses the metric info corresponding to
the alert'
do
it
'
generates an panel based on
the alert'
do
result
=
service_call
result
=
service_call
metrics
=
result
[
:dashboard
][
:panel_groups
][
0
][
:panels
][
0
][
:metrics
]
panel
=
result
[
:dashboard
][
:panel_groups
][
0
][
:panels
][
0
]
metric
=
panel
[
:metrics
].
first
expect
(
metrics
.
length
).
to
eq
1
expect
(
metrics
.
first
[
:metric_id
]).
to
eq
alert
.
prometheus_metric_id
expect
(
panel
[
:metrics
].
length
).
to
eq
1
expect
(
panel
).
to
include
(
title:
alert
.
prometheus_metric
.
title
,
y_label:
alert
.
prometheus_metric
.
y_label
,
type:
'area-chart'
)
expect
(
metric
[
:metric_id
]).
to
eq
alert
.
prometheus_metric_id
end
end
context
'when the metric does not exist'
do
context
'when the metric does not exist'
do
...
...
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