debian-mirror-gitlab/doc/api/metrics_dashboard_annotations.md

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

50 lines
2.1 KiB
Markdown
Raw Permalink Normal View History

2020-07-28 23:09:34 +05:30
---
stage: Monitor
2022-04-04 11:22:00 +05:30
group: Respond
2022-11-25 23:54:43 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2020-07-28 23:09:34 +05:30
type: concepts, howto
---
2021-03-11 19:13:27 +05:30
# Dashboard annotations API **(FREE)**
2020-04-22 19:07:51 +05:30
2021-11-11 11:23:49 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29089) in GitLab 12.10 behind a disabled feature flag.
2020-04-22 19:07:51 +05:30
2020-06-23 00:09:42 +05:30
Metrics dashboard annotations allow you to indicate events on your graphs at a single point in time or over a time span.
2020-04-22 19:07:51 +05:30
## Create a new annotation
```plaintext
POST /environments/:id/metrics_dashboard/annotations/
2020-05-24 23:13:21 +05:30
POST /clusters/:id/metrics_dashboard/annotations/
2020-04-22 19:07:51 +05:30
```
Parameters:
| Attribute | Type | Required | Description |
|:---------------|:---------------|:---------|:-----------------------------------------------------------------------------|
2021-01-03 14:25:43 +05:30
| `dashboard_path` | string | yes | ID of the dashboard which needs to be annotated. Treated as a CGI-escaped path, and automatically un-escaped. |
2020-04-22 19:07:51 +05:30
| `starting_at` | string | yes | Date time string, ISO 8601 formatted, such as `2016-03-11T03:45:40Z`. Timestamp marking start point of annotation. |
2021-02-22 17:27:13 +05:30
| `ending_at` | string | no | Date time string, ISO 8601 formatted, such as `2016-03-11T03:45:40Z`. Timestamp marking end point of annotation. When not supplied, an annotation displays as a single event at the start point. |
2020-04-22 19:07:51 +05:30
| `description` | string | yes | Description of the annotation. |
```shell
2020-06-23 00:09:42 +05:30
curl --header "Private-Token: <your_access_token>" "https://gitlab.example.com/api/v4/environments/1/metrics_dashboard/annotations" \
2020-04-22 19:07:51 +05:30
--data-urlencode "dashboard_path=.gitlab/dashboards/custom_metrics.yml" \
--data-urlencode "starting_at=2016-03-11T03:45:40Z" \
--data-urlencode "description=annotation description"
```
Example Response:
```json
{
"id": 4,
"starting_at": "2016-04-08T03:45:40.000Z",
"ending_at": null,
"dashboard_path": ".gitlab/dashboards/custom_metrics.yml",
"description": "annotation description",
"environment_id": 1,
"cluster_id": null
}
```