Skip to content

Commit e46eb9d

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit d65e6213 of spec repo (#992)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
1 parent 1dd5aca commit e46eb9d

12 files changed

+262
-6
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.2",
7-
"regenerated": "2022-05-18 14:23:46.312017",
8-
"spec_repo_commit": "e1764101"
7+
"regenerated": "2022-05-19 09:29:33.345761",
8+
"spec_repo_commit": "d65e6213"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.2",
12-
"regenerated": "2022-05-18 14:23:46.328977",
13-
"spec_repo_commit": "e1764101"
12+
"regenerated": "2022-05-19 09:29:33.359938",
13+
"spec_repo_commit": "d65e6213"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5814,11 +5814,13 @@ components:
58145814
enum:
58155815
- rum
58165816
- ci_pipelines
5817+
- ci_tests
58175818
example: rum
58185819
type: string
58195820
x-enum-varnames:
58205821
- RUM
58215822
- CI_PIPELINES
5823+
- CI_TESTS
58225824
MonitorFormulaAndFunctionQueryDefinition:
58235825
description: A formula and function query.
58245826
oneOf:
@@ -6513,6 +6515,7 @@ components:
65136515
- event-v2 alert
65146516
- audit alert
65156517
- ci-pipelines alert
6518+
- ci-tests alert
65166519
- error-tracking alert
65176520
example: query alert
65186521
type: string
@@ -6531,6 +6534,7 @@ components:
65316534
- EVENT_V2_ALERT
65326535
- AUDIT_ALERT
65336536
- CI_PIPELINES_ALERT
6537+
- CI_TESTS_ALERT
65346538
- ERROR_TRACKING_ALERT
65356539
MonitorUpdateRequest:
65366540
description: Object describing a monitor update request.
@@ -21644,6 +21648,32 @@ paths:
2164421648
**NOTE** CI Pipeline monitors are in alpha on US1, EU, US3 and US5.
2164521649

2164621650

21651+
**CI Tests Alert Query**
21652+
21653+
21654+
Example: `ci-tests(query).rollup(rollup_method[, measure]).last(time_window)
21655+
operator #`
21656+
21657+
21658+
- **`query`** The search query - following the [Log search syntax](https://docs.datadoghq.com/logs/search_syntax/).
21659+
21660+
- **`rollup_method`** The stats roll-up method - supports `count`, `avg`,
21661+
and `cardinality`.
21662+
21663+
- **`measure`** For `avg` and cardinality `rollup_method` - specify the measure
21664+
or the facet name you want to use.
21665+
21666+
- **`time_window`** #m (between 1 and 2880), #h (between 1 and 48).
21667+
21668+
- **`operator`** `<`, `<=`, `>`, `>=`, `==`, or `!=`.
21669+
21670+
- **`#`** an integer or decimal number used to set the threshold.
21671+
21672+
21673+
**NOTE** CI Test monitors are available only in closed beta on US1, EU, US3
21674+
and US5.
21675+
21676+
2164721677
**Error Tracking Alert Query**
2164821678

2164921679

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
"""
2+
Create a ci-tests formula and functions monitor returns "OK" response
3+
"""
4+
5+
from datadog_api_client.v1 import ApiClient, Configuration
6+
from datadog_api_client.v1.api.monitors_api import MonitorsApi
7+
from datadog_api_client.v1.model.monitor import Monitor
8+
from datadog_api_client.v1.model.monitor_formula_and_function_event_aggregation import (
9+
MonitorFormulaAndFunctionEventAggregation,
10+
)
11+
from datadog_api_client.v1.model.monitor_formula_and_function_event_query_definition import (
12+
MonitorFormulaAndFunctionEventQueryDefinition,
13+
)
14+
from datadog_api_client.v1.model.monitor_formula_and_function_event_query_definition_compute import (
15+
MonitorFormulaAndFunctionEventQueryDefinitionCompute,
16+
)
17+
from datadog_api_client.v1.model.monitor_formula_and_function_event_query_definition_search import (
18+
MonitorFormulaAndFunctionEventQueryDefinitionSearch,
19+
)
20+
from datadog_api_client.v1.model.monitor_formula_and_function_events_data_source import (
21+
MonitorFormulaAndFunctionEventsDataSource,
22+
)
23+
from datadog_api_client.v1.model.monitor_options import MonitorOptions
24+
from datadog_api_client.v1.model.monitor_thresholds import MonitorThresholds
25+
from datadog_api_client.v1.model.monitor_type import MonitorType
26+
27+
body = Monitor(
28+
name="Example-Create_a_ci_tests_formula_and_functions_monitor_returns_OK_response",
29+
type=MonitorType("ci-tests alert"),
30+
query='formula("query1 / query2 * 100").last("15m") >= 0.8',
31+
message="some message Notify: @hipchat-channel",
32+
tags=[
33+
"test:examplecreateacitestsformulaandfunctionsmonitorreturnsokresponse",
34+
"env:ci",
35+
],
36+
priority=3,
37+
options=MonitorOptions(
38+
thresholds=MonitorThresholds(
39+
critical=0.8,
40+
),
41+
variables=[
42+
MonitorFormulaAndFunctionEventQueryDefinition(
43+
data_source=MonitorFormulaAndFunctionEventsDataSource("ci_tests"),
44+
name="query1",
45+
search=MonitorFormulaAndFunctionEventQueryDefinitionSearch(
46+
query="@test.status:fail",
47+
),
48+
indexes=[
49+
"*",
50+
],
51+
compute=MonitorFormulaAndFunctionEventQueryDefinitionCompute(
52+
aggregation=MonitorFormulaAndFunctionEventAggregation("count"),
53+
),
54+
group_by=[],
55+
),
56+
MonitorFormulaAndFunctionEventQueryDefinition(
57+
data_source=MonitorFormulaAndFunctionEventsDataSource("ci_tests"),
58+
name="query2",
59+
search=MonitorFormulaAndFunctionEventQueryDefinitionSearch(
60+
query="",
61+
),
62+
indexes=[
63+
"*",
64+
],
65+
compute=MonitorFormulaAndFunctionEventQueryDefinitionCompute(
66+
aggregation=MonitorFormulaAndFunctionEventAggregation("count"),
67+
),
68+
group_by=[],
69+
),
70+
],
71+
),
72+
)
73+
74+
configuration = Configuration()
75+
with ApiClient(configuration) as api_client:
76+
api_instance = MonitorsApi(api_client)
77+
response = api_instance.create_monitor(body=body)
78+
79+
print(response)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
Create a ci-tests monitor returns "OK" response
3+
"""
4+
5+
from datadog_api_client.v1 import ApiClient, Configuration
6+
from datadog_api_client.v1.api.monitors_api import MonitorsApi
7+
from datadog_api_client.v1.model.monitor import Monitor
8+
from datadog_api_client.v1.model.monitor_options import MonitorOptions
9+
from datadog_api_client.v1.model.monitor_thresholds import MonitorThresholds
10+
from datadog_api_client.v1.model.monitor_type import MonitorType
11+
12+
body = Monitor(
13+
name="Example-Create_a_ci_tests_monitor_returns_OK_response",
14+
type=MonitorType("ci-tests alert"),
15+
query='ci-tests("type:test @git.branch:staging* @test.status:fail").rollup("count").by("@test.name").last("5m") >= 1',
16+
message="some message Notify: @hipchat-channel",
17+
tags=[
18+
"test:examplecreateacitestsmonitorreturnsokresponse",
19+
"env:ci",
20+
],
21+
priority=3,
22+
options=MonitorOptions(
23+
thresholds=MonitorThresholds(
24+
critical=1.0,
25+
),
26+
),
27+
)
28+
29+
configuration = Configuration()
30+
with ApiClient(configuration) as api_client:
31+
api_instance = MonitorsApi(api_client)
32+
response = api_instance.create_monitor(body=body)
33+
34+
print(response)

src/datadog_api_client/v1/api/monitors_api.py

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/datadog_api_client/v1/model/monitor_formula_and_function_events_data_source.py

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/datadog_api_client/v1/model/monitor_type.py

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2022-05-13T10:40:35.052Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
interactions:
2+
- request:
3+
body: '{"message":"some message Notify: @hipchat-channel","name":"Test-Create_a_ci_tests_formula_and_functions_monitor_returns_OK_response-1652438435","options":{"thresholds":{"critical":0.8},"variables":[{"compute":{"aggregation":"count"},"data_source":"ci_tests","group_by":[],"indexes":["*"],"name":"query1","search":{"query":"@test.status:fail"}},{"compute":{"aggregation":"count"},"data_source":"ci_tests","group_by":[],"indexes":["*"],"name":"query2","search":{"query":""}}]},"priority":3,"query":"formula(\"query1
4+
/ query2 * 100\").last(\"15m\") >= 0.8","tags":["test:testcreateacitestsformulaandfunctionsmonitorreturnsokresponse1652438435","env:ci"],"type":"ci-tests
5+
alert"}'
6+
headers:
7+
accept:
8+
- application/json
9+
content-type:
10+
- application/json
11+
method: POST
12+
uri: https://api.datadoghq.com/api/v1/monitor
13+
response:
14+
body:
15+
string: '{"restricted_roles":null,"tags":["test:testcreateacitestsformulaandfunctionsmonitorreturnsokresponse1652438435","env:ci"],"deleted":null,"query":"formula(\"query1
16+
/ query2 * 100\").last(\"15m\") >= 0.8","message":"some message Notify: @hipchat-channel","id":71427772,"multi":false,"name":"Test-Create_a_ci_tests_formula_and_functions_monitor_returns_OK_response-1652438435","created":"2022-05-13T10:40:35.341131+00:00","created_at":1652438435000,"creator":{"id":1445416,"handle":"[email protected]","name":null,"email":"[email protected]"},"org_id":321813,"modified":"2022-05-13T10:40:35.341131+00:00","priority":3,"overall_state_modified":null,"overall_state":"No
17+
Data","type":"ci-tests alert","options":{"notify_audit":false,"silenced":{},"include_tags":true,"thresholds":{"critical":0.8},"new_host_delay":300,"notify_no_data":false,"groupby_simple_monitor":false,"variables":[{"search":{"query":"@test.status:fail"},"data_source":"ci_tests","compute":{"aggregation":"count"},"name":"query1","indexes":["*"],"group_by":[]},{"search":{"query":""},"data_source":"ci_tests","compute":{"aggregation":"count"},"name":"query2","indexes":["*"],"group_by":[]}]}}'
18+
headers:
19+
content-type:
20+
- application/json
21+
status:
22+
code: 200
23+
message: OK
24+
- request:
25+
body: null
26+
headers:
27+
accept:
28+
- application/json
29+
method: DELETE
30+
uri: https://api.datadoghq.com/api/v1/monitor/71427772
31+
response:
32+
body:
33+
string: '{"deleted_monitor_id":71427772}'
34+
headers:
35+
content-type:
36+
- application/json
37+
status:
38+
code: 200
39+
message: OK
40+
version: 1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2022-05-17T15:10:28.775Z

0 commit comments

Comments
 (0)