debian-mirror-gitlab/doc/operations/metrics/embed.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

128 lines
5.6 KiB
Markdown
Raw Normal View History

2020-07-28 23:09:34 +05:30
---
stage: Monitor
2022-04-04 11:22:00 +05:30
group: Respond
2021-02-22 17:27:13 +05:30
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/#assignments
2020-07-28 23:09:34 +05:30
---
2021-04-17 20:07:23 +05:30
# Embedding metric charts within GitLab Flavored Markdown **(FREE)**
2020-10-24 23:57:45 +05:30
2022-07-16 23:28:13 +05:30
> [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/346541) in GitLab 14.7.
WARNING:
This feature is in its end-of-life process. It is [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/346541)
for use in GitLab 14.7, and is planned for removal in GitLab 16.0.
2020-10-24 23:57:45 +05:30
You can display metrics charts within
2022-06-21 17:19:12 +05:30
[GitLab Flavored Markdown (GLFM)](../../user/markdown.md)
2020-10-24 23:57:45 +05:30
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.
2020-07-28 23:09:34 +05:30
## Embedding GitLab-managed Kubernetes metrics
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/29691) in GitLab 12.2.
2021-01-03 14:25:43 +05:30
This feature requires [Kubernetes](../../user/project/integrations/prometheus_library/kubernetes.md) metrics.
2020-07-28 23:09:34 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2020-11-24 15:15:51 +05:30
In GitLab versions 13.3 and earlier, metrics dashboard links were in the form
`https://<root_url>/<project>/-/environments/<environment_id>/metrics`. These links
are still supported, and can be used to embed metric charts.
2020-10-24 23:57:45 +05:30
To display metric charts, include a link of the form
2020-11-24 15:15:51 +05:30
`https://<root_url>/<project>/-/metrics?environment=<environment_id>` in a field
2022-06-21 17:19:12 +05:30
that supports GitLab Flavored Markdown:
2020-07-28 23:09:34 +05:30
2020-11-24 15:15:51 +05:30
```markdown
### Summary
**Start time:** 2020-01-21T12:00:31+00:00
### Metrics
https://gitlab.com/gitlab-org/monitor/tanuki-inc/-/metrics?environment=1118134
```
2020-07-28 23:09:34 +05:30
GitLab unfurls the link as an embedded metrics panel:
2020-11-24 15:15:51 +05:30
![Embedded Metrics Rendered](img/embedded_metrics_rendered_v13_4.png)
2020-07-28 23:09:34 +05:30
2022-07-23 23:45:48 +05:30
You can also embed a single chart. To get a link to a chart, select
**{ellipsis_v}** **More actions** in the upper right corner of the chart,
2020-07-28 23:09:34 +05:30
and select **Copy link to chart**, as shown in this example:
2020-10-24 23:57:45 +05:30
![Copy Link To Chart](img/copy_link_to_chart_v12_10.png)
2020-07-28 23:09:34 +05:30
The following requirements must be met for the metric to unfurl:
- The `<environment_id>` must correspond to a real environment.
- Prometheus must be monitoring the environment.
- The GitLab instance must be configured to receive data from the environment.
2022-04-04 11:22:00 +05:30
- The user must have at least the Reporter role for the monitoring dashboard for the environment.
2020-07-28 23:09:34 +05:30
- The dashboard must have data within the last 8 hours.
2020-10-24 23:57:45 +05:30
If all of the above are true, then the metric unfurls as seen below:
2020-07-28 23:09:34 +05:30
2020-10-24 23:57:45 +05:30
![Embedded Metrics](img/view_embedded_metrics_v12_10.png)
2020-07-28 23:09:34 +05:30
Metric charts may also be hidden:
2020-10-24 23:57:45 +05:30
![Show Hide](img/hide_embedded_metrics_v12_10.png)
2020-07-28 23:09:34 +05:30
2020-10-24 23:57:45 +05:30
You can open the link directly into your browser for a
[detailed view of the data](dashboards/index.md#chart-context-menu).
2020-07-28 23:09:34 +05:30
## Embedding metrics in issue templates
2020-10-24 23:57:45 +05:30
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.
2020-07-28 23:09:34 +05:30
2020-10-24 23:57:45 +05:30
![Embedded Metrics in issue templates](img/embed_metrics_issue_template.png)
2020-07-28 23:09:34 +05:30
## Embedding metrics based on alerts in incident issues
2020-10-24 23:57:45 +05:30
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.
2020-07-28 23:09:34 +05:30
2020-10-24 23:57:45 +05:30
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:
2020-07-28 23:09:34 +05:30
- 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).
- The alert contains the required attributes listed in the chart below.
| Attributes | Required | Description |
| ---------- | -------- | ----------- |
| `annotations/gitlab_environment_name` | Yes | Name of the GitLab-managed environment corresponding to the alert |
2020-10-24 23:57:45 +05:30
| 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 |
2020-07-28 23:09:34 +05:30
## Embedding cluster health charts
2021-11-18 22:05:49 +05:30
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/40997) in GitLab 12.9.
> - [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/208224) from GitLab Ultimate to GitLab Free in 13.2.
2020-07-28 23:09:34 +05:30
2021-11-18 22:05:49 +05:30
[Cluster Health Metrics](../../user/infrastructure/clusters/manage/clusters_health.md)
2022-06-21 17:19:12 +05:30
can also be embedded in [GitLab Flavored Markdown](../../user/markdown.md).
2020-07-28 23:09:34 +05:30
2020-10-24 23:57:45 +05:30
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
2022-06-21 17:19:12 +05:30
GitLab Flavored Markdown is supported. To generate and copy a link to the chart,
2020-10-24 23:57:45 +05:30
follow the instructions in the
2021-11-18 22:05:49 +05:30
[Cluster Health Metric documentation](../../user/infrastructure/clusters/manage/clusters_health.md).
2020-07-28 23:09:34 +05:30
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.
2020-10-24 23:57:45 +05:30
- The dashboards must be reporting data on the
2021-11-18 22:05:49 +05:30
[Cluster Health Page](../../user/infrastructure/clusters/manage/clusters_health.md)
2020-07-28 23:09:34 +05:30
2020-10-24 23:57:45 +05:30
If the above requirements are met, then the metric unfurls as seen below.
2020-07-28 23:09:34 +05:30
2020-10-24 23:57:45 +05:30
![Embedded Cluster Metric in issue descriptions](img/prometheus_cluster_health_embed_v12_9.png)