Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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:09.632349",
"spec_repo_commit": "44311ae"
"regenerated": "2021-12-21 21:41:44.151379",
"spec_repo_commit": "ee277b0"
},
"v2": {
"apigentools_version": "1.5.1.dev2",
"regenerated": "2021-12-21 21:26:09.652530",
"spec_repo_commit": "44311ae"
"regenerated": "2021-12-21 21:41:44.169261",
"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
13 changes: 13 additions & 0 deletions api/v1/datadog/api_monitors.go

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

2 changes: 2 additions & 0 deletions api/v1/datadog/docs/MonitorType.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

* `AUDIT_ALERT` (value: `"audit alert"`)

* `CI_PIPELINES_ALERT` (value: `"ci-pipelines alert"`)


[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
13 changes: 13 additions & 0 deletions api/v1/datadog/docs/MonitorsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,19 @@ Example: `audits(query).rollup(rollup_method[, measure]).last(time_window) opera

**NOTE** Only available on US1-FED and in closed beta on US1, EU, US3, and 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.

### Example

```go
Expand Down
2 changes: 2 additions & 0 deletions api/v1/datadog/model_monitor_type.go

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,110 @@
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\") \u003e= 1","tags":["test:testcreateacipipelinesmonitorreturnsokresponse1640121456","env:ci"],"type":"ci-pipelines alert"}
form: {}
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
url: https://api.datadoghq.com/api/v1/monitor
response:
body: '{"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":"[email protected]","name":null,"email":"[email protected]"},"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}}'
code: 200
duration: ''
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: 200 OK
- request:
body: ''
form: {}
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
url: https://api.datadoghq.com/api/v1/monitor/58636377
response:
body: '{"deleted_monitor_id":58636377}'
code: 200
duration: ''
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: 200 OK
version: 1
7 changes: 7 additions & 0 deletions tests/scenarios/features/v1/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