Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-08-14 09:10:13 +00:00
parent bfa9edfd26
commit 798c6d58c6
4 changed files with 33 additions and 5 deletions

View File

@ -8,6 +8,7 @@
module Metrics
module Dashboard
class GitlabAlertEmbedService < ::Metrics::Dashboard::BaseEmbedService
include Gitlab::Metrics::Dashboard::Defaults
include Gitlab::Utils::StrongMemoize
SEQUENCE = [
@ -63,7 +64,8 @@ module Metrics
{
title: prometheus_metric.title,
y_label: prometheus_metric.y_label,
metrics: [prometheus_metric.to_metric_hash]
metrics: [prometheus_metric.to_metric_hash],
type: DEFAULT_PANEL_TYPE
}
end

View File

@ -0,0 +1,5 @@
---
title: Link to logs from GitLab-managed alert metrics
merge_request: 39487
author:
type: added

View File

@ -303,6 +303,21 @@ for information on how to appropriately configure your alerting rules. See
[External Prometheus instances](../metrics/alerts.md#external-prometheus-instances)
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
Consider a team formed by different sections of monitoring, collaborating on a

View File

@ -72,12 +72,18 @@ RSpec.describe Metrics::Dashboard::GitlabAlertEmbedService do
it_behaves_like 'valid embedded dashboard service response'
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
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
context 'when the metric does not exist' do