diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /doc/operations/metrics | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) | |
download | gitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'doc/operations/metrics')
61 files changed, 532 insertions, 268 deletions
diff --git a/doc/operations/metrics/alerts.md b/doc/operations/metrics/alerts.md index 43debbd1b78..2ed8de9396a 100644 --- a/doc/operations/metrics/alerts.md +++ b/doc/operations/metrics/alerts.md @@ -4,7 +4,7 @@ group: APM info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers --- -# Set up alerts for Prometheus metrics +# Set up alerts for Prometheus metrics **(CORE)** After [configuring metrics for your CI/CD environment](index.md), you can set up alerting for Prometheus metrics depending on the location of your instances, and @@ -13,23 +13,36 @@ your team when environment performance falls outside of the boundaries you set. ## Managed Prometheus instances -> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/6590) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 11.2 for [custom metrics](index.md#adding-custom-metrics), and 11.3 for [library metrics](../../user/project/integrations/prometheus_library/metrics.md). +> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/6590) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 11.2 for [custom metrics](index.md#adding-custom-metrics), and GitLab 11.3 for [library metrics](../../user/project/integrations/prometheus_library/metrics.md). For managed Prometheus instances using auto configuration, you can [configure alerts for metrics](index.md#adding-custom-metrics) directly in the [metrics dashboard](index.md). To set an alert: -1. In your project, navigate to **{cloud-gear}** **Operations > Metrics**, +1. In your project, navigate to **Operations > Metrics**, 1. Identify the metric you want to create the alert for, and click the **ellipsis** **{ellipsis_v}** icon in the top right corner of the metric. 1. Choose **Alerts**. 1. Set threshold and operator. +1. (Optional) Add a Runbook URL. 1. Click **Add** to save and activate the alert. -![Adding an alert](../../user/project/integrations/img/prometheus_alert.png) +![Adding an alert](img/prometheus_alert.png) To remove the alert, click back on the alert icon for the desired metric, and click **Delete**. +### Link runbooks to alerts + +> - Runbook URLs [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39315) in GitLab 13.3. + +When creating alerts from the metrics dashboard for [managed Prometheus instances](#managed-prometheus-instances), +you can also link a runbook. When the alert triggers, the +[chart context menu](dashboards/index.md#chart-context-menu) on the metrics chart +links to the runbook, making it easy for you to locate and access the correct runbook +as soon as the alert fires: + +![Linked Runbook in charts](img/linked_runbooks_on_charts.png) + ## External Prometheus instances >- [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/9258) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 11.8. @@ -37,11 +50,11 @@ To remove the alert, click back on the alert icon for the desired metric, and cl For manually configured Prometheus servers, GitLab provides a notify endpoint for use with Prometheus webhooks. If you have manual configuration enabled, an -**Alerts** section is added to **{settings}** **Settings > Integrations > Prometheus**. +**Alerts** section is added to **Settings > Integrations > Prometheus**. This section contains the **URL** and **Authorization Key** you will need. The **Reset Key** button will invalidate the key and generate a new one. -![Prometheus service configuration of Alerts](../../user/project/integrations/img/prometheus_service_alerts.png) +![Prometheus service configuration of Alerts](img/prometheus_service_alerts.png) To send GitLab alert notifications, copy the **URL** and **Authorization Key** into the [`webhook_configs`](https://prometheus.io/docs/alerting/latest/configuration/#webhook_config) @@ -75,22 +88,22 @@ Prometheus server to use the Alerts can be used to trigger actions, like opening an issue automatically (disabled by default since `13.1`). To configure the actions: -1. Navigate to your project's **{settings}** **Settings > Operations > Incidents**. +1. Navigate to your project's **Settings > Operations > Incidents**. 1. Enable the option to create issues. 1. Choose the [issue template](../../user/project/description_templates.md) to create the issue from. 1. Optionally, select whether to send an email notification to the developers of the project. 1. Click **Save changes**. After enabling, GitLab automatically opens an issue when an alert is triggered containing -values extracted from [alert's payload](https://prometheus.io/docs/alerting/latest/configuration/#webhook_config): +values extracted from the [`alerts` field in webhook payload](https://prometheus.io/docs/alerting/latest/configuration/#webhook_config): - Issue author: `GitLab Alert Bot` -- Issue title: Extract from `annotations/title`, `annotations/summary` or `labels/alertname` -- Alert `Summary`: A list of properties - - `starts_at`: Alert start time via `startsAt` - - `full_query`: Alert query extracted from `generatorURL` +- Issue title: Extracted from the alert payload fields `annotations/title`, `annotations/summary`, or `labels/alertname`. +- Alert `Summary`: A list of properties from the alert's payload. + - `starts_at`: Alert start time from the payload's `startsAt` field + - `full_query`: Alert query extracted from the payload's `generatorURL` field - Optional list of attached annotations extracted from `annotations/*` -- Alert [GFM](../../user/markdown.md): GitLab Flavored Markdown from `annotations/gitlab_incident_markdown` +- Alert [GFM](../../user/markdown.md): GitLab Flavored Markdown from the payload's `annotations/gitlab_incident_markdown` field. When GitLab receives a **Recovery Alert**, it closes the associated issue. This action is recorded as a system message on the issue indicating that it diff --git a/doc/operations/metrics/dashboards/default.md b/doc/operations/metrics/dashboards/default.md new file mode 100644 index 00000000000..f086d7737bd --- /dev/null +++ b/doc/operations/metrics/dashboards/default.md @@ -0,0 +1,38 @@ +--- +stage: Monitor +group: APM +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +--- + +# GitLab-defined metrics dashboards **(CORE)** + +GitLab provides some dashboards out-of-the-box for any project with +[Prometheus available](../../../user/project/integrations/prometheus.md). You can +[duplicate these GitLab-defined dashboards](index.md#duplicate-a-gitlab-defined-dashboard): + +- [Overview dashboard](#overview-dashboard). +- [Kubernetes pod health dashboard](#kubernetes-pod-health-dashboard). + +To learn about the components of a dashboard, read +[Metrics dashboard for your CI/CD environment](../index.md). + +## Overview dashboard + +This dashboard is the default metrics dashboard. It displays a large number of +metrics about the [deployed application](../index.md#configure-prometheus-to-gather-metrics). + +![Example of metrics dashboard](../img/example-dashboard_v13_3.png) + +## Kubernetes pod health dashboard + +NOTE: **Note:** +This dashboard requires Kubernetes v1.14 or higher, due to the +[change in metric labels](https://github.com/kubernetes/kubernetes/pull/69099) +in Kubernetes 1.14. + +This dashboard displays CPU, memory, network and disk metrics for the pods in your +[connected K8s cluster](../../../user/project/clusters/index.md). It provides a +[variable selector](templating_variables.md#metric_label_values-variable-type) +at the top of the dashboard to select which pod's metrics to display. + +![K8s pod health dashboard](img/k8s_pod_health_dashboard_v13_3.png) diff --git a/doc/operations/metrics/dashboards/develop.md b/doc/operations/metrics/dashboards/develop.md new file mode 100644 index 00000000000..b621f5fd727 --- /dev/null +++ b/doc/operations/metrics/dashboards/develop.md @@ -0,0 +1,33 @@ +--- +stage: Monitor +group: APM +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +--- + +# Developing templates for custom dashboards **(CORE)** + +GitLab provides a template to make it easier for you to create templates for +[custom dashboards](index.md). Templates provide helpful guidance and +commented-out examples you can use. + +## Apply a dashboard template + +Navigate to the browser-based editor of your choice: + +- In the **Repository view**: + + 1. Navigate to **{doc-text}** **Repository > Files**. + 1. Click **{plus}** **Add to tree** and select **New file**, + then click **Select a template type** to see a list of available templates: + ![Metrics dashboard template selection](img/metrics_dashboard_template_selection_v13_3.png) + +- In the **[Web IDE](../../../user/project/web_ide/index.md)**: + + 1. Click **Web IDE** when viewing your repository. + 1. Click **{doc-new}** **New file**, then click **Choose a template** to see a list of available templates: + ![Metrics dashboard template selection WebIDE](img/metrics_dashboard_template_selection_web_ide_v13_3.png) + +## Custom dashboard templates **(PREMIUM ONLY)** + +To enable and use a custom dashboard templates on your GitLab instance, read the +[guide for creating custom templates](../../../user/admin_area/settings/instance_template_repository.md). diff --git a/doc/operations/metrics/dashboards/img/actions_menu_create_add_panel_v13_3.png b/doc/operations/metrics/dashboards/img/actions_menu_create_add_panel_v13_3.png Binary files differnew file mode 100644 index 00000000000..e03fbef3b35 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/actions_menu_create_add_panel_v13_3.png diff --git a/doc/operations/metrics/dashboards/img/actions_menu_create_new_dashboard_v13_3.png b/doc/operations/metrics/dashboards/img/actions_menu_create_new_dashboard_v13_3.png Binary files differnew file mode 100644 index 00000000000..ba4780b730b --- /dev/null +++ b/doc/operations/metrics/dashboards/img/actions_menu_create_new_dashboard_v13_3.png diff --git a/doc/operations/metrics/dashboards/img/dashboard_external_link_v13_1.png b/doc/operations/metrics/dashboards/img/dashboard_external_link_v13_1.png Binary files differnew file mode 100644 index 00000000000..3e8d792c53e --- /dev/null +++ b/doc/operations/metrics/dashboards/img/dashboard_external_link_v13_1.png diff --git a/doc/operations/metrics/dashboards/img/dashboard_local_timezone_v13_1.png b/doc/operations/metrics/dashboards/img/dashboard_local_timezone_v13_1.png Binary files differnew file mode 100644 index 00000000000..8d45607a940 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/dashboard_local_timezone_v13_1.png diff --git a/doc/operations/metrics/dashboards/img/external_dashboard_link.png b/doc/operations/metrics/dashboards/img/external_dashboard_link.png Binary files differnew file mode 100644 index 00000000000..82c5e05e467 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/external_dashboard_link.png diff --git a/doc/operations/metrics/dashboards/img/heatmap_chart_too_much_data_v_13_2.png b/doc/operations/metrics/dashboards/img/heatmap_chart_too_much_data_v_13_2.png Binary files differnew file mode 100644 index 00000000000..c3a391b06c7 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/heatmap_chart_too_much_data_v_13_2.png diff --git a/doc/operations/metrics/dashboards/img/heatmap_panel_type.png b/doc/operations/metrics/dashboards/img/heatmap_panel_type.png Binary files differnew file mode 100644 index 00000000000..a2b3911ec68 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/heatmap_panel_type.png diff --git a/doc/operations/metrics/dashboards/img/k8s_pod_health_dashboard_v13_3.png b/doc/operations/metrics/dashboards/img/k8s_pod_health_dashboard_v13_3.png Binary files differnew file mode 100644 index 00000000000..dc0bc951500 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/k8s_pod_health_dashboard_v13_3.png diff --git a/doc/operations/metrics/dashboards/img/metrics_dashboard_annotations_ui_v13.0.png b/doc/operations/metrics/dashboards/img/metrics_dashboard_annotations_ui_v13.0.png Binary files differnew file mode 100644 index 00000000000..a042fbbcf4e --- /dev/null +++ b/doc/operations/metrics/dashboards/img/metrics_dashboard_annotations_ui_v13.0.png diff --git a/doc/operations/metrics/dashboards/img/metrics_dashboard_panel_preview_v13_3.png b/doc/operations/metrics/dashboards/img/metrics_dashboard_panel_preview_v13_3.png Binary files differnew file mode 100644 index 00000000000..4f6d3b3dfa4 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/metrics_dashboard_panel_preview_v13_3.png diff --git a/doc/operations/metrics/dashboards/img/metrics_dashboard_template_selection_v13_3.png b/doc/operations/metrics/dashboards/img/metrics_dashboard_template_selection_v13_3.png Binary files differnew file mode 100644 index 00000000000..bd8401a1747 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/metrics_dashboard_template_selection_v13_3.png diff --git a/doc/operations/metrics/dashboards/img/metrics_dashboard_template_selection_web_ide_v13_3.png b/doc/operations/metrics/dashboards/img/metrics_dashboard_template_selection_web_ide_v13_3.png Binary files differnew file mode 100644 index 00000000000..650f66e9a30 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/metrics_dashboard_template_selection_web_ide_v13_3.png diff --git a/doc/operations/metrics/dashboards/img/metrics_settings_button_v13_3.png b/doc/operations/metrics/dashboards/img/metrics_settings_button_v13_3.png Binary files differnew file mode 100644 index 00000000000..9c0eac12a3f --- /dev/null +++ b/doc/operations/metrics/dashboards/img/metrics_settings_button_v13_3.png diff --git a/doc/operations/metrics/dashboards/img/panel_context_menu_v13_3.png b/doc/operations/metrics/dashboards/img/panel_context_menu_v13_3.png Binary files differnew file mode 100644 index 00000000000..1259917608b --- /dev/null +++ b/doc/operations/metrics/dashboards/img/panel_context_menu_v13_3.png diff --git a/doc/operations/metrics/dashboards/img/prometheus_dashboard_anomaly_panel_type.png b/doc/operations/metrics/dashboards/img/prometheus_dashboard_anomaly_panel_type.png Binary files differnew file mode 100644 index 00000000000..5cba6fa9038 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/prometheus_dashboard_anomaly_panel_type.png diff --git a/doc/operations/metrics/dashboards/img/prometheus_dashboard_area_panel_type_v12_8.png b/doc/operations/metrics/dashboards/img/prometheus_dashboard_area_panel_type_v12_8.png Binary files differnew file mode 100644 index 00000000000..8c5663fef12 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/prometheus_dashboard_area_panel_type_v12_8.png diff --git a/doc/operations/metrics/dashboards/img/prometheus_dashboard_bar_chart_panel_type_v12.10.png b/doc/operations/metrics/dashboards/img/prometheus_dashboard_bar_chart_panel_type_v12.10.png Binary files differnew file mode 100644 index 00000000000..593e31477f4 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/prometheus_dashboard_bar_chart_panel_type_v12.10.png diff --git a/doc/operations/metrics/dashboards/img/prometheus_dashboard_column_panel_type.png b/doc/operations/metrics/dashboards/img/prometheus_dashboard_column_panel_type.png Binary files differnew file mode 100644 index 00000000000..985f2b04ef3 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/prometheus_dashboard_column_panel_type.png diff --git a/doc/operations/metrics/dashboards/img/prometheus_dashboard_gauge_panel_type_v13_3.png b/doc/operations/metrics/dashboards/img/prometheus_dashboard_gauge_panel_type_v13_3.png Binary files differnew file mode 100644 index 00000000000..547c565c6f9 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/prometheus_dashboard_gauge_panel_type_v13_3.png diff --git a/doc/operations/metrics/dashboards/img/prometheus_dashboard_label_variable_shorthand.png b/doc/operations/metrics/dashboards/img/prometheus_dashboard_label_variable_shorthand.png Binary files differnew file mode 100644 index 00000000000..15111a97464 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/prometheus_dashboard_label_variable_shorthand.png diff --git a/doc/operations/metrics/dashboards/img/prometheus_dashboard_label_variables.png b/doc/operations/metrics/dashboards/img/prometheus_dashboard_label_variables.png Binary files differnew file mode 100644 index 00000000000..9b94d0c6afa --- /dev/null +++ b/doc/operations/metrics/dashboards/img/prometheus_dashboard_label_variables.png diff --git a/doc/operations/metrics/dashboards/img/prometheus_dashboard_repeated_label.png b/doc/operations/metrics/dashboards/img/prometheus_dashboard_repeated_label.png Binary files differnew file mode 100644 index 00000000000..d43a890f0fa --- /dev/null +++ b/doc/operations/metrics/dashboards/img/prometheus_dashboard_repeated_label.png diff --git a/doc/operations/metrics/dashboards/img/prometheus_dashboard_single_stat_panel_type.png b/doc/operations/metrics/dashboards/img/prometheus_dashboard_single_stat_panel_type.png Binary files differnew file mode 100644 index 00000000000..2d7dfb27b49 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/prometheus_dashboard_single_stat_panel_type.png diff --git a/doc/operations/metrics/dashboards/img/prometheus_dashboard_stacked_column_panel_type_v12_8.png b/doc/operations/metrics/dashboards/img/prometheus_dashboard_stacked_column_panel_type_v12_8.png Binary files differnew file mode 100644 index 00000000000..ba67509bcf3 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/prometheus_dashboard_stacked_column_panel_type_v12_8.png diff --git a/doc/operations/metrics/dashboards/img/prometheus_dashboard_yaml_validation_v13_1.png b/doc/operations/metrics/dashboards/img/prometheus_dashboard_yaml_validation_v13_1.png Binary files differnew file mode 100644 index 00000000000..08d7d6603d2 --- /dev/null +++ b/doc/operations/metrics/dashboards/img/prometheus_dashboard_yaml_validation_v13_1.png diff --git a/doc/operations/metrics/dashboards/img/related_links_v13_1.png b/doc/operations/metrics/dashboards/img/related_links_v13_1.png Binary files differnew file mode 100644 index 00000000000..4dc141f0e7f --- /dev/null +++ b/doc/operations/metrics/dashboards/img/related_links_v13_1.png diff --git a/doc/operations/metrics/dashboards/index.md b/doc/operations/metrics/dashboards/index.md index a46abdee2dc..ffcb7dc92c6 100644 --- a/doc/operations/metrics/dashboards/index.md +++ b/doc/operations/metrics/dashboards/index.md @@ -4,61 +4,154 @@ group: APM info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers --- -# Using the Metrics Dashboard +# Custom dashboards **(CORE)** -## Manage the metrics dashboard settings +> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/59974) in GitLab 12.1. -> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/223204) in GitLab 13.2. +By default, all projects include a [GitLab-defined Prometheus dashboard](default.md), which +includes a few key metrics, but you can also define your own custom dashboards. -To manage the settings for your metrics dashboard: +You may create a [new dashboard from scratch](#add-a-new-dashboard-to-your-project) +or [duplicate a GitLab-defined Prometheus dashboard](#duplicate-a-gitlab-defined-dashboard). + +NOTE: **Note:** +The metrics as defined below do not support alerts, unlike +[custom metrics](../index.md#adding-custom-metrics). + +## Add a new dashboard to your project -1. Sign in as a user with project Maintainer or Admin +> UI option [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/228856) in GitLab 13.3. + +You can configure a custom dashboard by adding a new YAML file into your project's +`.gitlab/dashboards/` directory. For the dashboard to display on your project's +**Operations > Metrics** page, the files must have a `.yml` +extension and be present in your project's **default** branch. + +To create a new dashboard from the GitLab user interface: + +1. Sign in to GitLab as a user with Maintainer or Owner [permissions](../../../user/permissions.md#project-members-permissions). -1. Navigate to your dashboard at **{cloud-gear}** **Operations > Metrics**. -1. In the top-right corner of your dashboard, click **{settings}** **Metrics Settings**: +1. Navigate to your dashboard at **Operations > Metrics**. +1. In the top-right corner of your dashboard, click the **{ellipsis_v}** **More actions** menu, + and select **Create new**: + ![Monitoring Dashboard actions menu with create new item](img/actions_menu_create_new_dashboard_v13_3.png) +1. In the modal window, click **Open Repository**, then follow the instructions + for creating a new dashboard from the command line. - ![Monitoring Dashboard actions menu with create new item](../../../user/project/integrations/img/metrics_settings_button_v13_2.png) +To create a new dashboard from the command line: -## Chart Context Menu +1. Create `.gitlab/dashboards/prom_alerts.yml` under your repository's root + directory. Each YAML file should define the layout of the dashboard and the + Prometheus queries used to populate data. This example dashboard displays a + single area chart: -From each of the panels in the dashboard, you can access the context menu by clicking the **{ellipsis_v}** **More actions** dropdown box above the upper right corner of the panel to take actions related to the chart's data. + ```yaml + dashboard: 'Dashboard Title' + panel_groups: + - group: 'Group Title' + panels: + - type: area-chart + title: "Chart Title" + y_label: "Y-Axis" + y_axis: + format: number + precision: 0 + metrics: + - id: my_metric_id + query_range: 'http_requests_total' + label: "Instance: {{instance}}, method: {{method}}" + unit: "count" + ``` -![Context Menu](../../../user/project/integrations/img/panel_context_menu_v13_0.png) +1. Save the file, commit, and push to your repository. The file must be present in your **default** branch. +1. Navigate to your project's **Operations > Metrics** and choose the custom + dashboard from the dropdown. -The options are: +Your custom dashboard is available at `https://example.com/project/-/metrics/custom_dashboard_name.yml`. -- [Expand panel](#expand-panel) -- [View logs](#view-logs-ultimate) -- [Download CSV](#downloading-data-as-csv) -- [Copy link to chart](../embed.md#embedding-gitlab-managed-kubernetes-metrics) -- [Alerts](../alerts.md) +NOTE: **Note:** +Configuration files nested under subdirectories of `.gitlab/dashboards` are not +supported and won't be available in the UI. -### View and edit the source file of a custom dashboard +## Add a new metrics panel to a dashboard -> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/34779) in GitLab 12.5. +> UI option [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/228761) in GitLab 13.3. -When viewing a custom dashboard of a project, you can view the original -`.yml` file by clicking on the **Edit dashboard** button. +The metrics dashboard supports various [multiple panel types](../../../operations/metrics/dashboards/panel_types.md). +You can quickly test how a panel configuration would display in your metrics dashboard +with the **Add Panel** page: -### Expand panel +1. Sign in to GitLab as a user with Maintainer or Owner + [permissions](../../../user/permissions.md#project-members-permissions). +1. Click **Add panel** in the **{ellipsis_v}** **More actions** menu. + + NOTE: **Note:** + You can add panel only to custom dashboards. -> [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/3100) in GitLab 13.0. + ![Monitoring Dashboard actions menu with add panel item](img/actions_menu_create_add_panel_v13_3.png) +1. In the **Define and preview panel** section, paste in the YAML you want to + preview in the **Panel YAML** field. +1. Click **Preview panel**, and GitLab displays a preview of the chart below the + `Define and preview panel` section: + ![Monitoring Dashboard Add Panel page](img/metrics_dashboard_panel_preview_v13_3.png) + +## Duplicate a GitLab-defined dashboard + +> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/37238) in GitLab 12.7. +> - From [GitLab 12.8 onwards](https://gitlab.com/gitlab-org/gitlab/-/issues/39505), custom metrics are also duplicated when you duplicate a dashboard. + +You can save a complete copy of a GitLab defined dashboard along with all custom metrics added to it. +The resulting `.yml` file can be customized and adapted to your project. +You can decide to save the dashboard `.yml` file in the project's **default** branch or in a +new branch. + +1. Click **Duplicate current dashboard** in the **{ellipsis_v}** **More actions** menu. + + NOTE: **Note:** + You can duplicate only GitLab-defined dashboards. + +1. Enter the filename and other information, such as the new commit's message, and click **Duplicate**. +1. Select a branch to add your dashboard to: + - *If you select your **default** branch,* the new dashboard becomes immediately available. + - *If you select another branch,* this branch should be merged to your **default** branch first. + +Your custom dashboard is available at `https://example.com/project/-/metrics/custom_dashboard_name.yml`. + +## Manage the metrics dashboard settings + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/223204) in GitLab 13.2. + +To manage the settings for your metrics dashboard: + +1. Sign in as a user with project Maintainer or Administrator + [permissions](../../../user/permissions.md#project-members-permissions). +1. Navigate to your dashboard at **Operations > Metrics**. +1. In the top-right corner of your dashboard, click **Metrics Settings**: -To view a larger version of a visualization, expand the panel by clicking the -**{ellipsis_v}** **More actions** icon and selecting **Expand panel**. + ![Monitoring Dashboard actions menu with create new item](img/metrics_settings_button_v13_3.png) -To return to the metrics dashboard, click the **Back** button in your -browser, or pressing the <kbd>Esc</kbd> key. +## Chart Context Menu -### View Logs **(ULTIMATE)** +You can take action related to a chart's data by clicking the +**{ellipsis_v}** **More actions** dropdown box above the upper right corner of +any chart on a dashboard: -> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/122013) in GitLab 12.8. +![Context Menu](img/panel_context_menu_v13_3.png) -If you have [Logs](../../../user/project/clusters/kubernetes_pod_logs.md) enabled, -you can navigate from the charts in the dashboard to view Logs by -clicking on the context menu in the upper-right corner. +The options are: -If you use the **Timeline zoom** function at the bottom of the chart, logs will narrow down to the time range you selected. +- **Expand panel** - Displays a larger version of a visualization. To return to + the dashboard, click the **Back** button in your browser, or press the <kbd>Esc</kbd> key. + ([Introduced](https://gitlab.com/groups/gitlab-org/-/epics/3100) in GitLab 13.0.) +- **View logs** **(ULTIMATE)** - Displays [Logs](../../../user/project/clusters/kubernetes_pod_logs.md), + if they are enabled. If used in conjunction with the [timeline zoom](#timeline-zoom-and-url-sharing) + feature, logs narrow down to the selected time range. ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/122013) in GitLab 12.8.) +- **Download CSV** - Data from Prometheus charts on the metrics dashboard can be downloaded as CSV. +- [Copy link to chart](../embed.md#embedding-gitlab-managed-kubernetes-metrics) +- **Alerts** - Display any [alerts](../alerts.md) configured for this metric. +- **View Runbook** - Displays the runbook for an alert. For information about configuring + runbooks, read [Set up alerts for Prometheus metrics](../alerts.md). + ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/211844) in GitLab 13.3.) ### Timeline zoom and URL sharing @@ -69,10 +162,6 @@ on a date and time of your choice. When you click and drag the sliders to select a different beginning or end date of data to display, GitLab adds your selected start and end times to the URL, enabling you to share specific timeframes more easily. -### Downloading data as CSV - -Data from Prometheus charts on the metrics dashboard can be downloaded as CSV. - ## Dashboard Annotations > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/211330) in GitLab 12.10 (enabled by feature flag `metrics_dashboard_annotations`). @@ -88,9 +177,9 @@ its description. You can create annotations by making requests to the [Metrics dashboard annotations API](../../../api/metrics_dashboard_annotations.md) -![Annotations UI](../../../user/project/integrations/img/metrics_dashboard_annotations_ui_v13.0.png) +![Annotations UI](img/metrics_dashboard_annotations_ui_v13.0.png) -### Retention policy +### Annotation retention policy > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/211433) in GitLab 13.01. @@ -124,7 +213,7 @@ The dashboard's time range is appended to the `url` as URL parameters. The following example shows two related links (`GitLab.com` and `GitLab Documentation`) added to a dashboard: -![Links UI](../../../user/project/integrations/img/related_links_v13_1.png) +![Links UI](img/related_links_v13_1.png) ### Links Syntax @@ -139,99 +228,6 @@ links: type: grafana ``` -## Defining custom dashboards per project - -> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/59974) in GitLab 12.1. - -By default, all projects include a GitLab-defined Prometheus dashboard, which -includes a few key metrics, but you can also define your own custom dashboards. - -You may create a new file from scratch or duplicate a GitLab-defined Prometheus -dashboard. - -NOTE: **Note:** -The metrics as defined below do not support alerts, unlike -[custom metrics](../index.md#adding-custom-metrics). - -### Adding a new dashboard to your project - -> UI option [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/223204) in GitLab 13.2. - -You can configure a custom dashboard by adding a new YAML file into your project's -`.gitlab/dashboards/` directory. In order for the dashboards to be displayed on -the project's **{cloud-gear}** **Operations > Metrics** page, the files must have a `.yml` -extension and should be present in the project's **default** branch. - -To create a new dashboard from the GitLab user interface: - -1. Sign in to GitLab as a user with Maintainer or Owner - [permissions](../../../user/permissions.md#project-members-permissions). -1. Navigate to your dashboard at **{cloud-gear}** **Operations > Metrics**. -1. In the top-right corner of your dashboard, click the **{file-addition-solid}** **Actions** menu, - and select **Create new**: - ![Monitoring Dashboard actions menu with create new item](../../../user/project/integrations/img/actions_menu_create_new_dashboard_v13_2.png) -1. In the modal window, click **Open Repository**, then follow the instructions - for creating a new dashboard from the command line. - -To create a new dashboard from the command line: - -1. Create `.gitlab/dashboards/prom_alerts.yml` under your repository's root - directory. Each YAML file should define the layout of the dashboard and the - Prometheus queries used to populate data. This example dashboard displays a - single area chart: - - ```yaml - dashboard: 'Dashboard Title' - panel_groups: - - group: 'Group Title' - panels: - - type: area-chart - title: "Chart Title" - y_label: "Y-Axis" - y_axis: - format: number - precision: 0 - metrics: - - id: my_metric_id - query_range: 'http_requests_total' - label: "Instance: {{instance}}, method: {{method}}" - unit: "count" - ``` - -1. Save the file, commit, and push to your repository. The file must be present in your **default** branch. -1. Navigate to your project's **Operations > Metrics** and choose the custom - dashboard from the dropdown. - -NOTE: **Note:** -Configuration files nested under subdirectories of `.gitlab/dashboards` are not -supported and will not be available in the UI. - -### Navigating to a custom dashboard - -Custom dashboards are uniquely identified by their filenames. In order to quickly view the custom dashboard, -just use the dashboard filename in the URL this way: -`https://gitlab-instance.example.com/project/-/metrics/custom_dashboard_name.yml`. - -### Duplicating a GitLab-defined dashboard - -> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/37238) in GitLab 12.7. -> - From [GitLab 12.8 onwards](https://gitlab.com/gitlab-org/gitlab/-/issues/39505), custom metrics are also duplicated when you duplicate a dashboard. - -You can save a complete copy of a GitLab defined dashboard along with all custom metrics added to it. -Resulting `.yml` file can be customized and adapted to your project. -You can decide to save the dashboard `.yml` file in the project's **default** branch or in a -new branch. - -1. Click **Duplicate dashboard** in the dashboard dropdown or in the actions menu. - - NOTE: **Note:** - You can duplicate only GitLab-defined dashboards. - -1. Enter the file name and other information, such as the new commit's message, and click **Duplicate**. - -If you select your **default** branch, the new dashboard becomes immediately available. -If you select another branch, this branch should be merged to your **default** branch first. - ## Troubleshooting When troubleshooting issues with a managed Prometheus app, it is often useful to diff --git a/doc/operations/metrics/dashboards/panel_types.md b/doc/operations/metrics/dashboards/panel_types.md index 0397218fe0e..b2cbdcb88d9 100644 --- a/doc/operations/metrics/dashboards/panel_types.md +++ b/doc/operations/metrics/dashboards/panel_types.md @@ -4,7 +4,7 @@ group: APM info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers --- -# Panel types for dashboards +# Panel types for dashboards **(CORE)** The below panel types are supported in monitoring dashboards. @@ -37,7 +37,7 @@ Note the following properties: | type | string | no | Type of panel to be rendered. Optional for area panel types | | query_range | string | required | For area panel types, you must use a [range query](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries) | -![area panel chart](../../../user/project/integrations/img/prometheus_dashboard_area_panel_type_v12_8.png) +![area panel chart](img/prometheus_dashboard_area_panel_type_v12_8.png) Starting in [version 12.8](https://gitlab.com/gitlab-org/gitlab/-/issues/202696), the y-axis values will automatically scale according to the data. Previously, it always started from 0. @@ -81,7 +81,7 @@ Note the following properties: | type | string | required | Must be `anomaly-chart` for anomaly panel types | | query_range | yes | required | For anomaly panel types, you must use a [range query](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries) in every metric. | -![anomaly panel type](../../../user/project/integrations/img/prometheus_dashboard_anomaly_panel_type.png) +![anomaly panel type](img/prometheus_dashboard_anomaly_panel_type.png) ## Bar chart @@ -110,7 +110,7 @@ Note the following properties: | `type` | string | yes | Type of panel to be rendered. For bar chart types, set to `bar` | | `query_range` | yes | yes | For bar chart, you must use a [range query](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries) -![bar chart panel type](../../../user/project/integrations/img/prometheus_dashboard_bar_chart_panel_type_v12.10.png) +![bar chart panel type](img/prometheus_dashboard_bar_chart_panel_type_v12.10.png) ## Column chart @@ -137,7 +137,7 @@ Note the following properties: | type | string | yes | Type of panel to be rendered. For column panel types, set to `column` | | query_range | yes | yes | For column panel types, you must use a [range query](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries) | -![anomaly panel type](../../../user/project/integrations/img/prometheus_dashboard_column_panel_type.png) +![anomaly panel type](img/prometheus_dashboard_column_panel_type.png) ## Stacked column @@ -169,7 +169,7 @@ panel_groups: series_name: 'group 2' ``` -![stacked column panel type](../../../user/project/integrations/img/prometheus_dashboard_stacked_column_panel_type_v12_8.png) +![stacked column panel type](img/prometheus_dashboard_stacked_column_panel_type_v12_8.png) | Property | Type | Required | Description | | ------ | ------ | ------ | ------ | @@ -202,7 +202,7 @@ Note the following properties: | field | string | no | Panels display the value of a metric. For a panel to display the value of a label instead, put the name of the label in this key. | | query | string | yes | For single stat panel types, you must use an [instant query](https://prometheus.io/docs/prometheus/latest/querying/api/#instant-queries) | -![single stat panel type](../../../user/project/integrations/img/prometheus_dashboard_single_stat_panel_type.png) +![single stat panel type](img/prometheus_dashboard_single_stat_panel_type.png) ## Percentile based results @@ -227,6 +227,57 @@ panel_groups: For example, if you have a query value of `53.6`, adding `%` as the unit results in a single stat value of `53.6%`, but if the maximum expected value of the query is `120`, the value would be `44.6%`. Adding the `max_value` causes the correct percentage value to display. +## Gauge + +CAUTION: **Warning:** +This panel type is an _alpha_ feature, and is subject to change at any time +without prior notice! + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/207044) in GitLab 13.3. + +To add a gauge panel type to a dashboard, look at the following sample dashboard file: + +```yaml +dashboard: 'Dashboard Title' +panel_groups: + - group: 'Group Title' + panels: + - title: "Gauge" + type: "gauge" + min_value: 0 + max_value: 1000 + split: 5 + thresholds: + values: [60, 90] + mode: "percentage" + format: "kilobytes" + metrics: + - id: 10 + query: 'floor(max(prometheus_http_response_size_bytes_bucket)/1000)' + unit: 'kb' +``` + +Note the following properties: + +| Property | Type | Required | Description | +| ------ | ------ | ------ | ------ | +| type | string | yes | Type of panel to be rendered. For gauge panel types, set to `gauge`. | +| min_value | number | no, defaults to `0` | The minimum value of the gauge chart axis. If either of `min_value` or `max_value` are not set, they both get their default values. | +| max_value | number | no, defaults to `100` | The maximum value of the gauge chart axis. If either of `min_value` or `max_value` are not set, they both get their default values. | +| split | number | no, defaults to `10` | The amount of split segments on the gauge chart axis. | +| thresholds | object | no | Thresholds configuration for the gauge chart axis. | +| format | string | no, defaults to `engineering` | Unit format used. See the [full list of units](yaml_number_format.md). | +| query | string | yes | For gauge panel types, you must use an [instant query](https://prometheus.io/docs/prometheus/latest/querying/api/#instant-queries). | + +### Thresholds properties + +| Property | Type | Required | Description | +| ------ | ------ | ------ | ------ | +| values | array | no, defaults to 95% of the range between `min_value` and `max_value`| An array of gauge chart axis threshold values. | +| mode | string | no, defaults to `absolute` | The mode in which the thresholds are interpreted in relation to `min_value` and `max_value`. Can be either `percentage` or `absolute`. | + +![gauge panel type](img/prometheus_dashboard_gauge_panel_type_v13_3.png) + ## Heatmaps > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/30581) in GitLab 12.5. @@ -254,9 +305,9 @@ Note the following properties: | type | string | yes | Type of panel to be rendered. For heatmap panel types, set to `heatmap` | | query_range | yes | yes | For area panel types, you must use a [range query](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries) | -![heatmap panel type](../../../user/project/integrations/img/heatmap_panel_type.png) +![heatmap panel type](img/heatmap_panel_type.png) CAUTION: **Warning:** When a query returns too many data points, the heatmap data bucket dimensions tend downwards to 0, making the chart's data invisible, as shown in the image below. To fix this problem, limit the amount of data returned by changing the time range filter on the metrics dashboard UI, or adding the **step** property to your dashboard's YAML file. -![heatmap chart_too_much_data](../../../user/project/integrations/img/heatmap_chart_too_much_data_v_13_2.png) +![heatmap chart_too_much_data](img/heatmap_chart_too_much_data_v_13_2.png) diff --git a/doc/operations/metrics/dashboards/settings.md b/doc/operations/metrics/dashboards/settings.md new file mode 100644 index 00000000000..a4aef6b1674 --- /dev/null +++ b/doc/operations/metrics/dashboards/settings.md @@ -0,0 +1,52 @@ +--- +stage: Monitor +group: APM +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +--- + +# Dashboard settings + +You can configure your [Monitoring dashboard](../index.md) to +display the time zone of your choice, and the links of your choice. + +To configure these settings you must have Manage Project +Operations [permissions](../../../user/permissions.md). + +## Change the dashboard time zone + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/214370) in GitLab 13.1. + +By default, your monitoring dashboard displays dates and times in your local +time zone, but you can display dates and times in UTC format. To change the +time zone: + +1. Sign in as a user with Manage Project Operations [permissions](../../../user/permissions.md). +1. Navigate to **Settings > Operations**, and scroll to + **Metrics Dashboard**. +1. In the **Dashboard timezone** select box, select *User's local timezone* + or *UTC*: + + ![Dashboard timezone setting](img/dashboard_local_timezone_v13_1.png) +1. Click **Save changes**. + +## Link to an external dashboard + +> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/57171) in GitLab 12.0. + +You can add a button on your monitoring dashboard that links directly to your +existing external dashboards: + +1. Sign in as a user with Manage Project Operations [permissions](../../../user/permissions.md). +1. Navigate to **Settings > Operations**, and scroll to + **Metrics Dashboard**. +1. In **External dashboard URL**, provide the URL to your external dashboard: + + ![External Dashboard Setting](img/dashboard_external_link_v13_1.png) + +1. Click **Save changes**. + +GitLab displays a **View full dashboard** button in the top right corner of your +[monitoring dashboard](../../../ci/environments/index.md#monitoring-environments) +which opens the URL you provided: + +![External Dashboard Link](img/external_dashboard_link.png) diff --git a/doc/operations/metrics/dashboards/templating_variables.md b/doc/operations/metrics/dashboards/templating_variables.md index a515742ea92..71025d41281 100644 --- a/doc/operations/metrics/dashboards/templating_variables.md +++ b/doc/operations/metrics/dashboards/templating_variables.md @@ -4,7 +4,7 @@ group: APM info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers --- -# Templating variables for metrics dashboards +# Templating variables for metrics dashboards **(CORE)** > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/214539) in GitLab 13.0. diff --git a/doc/operations/metrics/dashboards/variables.md b/doc/operations/metrics/dashboards/variables.md index 19b77a1ed87..8b0d7f37052 100644 --- a/doc/operations/metrics/dashboards/variables.md +++ b/doc/operations/metrics/dashboards/variables.md @@ -4,9 +4,9 @@ group: APM info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers --- -# Using Variables +# Using variables **(CORE)** -## Query Variables +## Query variables Variables can be specified using double curly braces, such as `"{{ci_environment_slug}}"` ([added](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/20793) in GitLab 12.7). @@ -41,7 +41,7 @@ For example, if the dashboard time range is set to 8 hours, the value of [Variables can be defined](../../../operations/metrics/dashboards/yaml.md#templating-templating-properties) in a custom dashboard YAML file. -## Query Variables from URL +## Query variables from URL > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/214500) in GitLab 13.0. diff --git a/doc/operations/metrics/dashboards/yaml.md b/doc/operations/metrics/dashboards/yaml.md index 6a4158798bc..f92ba4079e9 100644 --- a/doc/operations/metrics/dashboards/yaml.md +++ b/doc/operations/metrics/dashboards/yaml.md @@ -4,7 +4,7 @@ group: APM info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers --- -# Dashboard YAML properties +# Dashboard YAML properties **(CORE)** Dashboards have several components: @@ -43,24 +43,34 @@ Read the documentation on [links](index.md#add-related-links-to-custom-dashboard ## **Panel group (`panel_groups`) properties** +Dashboards display panel groups in the order they are listed in the dashboard YAML file. + +NOTE: **Note:** +In GitLab versions 13.3 and below, panel groups were ordered by a `priority` key, which +is no longer used. + | Property | Type | Required | Description | | ------ | ------ | ------ | ------ | | `group` | string | required | Heading for the panel group. | -| `priority` | number | optional, defaults to order in file | Order to appear on the dashboard. Higher number means higher priority, which will be higher on the page. Numbers do not need to be consecutive. | | `panels` | array | required | The panels which should be in the panel group. | Panels in a panel group are laid out in rows consisting of two panels per row. An exception to this rule are single panels on a row: these panels will take the full width of their containing row. ## **Panel (`panels`) properties** +Dashboards display panels in the order they are listed in the dashboard YAML file. + +NOTE: **Note:** +In GitLab versions 13.3 and below, panels were ordered by a `weight` key, which +is no longer used. + | Property | Type | Required | Description | | ------ | ------ | ------ | ------- | -| `type` | enum | no, defaults to `area-chart` | Specifies the panel type to use, for example `area-chart`, `line-chart` or `anomaly-chart`. [View documentation on all panel types.](panel_types.md) | +| `type` | string | no, defaults to `area-chart` | Specifies the panel type to use, for example `area-chart`, `line-chart` or `anomaly-chart`. Only types listed among [all panel types](panel_types.md) are allowed. | | `title` | string | yes | Heading for the panel. | | `y_label` | string | no, but highly encouraged | Y-Axis label for the panel. | | `y_axis` | string | no | Y-Axis configuration for the panel. | | `max_value` | number | no | Denominator value used for calculating [percentile based results](panel_types.md#percentile-based-results) | -| `weight` | number | no, defaults to order in file | Order to appear within the grouping. Lower number means higher priority, which will be higher on the page. Numbers do not need to be consecutive. | | `metrics` | array | yes | The metrics which should be displayed in the panel. Any number of metrics can be displayed when `type` is `area-chart` or `line-chart`, whereas only 3 can be displayed when `type` is `anomaly-chart`. | | `links` | array | no | Add links to display on the chart's [context menu](index.md#chart-context-menu). | @@ -79,8 +89,8 @@ Panels in a panel group are laid out in rows consisting of two panels per row. A | `id` | string | no | Used for associating dashboard metrics with database records. Must be unique across dashboard configuration files. Required for [alerting](../alerts.md) (support not yet enabled, see [relevant issue](https://gitlab.com/gitlab-org/gitlab/-/issues/27980)). | | `unit` | string | yes | Defines the unit of the query's return data. | | `label` | string | no, but highly encouraged | Defines the legend-label for the query. Should be unique within the panel's metrics. Can contain time series labels as interpolated variables. | -| `query` | string | yes if `query_range` is not defined | Defines the Prometheus query to be used to populate the chart/panel. If defined, the `query` endpoint of the [Prometheus API](https://prometheus.io/docs/prometheus/latest/querying/api/) will be utilized. | -| `query_range` | string | yes if `query` is not defined | Defines the Prometheus query to be used to populate the chart/panel. If defined, the `query_range` endpoint of the [Prometheus API](https://prometheus.io/docs/prometheus/latest/querying/api/) will be utilized. | +| `query` | string/number | yes if `query_range` is not defined | Defines the Prometheus query to be used to populate the chart/panel. If defined, the `query` endpoint of the [Prometheus API](https://prometheus.io/docs/prometheus/latest/querying/api/) will be utilized. | +| `query_range` | string/number | yes if `query` is not defined | Defines the Prometheus query to be used to populate the chart/panel. If defined, the `query_range` endpoint of the [Prometheus API](https://prometheus.io/docs/prometheus/latest/querying/api/) will be utilized. | | `step` | number | no, value is calculated if not defined | Defines query resolution step width in float number of seconds. Metrics on the same panel should use the same `step` value. | ## Dynamic labels @@ -99,7 +109,7 @@ metrics: This may render a legend like this: -![repeated legend label chart](../../../user/project/integrations/img/prometheus_dashboard_repeated_label.png) +![repeated legend label chart](img/prometheus_dashboard_repeated_label.png) For labels to be more explicit, using variables that reflect time series labels is a good practice. The variables will be replaced by the values of the time series labels when the legend is rendered: @@ -113,7 +123,7 @@ metrics: The resulting rendered legend will look like this: -![legend with label variables](../../../user/project/integrations/img/prometheus_dashboard_label_variables.png) +![legend with label variables](img/prometheus_dashboard_label_variables.png) There is also a shorthand value for dynamic dashboard labels that make use of only one time series label: @@ -127,7 +137,7 @@ metrics: This works by lowercasing the value of `label` and, if there are more words separated by spaces, replacing those spaces with an underscore (`_`). The transformed value is then checked against the labels of the time series returned by the Prometheus query. If a time series label is found that is equal to the transformed value, then the label value will be used and rendered in the legend like this: -![legend with label shorthand variable](../../../user/project/integrations/img/prometheus_dashboard_label_variable_shorthand.png) +![legend with label shorthand variable](img/prometheus_dashboard_label_variable_shorthand.png) ## Dashboard YAML syntax validation @@ -142,19 +152,19 @@ To confirm your dashboard definition contains valid YAML syntax: Files with valid syntax display **Metrics Dashboard YAML definition is valid**, and files with invalid syntax display **Metrics Dashboard YAML definition is invalid**. -![Metrics Dashboard_YAML_syntax_validation](../../../user/project/integrations/img/prometheus_dashboard_yaml_validation_v13_1.png) +![Metrics Dashboard_YAML_syntax_validation](img/prometheus_dashboard_yaml_validation_v13_1.png) When **Metrics Dashboard YAML definition is invalid** at least one of the following messages is displayed: -1. `dashboard: can't be blank` [learn more](../../../operations/metrics/dashboards/yaml.md#dashboard-top-level-properties) -1. `panel_groups: should be an array of panel_groups objects` [learn more](../../../operations/metrics/dashboards/yaml.md#dashboard-top-level-properties) -1. `group: can't be blank` [learn more](../../../operations/metrics/dashboards/yaml.md#panel-group-panel_groups-properties) -1. `panels: should be an array of panels objects` [learn more](../../../operations/metrics/dashboards/yaml.md#panel-group-panel_groups-properties) -1. `title: can't be blank` [learn more](../../../operations/metrics/dashboards/yaml.md#panel-panels-properties) -1. `metrics: should be an array of metrics objects` [learn more](../../../operations/metrics/dashboards/yaml.md#panel-panels-properties) -1. `query: can't be blank` [learn more](../../../operations/metrics/dashboards/yaml.md#metrics-metrics-properties) -1. `query_range: can't be blank` [learn more](../../../operations/metrics/dashboards/yaml.md#metrics-metrics-properties) -1. `unit: can't be blank` [learn more](../../../operations/metrics/dashboards/yaml.md#metrics-metrics-properties) +1. `dashboard: can't be blank` [learn more](#dashboard-top-level-properties) +1. `panel_groups: should be an array of panel_groups objects` [learn more](#dashboard-top-level-properties) +1. `group: can't be blank` [learn more](#panel-group-panel_groups-properties) +1. `panels: should be an array of panels objects` [learn more](#panel-group-panel_groups-properties) +1. `title: can't be blank` [learn more](#panel-panels-properties) +1. `metrics: should be an array of metrics objects` [learn more](#panel-panels-properties) +1. `query: can't be blank` [learn more](#metrics-metrics-properties) +1. `query_range: can't be blank` [learn more](#metrics-metrics-properties) +1. `unit: can't be blank` [learn more](#metrics-metrics-properties) 1. `YAML syntax: The parsed YAML is too big` This is displayed when the YAML file is larger than 1 MB. diff --git a/doc/operations/metrics/dashboards/yaml_number_format.md b/doc/operations/metrics/dashboards/yaml_number_format.md index ae0cd9fff64..1a8bd6f4257 100644 --- a/doc/operations/metrics/dashboards/yaml_number_format.md +++ b/doc/operations/metrics/dashboards/yaml_number_format.md @@ -4,7 +4,7 @@ group: APM info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers --- -# Unit formats reference +# Unit formats reference **(CORE)** > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/201999) in GitLab 12.9. diff --git a/doc/operations/metrics/embed.md b/doc/operations/metrics/embed.md index 5ee9b0859b9..62d60921c85 100644 --- a/doc/operations/metrics/embed.md +++ b/doc/operations/metrics/embed.md @@ -4,33 +4,37 @@ group: APM info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers --- -# Embedding metric charts within GitLab Flavored Markdown +# Embedding metric charts within GitLab-flavored Markdown **(CORE)** + +You can display metrics charts within +[GitLab Flavored Markdown](../../user/markdown.md#gitlab-flavored-markdown-gfm) +fields such as issue or merge request descriptions. The maximum number of embedded +charts allowed in a GitLab Flavored Markdown field is 100. +Embedding charts is useful when sharing an application incident or performance +metrics to others, and you want to have relevant information directly available. ## Embedding GitLab-managed Kubernetes metrics > [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/29691) in GitLab 12.2. -It is possible to display metrics charts within [GitLab Flavored Markdown](../../user/markdown.md#gitlab-flavored-markdown-gfm) fields such as issue or merge request descriptions. The maximum number of embedded charts allowed in a GitLab Flavored Markdown field is 100. - -This can be useful if you are sharing an application incident or performance -metrics to others and want to have relevant information directly available. - NOTE: **Note:** Requires [Kubernetes](../../user/project/integrations/prometheus_library/kubernetes.md) metrics. -To display metric charts, include a link of the form `https://<root_url>/<project>/-/environments/<environment_id>/metrics`: +To display metric charts, include a link of the form +`https://<root_url>/<project>/-/environments/<environment_id>/metrics` in a field +that supports GitLab-flavored Markdown: -![Embedded Metrics Markdown](../../user/project/integrations/img/embedded_metrics_markdown_v12_8.png) +![Embedded Metrics Markdown](img/embedded_metrics_markdown_v12_8.png) GitLab unfurls the link as an embedded metrics panel: -![Embedded Metrics Rendered](../../user/project/integrations/img/embedded_metrics_rendered_v12_8.png) +![Embedded Metrics Rendered](img/embedded_metrics_rendered_v12_8.png) You can also embed a single chart. To get a link to a chart, click the **{ellipsis_v}** **More actions** menu in the upper right corner of the chart, and select **Copy link to chart**, as shown in this example: -![Copy Link To Chart](../../user/project/integrations/img/copy_link_to_chart_v12_10.png) +![Copy Link To Chart](img/copy_link_to_chart_v12_10.png) The following requirements must be met for the metric to unfurl: @@ -40,27 +44,33 @@ The following requirements must be met for the metric to unfurl: - The user must be allowed access to the monitoring dashboard for the environment ([Reporter or higher](../../user/permissions.md)). - The dashboard must have data within the last 8 hours. - If all of the above are true, then the metric will unfurl as seen below: + If all of the above are true, then the metric unfurls as seen below: -![Embedded Metrics](../../user/project/integrations/img/view_embedded_metrics_v12_10.png) +![Embedded Metrics](img/view_embedded_metrics_v12_10.png) Metric charts may also be hidden: -![Show Hide](../../user/project/integrations/img/hide_embedded_metrics_v12_10.png) +![Show Hide](img/hide_embedded_metrics_v12_10.png) -You can open the link directly into your browser for a [detailed view of the data](dashboards/index.md#expand-panel). +You can open the link directly into your browser for a +[detailed view of the data](dashboards/index.md#chart-context-menu). ## Embedding metrics in issue templates -It is also possible to embed either the default dashboard metrics or individual metrics in issue templates. For charts to render side-by-side, links to the entire metrics dashboard or individual metrics should be separated by either a comma or a space. +You can also embed either the overview dashboard metrics or individual metrics in +issue templates. For charts to render side-by-side, separate links to the entire metrics +dashboard or individual metrics by either a comma or a space. -![Embedded Metrics in issue templates](../../user/project/integrations/img/embed_metrics_issue_template.png) +![Embedded Metrics in issue templates](img/embed_metrics_issue_template.png) ## Embedding metrics based on alerts in incident issues -For [GitLab-managed alerting rules](alerts.md), the issue will include an embedded chart for the query corresponding to the alert. The chart displays an hour of data surrounding the starting point of the incident, 30 minutes before and after. +For [GitLab-managed alerting rules](alerts.md), the issue includes an embedded +chart for the query corresponding to the alert. The chart displays an hour of data +surrounding the starting point of the incident, 30 minutes before and after. -For [manually configured Prometheus instances](../../user/project/integrations/prometheus.md#manual-configuration-of-prometheus), a chart corresponding to the query can be included if these requirements are met: +For [manually configured Prometheus instances](../../user/project/integrations/prometheus.md#manual-configuration-of-prometheus), +a chart corresponding to the query can be included if these requirements are met: - The alert corresponds to an environment managed through GitLab. - The alert corresponds to a [range query](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries). @@ -69,25 +79,31 @@ For [manually configured Prometheus instances](../../user/project/integrations/p | Attributes | Required | Description | | ---------- | -------- | ----------- | | `annotations/gitlab_environment_name` | Yes | Name of the GitLab-managed environment corresponding to the alert | -| One of `annotations/title`, `annotations/summary`, `labels/alertname` | Yes | Will be used as the chart title | -| `annotations/gitlab_y_label` | No | Will be used as the chart's y-axis label | +| One of `annotations/title`, `annotations/summary`, `labels/alertname` | Yes | Used as the chart title | +| `annotations/gitlab_y_label` | No | Used as the chart's y-axis label | ## Embedding cluster health charts > - [Introduced](<https://gitlab.com/gitlab-org/gitlab/-/issues/40997>) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 12.9. > - [Moved](<https://gitlab.com/gitlab-org/gitlab/-/issues/208224>) to GitLab core in 13.2. -[Cluster Health Metrics](../../user/project/clusters/index.md#visualizing-cluster-health) can also be embedded in [GitLab-flavored Markdown](../../user/markdown.md). +[Cluster Health Metrics](../../user/project/clusters/index.md#visualizing-cluster-health) +can also be embedded in [GitLab-flavored Markdown](../../user/markdown.md). -To embed a metric chart, include a link to that chart in the form `https://<root_url>/<project>/-/cluster/<cluster_id>?<query_params>` anywhere that GitLab-flavored Markdown is supported. To generate and copy a link to the chart, follow the instructions in the [Cluster Health Metric documentation](../../user/project/clusters/index.md#visualizing-cluster-health). +To embed a metric chart, include a link to that chart in the form +`https://<root_url>/<project>/-/cluster/<cluster_id>?<query_params>` anywhere that +GitLab-flavored Markdown is supported. To generate and copy a link to the chart, +follow the instructions in the +[Cluster Health Metric documentation](../../user/project/clusters/index.md#visualizing-cluster-health). The following requirements must be met for the metric to unfurl: - The `<cluster_id>` must correspond to a real cluster. - Prometheus must be monitoring the cluster. - The user must be allowed access to the project cluster metrics. -- The dashboards must be reporting data on the [Cluster Health Page](../../user/project/clusters/index.md#visualizing-cluster-health) +- The dashboards must be reporting data on the + [Cluster Health Page](../../user/project/clusters/index.md#visualizing-cluster-health) - If the above requirements are met, then the metric will unfurl as seen below. + If the above requirements are met, then the metric unfurls as seen below. -![Embedded Cluster Metric in issue descriptions](../../user/project/integrations/img/prometheus_cluster_health_embed_v12_9.png) +![Embedded Cluster Metric in issue descriptions](img/prometheus_cluster_health_embed_v12_9.png) diff --git a/doc/operations/metrics/embed_grafana.md b/doc/operations/metrics/embed_grafana.md index 427ad866442..2843a4319a8 100644 --- a/doc/operations/metrics/embed_grafana.md +++ b/doc/operations/metrics/embed_grafana.md @@ -4,62 +4,76 @@ group: APM info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers --- -# Embedding Grafana charts +# Embedding Grafana charts **(CORE)** Grafana metrics can be embedded in [GitLab Flavored Markdown](../../user/markdown.md). -## Embedding charts via Grafana Rendered Images +## Embedding charts via Grafana rendered images -It is possible to embed live [Grafana](https://docs.gitlab.com/omnibus/settings/grafana.html) charts in issues, as a [direct linked rendered image](https://grafana.com/docs/grafana/latest/reference/share_panel/#direct-link-rendered-image). +You can embed live [Grafana](https://docs.gitlab.com/omnibus/settings/grafana.html) +charts in issues as a +[direct linked rendered image](https://grafana.com/docs/grafana/latest/reference/share_panel/#direct-link-rendered-image). +The **Direct link rendered image** sharing dialog within Grafana provides the link: -The sharing dialog within Grafana provides the link, as highlighted below. - -![Grafana Direct Linked Rendered Image](../../user/project/integrations/img/grafana_live_embed.png) +![Grafana Direct Linked Rendered Image](img/grafana_live_embed.png) NOTE: **Note:** -For this embed to display correctly, the Grafana instance must be available to the target user, either as a public dashboard, or on the same network. +For this embed to display correctly, the Grafana instance must be available to the +target user, either as a public dashboard or on the same network. -Copy the link and add an image tag as [inline HTML](../../user/markdown.md#inline-html) in your Markdown. You may tweak the query parameters as required. For instance, removing the `&from=` and `&to=` parameters will give you a live chart. Here is example markup for a live chart from GitLab's public dashboard: +Copy the link and add an image tag as [inline HTML](../../user/markdown.md#inline-html) +in your Markdown. You can tweak the query parameters to meet your needs, such as +removing the `&from=` and `&to=` parameters to display a live chart. Here is example +markup for a live chart from GitLab's public dashboard: ```html <img src="https://dashboards.gitlab.com/d/RZmbBr7mk/gitlab-triage?orgId=1&refresh=30s&var-env=gprd&var-environment=gprd&var-prometheus=prometheus-01-inf-gprd&var-prometheus_app=prometheus-app-01-inf-gprd&var-backend=All&var-type=All&var-stage=main&from=1580444107655&to=1580465707655"/> ``` -This will render like so: +This markup renders a graph of `5xx` errors, like this: -![Grafana dashboard embedded preview](../../user/project/integrations/img/grafana_embedded.png) +![Grafana dashboard embedded preview](img/grafana_embedded.png) ## Embedding charts via integration with Grafana HTTP API > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/31376) in GitLab 12.5. -Each project can support integration with one Grafana instance. This configuration allows a user to copy a link to a panel in Grafana, then paste it into a GitLab Markdown field. The chart will be rendered in the GitLab chart format. - -Prerequisites for embedding from a Grafana instance: +Each project can support integration with one Grafana instance. This configuration +enables you to copy a link to a panel in Grafana, then paste it into a GitLab Markdown +field. The chart renders in the GitLab chart format. To embed charts +from a Grafana instance, the data source must: -1. The datasource must be a Prometheus instance. -1. The datasource must be proxyable, so the HTTP Access setting should be set to `Server`. +1. Be a Prometheus instance. +1. Be proxyable, so the HTTP Access setting should be set to `Server`: -![HTTP Proxy Access](../../user/project/integrations/img/http_proxy_access_v12_5.png) + ![HTTP Proxy Access](img/http_proxy_access_v12_5.png) ## Setting up the Grafana integration -1. [Generate an Admin-level API Token in Grafana.](https://grafana.com/docs/grafana/latest/http_api/auth/#create-api-token) +1. In Grafana, [generate an Admin-level API Token](https://grafana.com/docs/grafana/latest/http_api/auth/#create-api-token). 1. In your GitLab project, navigate to **Settings > Operations > Grafana Authentication**. -1. To enable the integration, check the "Active" checkbox. -1. For "Grafana URL", enter the base URL of the Grafana instance. -1. For "API Token", enter the Admin API Token you just generated. +1. To enable the integration, check the **Active** checkbox. +1. For **Grafana URL**, enter the base URL of the Grafana instance. +1. For **API Token**, enter the Admin API Token you just generated. 1. Click **Save Changes**. ## Generating a link to a chart 1. In Grafana, navigate to the dashboard you wish to embed a panel from. - ![Grafana Metric Panel](../../user/project/integrations/img/grafana_panel_v12_5.png) -1. In the upper-left corner of the page, select a specific value for each variable required for the queries in the chart. - ![Select Query Variables](../../user/project/integrations/img/select_query_variables_v12_5.png) -1. In Grafana, click on a panel's title, then click **Share** to open the panel's sharing dialog to the **Link** tab. If you click the _dashboard's_ share panel instead, GitLab will attempt to embed the first supported panel on the dashboard (if available). -1. If your Prometheus queries use Grafana's custom template variables, ensure that the "Template variables" option is toggled to **On**. Of Grafana global template variables, only `$__interval`, `$__from`, and `$__to` are currently supported. Toggle **On** the "Current time range" option to specify the time range of the chart. Otherwise, the default range will be the last 8 hours. - ![Grafana Sharing Dialog](../../user/project/integrations/img/grafana_sharing_dialog_v12_5.png) + ![Grafana Metric Panel](img/grafana_panel_v12_5.png) +1. In the upper-left corner of the page, select a specific value for each variable + required for the queries in the chart. + ![Select Query Variables](img/select_query_variables_v12_5.png) +1. In Grafana, click on a panel's title, then click **Share** to open the panel's + sharing dialog to the **Link** tab. If you click the _dashboard's_ share panel + instead, GitLab attempts to embed the first supported panel on the dashboard (if available). +1. If your Prometheus queries use Grafana's custom template variables, ensure the + **Template variables** option is toggled to **On**. Of Grafana global template + variables, only `$__interval`, `$__from`, and `$__to` are supported. +1. Toggle **On** the **Current time range** option to specify the time range of + the chart. Otherwise, the default range is the last 8 hours. + ![Grafana Sharing Dialog](img/grafana_sharing_dialog_v12_5.png) 1. Click **Copy** to copy the URL to the clipboard. -1. In GitLab, paste the URL into a Markdown field and save. The chart will take a few moments to render. - ![GitLab Rendered Grafana Panel](../../user/project/integrations/img/rendered_grafana_embed_v12_5.png) +1. In GitLab, paste the URL into a Markdown field and save. The chart takes a few + moments to render. + ![GitLab Rendered Grafana Panel](img/rendered_grafana_embed_v12_5.png) diff --git a/doc/operations/metrics/img/copy_link_to_chart_v12_10.png b/doc/operations/metrics/img/copy_link_to_chart_v12_10.png Binary files differnew file mode 100644 index 00000000000..fc205240ea5 --- /dev/null +++ b/doc/operations/metrics/img/copy_link_to_chart_v12_10.png diff --git a/doc/operations/metrics/img/embed_metrics_issue_template.png b/doc/operations/metrics/img/embed_metrics_issue_template.png Binary files differnew file mode 100644 index 00000000000..ca39a738d5f --- /dev/null +++ b/doc/operations/metrics/img/embed_metrics_issue_template.png diff --git a/doc/operations/metrics/img/embedded_metrics_markdown_v12_8.png b/doc/operations/metrics/img/embedded_metrics_markdown_v12_8.png Binary files differnew file mode 100644 index 00000000000..ffd34705464 --- /dev/null +++ b/doc/operations/metrics/img/embedded_metrics_markdown_v12_8.png diff --git a/doc/operations/metrics/img/embedded_metrics_rendered_v12_8.png b/doc/operations/metrics/img/embedded_metrics_rendered_v12_8.png Binary files differnew file mode 100644 index 00000000000..b024daaaa8e --- /dev/null +++ b/doc/operations/metrics/img/embedded_metrics_rendered_v12_8.png diff --git a/doc/operations/metrics/img/example-dashboard_v13_1.png b/doc/operations/metrics/img/example-dashboard_v13_1.png Binary files differdeleted file mode 100644 index 0cda4ece689..00000000000 --- a/doc/operations/metrics/img/example-dashboard_v13_1.png +++ /dev/null diff --git a/doc/operations/metrics/img/example-dashboard_v13_3.png b/doc/operations/metrics/img/example-dashboard_v13_3.png Binary files differnew file mode 100644 index 00000000000..1178b4a9be7 --- /dev/null +++ b/doc/operations/metrics/img/example-dashboard_v13_3.png diff --git a/doc/operations/metrics/img/grafana_embedded.png b/doc/operations/metrics/img/grafana_embedded.png Binary files differnew file mode 100644 index 00000000000..c7946aa4b10 --- /dev/null +++ b/doc/operations/metrics/img/grafana_embedded.png diff --git a/doc/operations/metrics/img/grafana_live_embed.png b/doc/operations/metrics/img/grafana_live_embed.png Binary files differnew file mode 100644 index 00000000000..91970cd379a --- /dev/null +++ b/doc/operations/metrics/img/grafana_live_embed.png diff --git a/doc/operations/metrics/img/grafana_panel_v12_5.png b/doc/operations/metrics/img/grafana_panel_v12_5.png Binary files differnew file mode 100644 index 00000000000..18c17b910cd --- /dev/null +++ b/doc/operations/metrics/img/grafana_panel_v12_5.png diff --git a/doc/operations/metrics/img/grafana_sharing_dialog_v12_5.png b/doc/operations/metrics/img/grafana_sharing_dialog_v12_5.png Binary files differnew file mode 100644 index 00000000000..fae62dd50df --- /dev/null +++ b/doc/operations/metrics/img/grafana_sharing_dialog_v12_5.png diff --git a/doc/operations/metrics/img/hide_embedded_metrics_v12_10.png b/doc/operations/metrics/img/hide_embedded_metrics_v12_10.png Binary files differnew file mode 100644 index 00000000000..1213029d1d1 --- /dev/null +++ b/doc/operations/metrics/img/hide_embedded_metrics_v12_10.png diff --git a/doc/operations/metrics/img/http_proxy_access_v12_5.png b/doc/operations/metrics/img/http_proxy_access_v12_5.png Binary files differnew file mode 100644 index 00000000000..0036a916a12 --- /dev/null +++ b/doc/operations/metrics/img/http_proxy_access_v12_5.png diff --git a/doc/operations/metrics/img/linked_runbooks_on_charts.png b/doc/operations/metrics/img/linked_runbooks_on_charts.png Binary files differnew file mode 100644 index 00000000000..335ba5dc172 --- /dev/null +++ b/doc/operations/metrics/img/linked_runbooks_on_charts.png diff --git a/doc/operations/metrics/img/prometheus_add_metric.png b/doc/operations/metrics/img/prometheus_add_metric.png Binary files differnew file mode 100644 index 00000000000..32a7cbf3a73 --- /dev/null +++ b/doc/operations/metrics/img/prometheus_add_metric.png diff --git a/doc/operations/metrics/img/prometheus_alert.png b/doc/operations/metrics/img/prometheus_alert.png Binary files differnew file mode 100644 index 00000000000..08680c88b23 --- /dev/null +++ b/doc/operations/metrics/img/prometheus_alert.png diff --git a/doc/operations/metrics/img/prometheus_cluster_health_embed_v12_9.png b/doc/operations/metrics/img/prometheus_cluster_health_embed_v12_9.png Binary files differnew file mode 100644 index 00000000000..c669467757f --- /dev/null +++ b/doc/operations/metrics/img/prometheus_cluster_health_embed_v12_9.png diff --git a/doc/operations/metrics/img/prometheus_dashboard_edit_metric_link_v_12_9.png b/doc/operations/metrics/img/prometheus_dashboard_edit_metric_link_v_12_9.png Binary files differnew file mode 100644 index 00000000000..b66b1a9f39b --- /dev/null +++ b/doc/operations/metrics/img/prometheus_dashboard_edit_metric_link_v_12_9.png diff --git a/doc/operations/metrics/img/prometheus_monitoring_dashboard_v13_3.png b/doc/operations/metrics/img/prometheus_monitoring_dashboard_v13_3.png Binary files differnew file mode 100644 index 00000000000..1178b4a9be7 --- /dev/null +++ b/doc/operations/metrics/img/prometheus_monitoring_dashboard_v13_3.png diff --git a/doc/operations/metrics/img/prometheus_service_alerts.png b/doc/operations/metrics/img/prometheus_service_alerts.png Binary files differnew file mode 100644 index 00000000000..609c5e5196c --- /dev/null +++ b/doc/operations/metrics/img/prometheus_service_alerts.png diff --git a/doc/operations/metrics/img/rendered_grafana_embed_v12_5.png b/doc/operations/metrics/img/rendered_grafana_embed_v12_5.png Binary files differnew file mode 100644 index 00000000000..6cabe4193bd --- /dev/null +++ b/doc/operations/metrics/img/rendered_grafana_embed_v12_5.png diff --git a/doc/operations/metrics/img/select_query_variables_v12_5.png b/doc/operations/metrics/img/select_query_variables_v12_5.png Binary files differnew file mode 100644 index 00000000000..23503577327 --- /dev/null +++ b/doc/operations/metrics/img/select_query_variables_v12_5.png diff --git a/doc/operations/metrics/img/view_embedded_metrics_v12_10.png b/doc/operations/metrics/img/view_embedded_metrics_v12_10.png Binary files differnew file mode 100644 index 00000000000..95bb148ba71 --- /dev/null +++ b/doc/operations/metrics/img/view_embedded_metrics_v12_10.png diff --git a/doc/operations/metrics/index.md b/doc/operations/metrics/index.md index 12088884f44..92c4a4986bc 100644 --- a/doc/operations/metrics/index.md +++ b/doc/operations/metrics/index.md @@ -4,7 +4,64 @@ group: APM info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers --- -# Monitor metrics for your CI/CD environment +# Monitor your CI/CD environment's metrics **(CORE)** + +GitLab helps your team monitor the health and performance of your applications +and infrastructure by turning statistics and log files into charts and graphs +that are easy to understand, especially when time is short and decisions are +critical. For GitLab to display your information in charts, you must: + +1. **Instrument your application** - Collect accurate and complete measurements. + <I class="fa fa-youtube-play youtube" aria-hidden="true"></I> + For an overview, see [How to instrument Prometheus metrics in GitLab](https://www.youtube.com/watch?v=tuI2oJ3TTB4). +1. **Expose metrics for capture** - Make logs, metrics, and traces available for capture. +1. [**Configure Prometheus to gather metrics**](#configure-prometheus-to-gather-metrics) - + Deploy managed applications like Elasticsearch, Prometheus, and Jaeger to gather + the data you've exposed. +1. **GitLab collects metrics** - GitLab uses Prometheus to scrape the data you've + captured in your managed apps, and prepares the data for display. To learn more, read + [Collect and process metrics](#collect-and-process-metrics). +1. **Display charts in the GitLab user interface** - GitLab converts your metrics + into easy-to-read charts on a default dashboard. You can create as many custom charts + and custom dashboards as needed so your team has full insight into your + application's health. + +## Configure Prometheus to gather metrics + +You must connect a Prometheus instance to GitLab to collect metrics. How you configure +your Prometheus integration depends on where your apps are running: + +- **For manually-configured Prometheus** - + [Specify your Prometheus server](../../user/project/integrations/prometheus.md#manual-configuration-of-prometheus), + and define at least one environment. +- **For GitLab-managed Prometheus** - GitLab can + [deploy and manage Prometheus](../../user/project/integrations/prometheus.md#managed-prometheus-on-kubernetes) for you. + You must also complete a code deployment, as described in + [Deploy code with GitLab-managed Prometheus](#deploy-code-with-gitlab-managed-prometheus), + for the **Operations > Metrics** page to contain data. + +### Deploy code with GitLab-managed Prometheus + +For GitLab-managed Prometheus, you can set up [Auto DevOps](../../topics/autodevops/index.md) +to quickly create a deployment: + +1. Navigate to your project's **Operations > Kubernetes** page. +1. Ensure that, in addition to Prometheus, you also have Runner and Ingress + installed. +1. After installing Ingress, copy its endpoint. +1. Navigate to your project's **Settings > CI/CD** page. In the + **Auto DevOps** section, select a deployment strategy and save your changes. +1. On the same page, in the **Variables** section, add a variable named + `KUBE_INGRESS_BASE_DOMAIN` with the value of the Ingress endpoint you + copied previously. Leave the type as **Variable**. +1. Navigate to your project's **{rocket}** **CI/CD > Pipelines** page, and run a + pipeline on any branch. +1. When the pipeline has run successfully, graphs are available on the + **Operations > Metrics** page. + +![Monitoring Dashboard](img/prometheus_monitoring_dashboard_v13_3.png) + +## Collect and process metrics After [configuring Prometheus for a cluster](../../user/project/integrations/prometheus.md), GitLab attempts to retrieve performance metrics for any [environment](../../ci/environments/index.md) with @@ -15,17 +72,17 @@ and NGINX, and attempts to identify individual environments. To learn more about the supported metrics and scan processes, see the [Prometheus Metrics Library documentation](../../user/project/integrations/prometheus_library/index.md). -To view the metrics dashboard for an environment that has -[completed at least one deployment](#populate-your-metrics-dashboard): +To view the [default metrics dashboard](dashboards/default.md) for an environment that is +[configured to gather metrics](#configure-prometheus-to-gather-metrics): 1. *If the metrics dashboard is only visible to project members,* sign in to GitLab as a member of a project. Learn more about [metrics dashboard visibility](#metrics-dashboard-visibility). -1. In your project, navigate to **{cloud-gear}** **Operations > Metrics**. +1. In your project, navigate to **Operations > Metrics**. -GitLab displays the default metrics dashboard for the environment, like the -following example: +GitLab displays the [default metrics dashboard](dashboards/default.md) for the environment, +like the following example: -![Example of metrics dashboard](img/example-dashboard_v13_1.png) +![Example of metrics dashboard](img/example-dashboard_v13_3.png) The top of the dashboard contains a navigation bar. From left to right, the navigation bar contains: @@ -37,38 +94,22 @@ navigation bar contains: - **Range** - The time period of data to display. - **Refresh dashboard** **{retry}** - Reload the dashboard with current data. - **Set refresh rate** - Set a time frame for refreshing the data displayed. -- **Star dashboard** **{star-o}** - Click to mark a dashboard as a favorite. +- **More actions** **{ellipsis_v}** - More dashboard actions + - **Add metric** - Adds a [custom metric](#adding-custom-metrics). Only available on GitLab-defined dashboards. + ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/34779) in GitLab 12.5.) + - **Edit dashboard YAML** - Edit the source YAML file of a custom dashboard. Only available on + [custom dashboards](dashboards/index.md). + ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/34779) in GitLab 12.5.) + - **Duplicate current dashboard** - Save a [complete copy of a dashboard](dashboards/index.md#duplicate-a-gitlab-defined-dashboard). Only available on GitLab-defined dashboards. + - **Star dashboard** **{star-o}** - Click to mark a dashboard as a favorite. Starred dashboards display a solid star **{star}** button, and display first in the **Dashboard** dropdown list. ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/214582) in GitLab 13.0.) -- **Create dashboard** **{file-addition-solid}** - Create a - [new custom dashboard for your project](dashboards/index.md#adding-a-new-dashboard-to-your-project). -- **Metrics settings** **{settings}** - Configure the + - **Create new dashboard** - Create a [new custom dashboard for your project](dashboards/index.md#add-a-new-dashboard-to-your-project). + ([Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/228856) in GitLab 13.3.) +- **Metrics settings** - Configure the [settings for this dashboard](dashboards/index.md#manage-the-metrics-dashboard-settings). -## Populate your metrics dashboard - -After [configuring Prometheus for a cluster](../../user/project/integrations/prometheus.md), -you must also deploy code for the **{cloud-gear}** **Operations > Metrics** page -to contain data. Setting up [Auto DevOps](../../topics/autodevops/index.md) -helps quickly create a deployment: - -1. Navigate to your project's **{cloud-gear}** **Operations > Kubernetes** page. -1. Ensure that, in addition to Prometheus, you also have Runner and Ingress - installed. -1. After installing Ingress, copy its endpoint. -1. Navigate to your project's **{settings}** **Settings > CI/CD** page. In the - **Auto DevOps** section, select a deployment strategy and save your changes. -1. On the same page, in the **Variables** section, add a variable named - `KUBE_INGRESS_BASE_DOMAIN` with the value of the Ingress endpoint you - copied previously. Leave the type as **Variable**. -1. Navigate to your project's **{rocket}** **CI/CD > Pipelines** page, and run a - pipeline on any branch. -1. When the pipeline has run successfully, graphs are available on the - **{cloud-gear}** **Operations > Metrics** page. - -![Monitoring Dashboard](../../user/project/integrations/img/prometheus_monitoring_dashboard_v13_1.png) - ## Customize your metrics dashboard After creating your dashboard, you can customize it to meet your needs: @@ -101,7 +142,7 @@ After saving them, they display on the environment metrics dashboard provided th [Prometheus installed on the cluster](../../user/project/integrations/prometheus.md#enabling-prometheus-integration). - Prometheus is [manually configured](../../user/project/integrations/prometheus.md#manual-configuration-of-prometheus). -![Add New Metric](../../user/project/integrations/img/prometheus_add_metric.png) +![Add New Metric](img/prometheus_add_metric.png) A few fields are required: @@ -124,7 +165,7 @@ suggested if this feature is used. You can edit existing additional custom metrics for your dashboard by clicking the **{ellipsis_v}** **More actions** dropdown and selecting **Edit metric**. -![Edit metric](../../user/project/integrations/img/prometheus_dashboard_edit_metric_link_v_12_9.png) +![Edit metric](img/prometheus_dashboard_edit_metric_link_v_12_9.png) ## Keyboard shortcuts for charts |