Commit b981540b authored by Sarah Yasonik's avatar Sarah Yasonik Committed by Vitali Tatarintev

Set default type for alert embeds

parent 07c16be9
......@@ -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
......
---
title: Link to logs from GitLab-managed alert metrics
merge_request: 39487
author:
type: added
......@@ -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
......
......@@ -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]
expect(metrics.length).to eq 1
expect(metrics.first[:metric_id]).to eq alert.prometheus_metric_id
panel = result[:dashboard][:panel_groups][0][:panels][0]
metric = panel[:metrics].first
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment