Dashboard annotations API
原文:https://docs.gitlab.com/ee/api/metrics_dashboard_annotations.html
Dashboard annotations API
版本历史
- 在 GitLab 12.10 中在禁用的功能标志后面引入 .
 
指标仪表板注释使您可以在单个时间点或整个时间段内指示图形上的事件.
Create a new annotation
POST /environments/:id/metrics_dashboard/annotations/
POST /clusters/:id/metrics_dashboard/annotations/ 
注意: dashboard_path的值将被视为 CGI 转义的路径,并自动取消转义.
Parameters:
| Attribute | Type | Required | Description | 
|---|---|---|---|
 dashboard_path  | 
string | yes | 需要注释的仪表盘的 ID. | 
 starting_at  | 
string | yes |  日期时间字符串,ISO 8601 格式,例如2016-03-11T03:45:40Z . 注释的时间戳标记起点.  | 
 ending_at  | 
string | no |  日期时间字符串,ISO 8601 格式,例如2016-03-11T03:45:40Z . 注释的时间戳标记终点. 如果未提供,注释将在起点显示为单个事件.  | 
 description  | 
string | yes | 注释的描述. | 
curl --header "Private-Token: <your_access_token>" "https://gitlab.example.com/api/v4/environments/1/metrics_dashboard/annotations" \
 --data-urlencode "dashboard_path=.gitlab/dashboards/custom_metrics.yml" \
 --data-urlencode "starting_at=2016-03-11T03:45:40Z" \
 --data-urlencode "description=annotation description" 
示例响应:
{  "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  }