Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ci-pipelines alert to monitors enum #731

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.5.1.dev2",
"regenerated": "2021-12-21 21:26:08.942395",
"spec_repo_commit": "44311ae"
"regenerated": "2021-12-21 21:41:56.287406",
"spec_repo_commit": "ee277b0"
},
"v2": {
"apigentools_version": "1.5.1.dev2",
"regenerated": "2021-12-21 21:26:09.337210",
"spec_repo_commit": "44311ae"
"regenerated": "2021-12-21 21:41:56.690616",
"spec_repo_commit": "ee277b0"
}
}
}
29 changes: 28 additions & 1 deletion .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6191,6 +6191,7 @@ components:
- slo alert
- event-v2 alert
- audit alert
- ci-pipelines alert
example: query alert
type: string
x-enum-varnames:
Expand All @@ -6207,6 +6208,7 @@ components:
- SLO_ALERT
- EVENT_V2_ALERT
- AUDIT_ALERT
- CI_PIPELINES_ALERT
MonitorUpdateRequest:
description: Object describing a monitor update request.
properties:
Expand Down Expand Up @@ -20201,7 +20203,32 @@ paths:


**NOTE** Only available on US1-FED and in closed beta on US1, EU, US3, and
US5.'
US5.


**CI Pipelines Alert Query**


Example: `ci-pipelines(query).rollup(rollup_method[, measure]).last(time_window)
operator #`


- **`query`** The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/).

- **`rollup_method`** The stats roll-up method - supports `count`, `avg`,
and `cardinality`.

- **`measure`** For `avg` and cardinality `rollup_method` - specify the measure
or the facet name you want to use.

- **`time_window`** #m (between 1 and 2880), #h (between 1 and 48).

- **`operator`** `<`, `<=`, `>`, `>=`, `==`, or `!=`.

- **`#`** an integer or decimal number used to set the threshold.


**NOTE** Only available in closed beta on US1, EU, US3 and US5.'
operationId: CreateMonitor
requestBody:
content:
Expand Down
6 changes: 3 additions & 3 deletions docs/v1/MonitorType.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions docs/v1/MonitorsApi.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/datadog_api_client/v1/api/monitors_api.py

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/datadog_api_client/v1/model/monitor_type.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2021-12-21T21:17:36.158Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
interactions:
- request:
body: '{"message":"some message Notify: @hipchat-channel","name":"Test-Create_a_ci_pipelines_monitor_returns_OK_response-1640121456","options":{"thresholds":{"critical":1}},"priority":3,"query":"ci-pipelines(\"ci_level:pipeline
@git.branch:staging* @ci.status:error\").rollup(\"count\").by(\"@git.branch,@ci.pipeline.name\").last(\"5m\")
>= 1","tags":["test:testcreateacipipelinesmonitorreturnsokresponse1640121456","env:ci"],"type":"ci-pipelines
alert"}'
headers:
accept:
- '*/*'
connection:
- close
content-length:
- '447'
content-type:
- application/json
host:
- api.datadoghq.com
user-agent:
- datadog-api-spec/scripts/bdd-runner
x-datadog-parent-id:
- '8167805434709641945'
x-datadog-trace-id:
- '3445354388052141751'
method: POST
uri: https://api.datadoghq.com/api/v1/monitor
response:
body:
string: '{"restricted_roles":null,"tags":["test:testcreateacipipelinesmonitorreturnsokresponse1640121456","env:ci"],"deleted":null,"query":"ci-pipelines(\"ci_level:pipeline
@git.branch:staging* @ci.status:error\").rollup(\"count\").by(\"@git.branch,@ci.pipeline.name\").last(\"5m\")
>= 1","message":"some message Notify: @hipchat-channel","id":58636377,"multi":true,"name":"Test-Create_a_ci_pipelines_monitor_returns_OK_response-1640121456","created":"2021-12-21T21:17:36.335165+00:00","created_at":1640121456000,"creator":{"id":1445416,"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"org_id":321813,"modified":"2021-12-21T21:17:36.335165+00:00","priority":3,"overall_state_modified":null,"overall_state":"No
Data","type":"ci-pipelines alert","options":{"notify_audit":false,"locked":false,"silenced":{},"include_tags":true,"thresholds":{"critical":1.0},"new_host_delay":300,"notify_no_data":false,"groupby_simple_monitor":false}}'
headers:
cache-control:
- no-cache
connection:
- close
content-length:
- '946'
content-security-policy:
- frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report
content-type:
- application/json
date:
- Tue, 21 Dec 2021 21:17:36 GMT
pragma:
- no-cache
strict-transport-security:
- max-age=15724800;
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
x-ratelimit-limit:
- '500'
x-ratelimit-period:
- '10'
x-ratelimit-remaining:
- '499'
x-ratelimit-reset:
- '4'
status:
code: 200
message: OK
- request:
body: null
headers:
accept:
- '*/*'
connection:
- close
host:
- api.datadoghq.com
user-agent:
- datadog-api-spec/scripts/bdd-runner
x-datadog-parent-id:
- '6388444710619614063'
x-datadog-trace-id:
- '3445354388052141751'
method: DELETE
uri: https://api.datadoghq.com/api/v1/monitor/58636377
response:
body:
string: '{"deleted_monitor_id":58636377}'
headers:
cache-control:
- no-cache
connection:
- close
content-length:
- '31'
content-security-policy:
- frame-ancestors 'self'; report-uri https://api.datadoghq.com/csp-report
content-type:
- application/json
date:
- Tue, 21 Dec 2021 21:17:36 GMT
pragma:
- no-cache
strict-transport-security:
- max-age=15724800;
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
x-frame-options:
- SAMEORIGIN
status:
code: 200
message: OK
version: 1
7 changes: 7 additions & 0 deletions tests/v1/features/monitors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ Feature: Monitors
When the request is sent
Then the response status is 200 OK

@team:DataDog/monitor-app
Scenario: Create a ci-pipelines monitor returns "OK" response
Given new "CreateMonitor" request
And body with value {"name": "{{ unique }}","type": "ci-pipelines alert","query": "ci-pipelines(\"ci_level:pipeline @git.branch:staging* @ci.status:error\").rollup(\"count\").by(\"@git.branch,@ci.pipeline.name\").last(\"5m\") >= 1","message": "some message Notify: @hipchat-channel", "tags": ["test:{{ unique_lower_alnum }}", "env:ci"],"priority": 3,"options":{"thresholds":{"critical":1}}}
When the request is sent
Then the response status is 200 OK

@team:DataDog/monitor-app
Scenario: Create a monitor returns "Bad Request" response
Given new "CreateMonitor" request
Expand Down