Skip to content

Commit 3e56593

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit e5b82e2 of spec repo
1 parent fd58c5a commit 3e56593

9 files changed

Lines changed: 175 additions & 1 deletion

File tree

.generator/schemas/v1/openapi.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8067,6 +8067,36 @@ components:
80678067
- data_source
80688068
- query
80698069
type: object
8070+
MonitorFormulaAndFunctionDataJobsQueryDefinition:
8071+
description: A formula and functions data jobs query.
8072+
properties:
8073+
job_type:
8074+
description: |-
8075+
The type of job being monitored. Known values include:
8076+
`databricks.job`, `spark.application`, `airflow.dag`,
8077+
`dbt.job`, `dbt.model`, `dbt.test`, `glue.job`.
8078+
Custom job types are supported with the `custom.ol.` prefix.
8079+
example: "databricks.job"
8080+
type: string
8081+
jobs_query:
8082+
description: Filter expression used to select the jobs to monitor.
8083+
example: "job_name:smoke*"
8084+
type: string
8085+
name:
8086+
description: Name of the query for use in formulas. Must be `run_query`.
8087+
example: "run_query"
8088+
type: string
8089+
query_dialect:
8090+
description: |-
8091+
Query dialect for data jobs queries. Currently only `metric` is supported.
8092+
example: "metric"
8093+
type: string
8094+
required:
8095+
- name
8096+
- jobs_query
8097+
- job_type
8098+
- query_dialect
8099+
type: object
80708100
MonitorFormulaAndFunctionDataQualityDataSource:
80718101
description: Data source for data quality queries.
80728102
enum:
@@ -8373,6 +8403,7 @@ components:
83738403
- $ref: "#/components/schemas/MonitorFormulaAndFunctionEventQueryDefinition"
83748404
- $ref: "#/components/schemas/MonitorFormulaAndFunctionCostQueryDefinition"
83758405
- $ref: "#/components/schemas/MonitorFormulaAndFunctionDataQualityQueryDefinition"
8406+
- $ref: "#/components/schemas/MonitorFormulaAndFunctionDataJobsQueryDefinition"
83768407
- $ref: "#/components/schemas/MonitorFormulaAndFunctionAggregateAugmentedQueryDefinition"
83778408
- $ref: "#/components/schemas/MonitorFormulaAndFunctionAggregateFilteredQueryDefinition"
83788409
MonitorFormulaAndFunctionReferenceTableColumn:
@@ -9205,6 +9236,7 @@ components:
92059236
- "cost alert"
92069237
- "data-quality alert"
92079238
- "network-path alert"
9239+
- "data-jobs alert"
92089240
example: "query alert"
92099241
type: string
92109242
x-enum-varnames:
@@ -9229,6 +9261,7 @@ components:
92299261
- COST_ALERT
92309262
- DATA_QUALITY_ALERT
92319263
- NETWORK_PATH_ALERT
9264+
- DATA_JOBS_ALERT
92329265
MonitorUpdateRequest:
92339266
description: Object describing a monitor update request.
92349267
properties:

docs/datadog_api_client.v1.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2608,6 +2608,13 @@ datadog\_api\_client.v1.model.monitor\_formula\_and\_function\_cost\_query\_defi
26082608
:members:
26092609
:show-inheritance:
26102610

2611+
datadog\_api\_client.v1.model.monitor\_formula\_and\_function\_data\_jobs\_query\_definition module
2612+
---------------------------------------------------------------------------------------------------
2613+
2614+
.. automodule:: datadog_api_client.v1.model.monitor_formula_and_function_data_jobs_query_definition
2615+
:members:
2616+
:show-inheritance:
2617+
26112618
datadog\_api\_client.v1.model.monitor\_formula\_and\_function\_data\_quality\_data\_source module
26122619
-------------------------------------------------------------------------------------------------
26132620

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"""
2+
Create a Data Jobs monitor returns "OK" response
3+
"""
4+
5+
from datadog_api_client 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_data_jobs_query_definition import (
9+
MonitorFormulaAndFunctionDataJobsQueryDefinition,
10+
)
11+
from datadog_api_client.v1.model.monitor_options import MonitorOptions
12+
from datadog_api_client.v1.model.monitor_thresholds import MonitorThresholds
13+
from datadog_api_client.v1.model.monitor_type import MonitorType
14+
15+
body = Monitor(
16+
name="Example-Monitor",
17+
type=MonitorType.DATA_JOBS_ALERT,
18+
query='formula("failed_runs(run_query)").by(job_name).last(10d) > 0',
19+
message="Data jobs alert triggered",
20+
tags=[
21+
"test:examplemonitor",
22+
"env:ci",
23+
],
24+
options=MonitorOptions(
25+
thresholds=MonitorThresholds(
26+
critical=0.0,
27+
),
28+
variables=[
29+
MonitorFormulaAndFunctionDataJobsQueryDefinition(
30+
name="run_query",
31+
jobs_query="job_name:smoke*",
32+
job_type="databricks.job",
33+
query_dialect="metric",
34+
),
35+
],
36+
),
37+
)
38+
39+
configuration = Configuration()
40+
with ApiClient(configuration) as api_client:
41+
api_instance = MonitorsApi(api_client)
42+
response = api_instance.create_monitor(body=body)
43+
44+
print(response)
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
7+
from datadog_api_client.model_utils import (
8+
ModelNormal,
9+
cached_property,
10+
)
11+
12+
13+
class MonitorFormulaAndFunctionDataJobsQueryDefinition(ModelNormal):
14+
@cached_property
15+
def openapi_types(_):
16+
return {
17+
"job_type": (str,),
18+
"jobs_query": (str,),
19+
"name": (str,),
20+
"query_dialect": (str,),
21+
}
22+
23+
attribute_map = {
24+
"job_type": "job_type",
25+
"jobs_query": "jobs_query",
26+
"name": "name",
27+
"query_dialect": "query_dialect",
28+
}
29+
30+
def __init__(self_, job_type: str, jobs_query: str, name: str, query_dialect: str, **kwargs):
31+
"""
32+
A formula and functions data jobs query.
33+
34+
:param job_type: The type of job being monitored. Known values include:
35+
``databricks.job`` , ``spark.application`` , ``airflow.dag`` ,
36+
``dbt.job`` , ``dbt.model`` , ``dbt.test`` , ``glue.job``.
37+
Custom job types are supported with the ``custom.ol.`` prefix.
38+
:type job_type: str
39+
40+
:param jobs_query: Filter expression used to select the jobs to monitor.
41+
:type jobs_query: str
42+
43+
:param name: Name of the query for use in formulas. Must be ``run_query``.
44+
:type name: str
45+
46+
:param query_dialect: Query dialect for data jobs queries. Currently only ``metric`` is supported.
47+
:type query_dialect: str
48+
"""
49+
super().__init__(kwargs)
50+
51+
self_.job_type = job_type
52+
self_.jobs_query = jobs_query
53+
self_.name = name
54+
self_.query_dialect = query_dialect

src/datadog_api_client/v1/model/monitor_formula_and_function_query_definition.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ def __init__(self, **kwargs):
5858
This is useful when an entity has been configured to emit metrics with additional tags.
5959
:type scope: str, optional
6060
61+
:param job_type: The type of job being monitored. Known values include:
62+
`databricks.job`, `spark.application`, `airflow.dag`,
63+
`dbt.job`, `dbt.model`, `dbt.test`, `glue.job`.
64+
Custom job types are supported with the `custom.ol.` prefix.
65+
:type job_type: str
66+
67+
:param jobs_query: Filter expression used to select the jobs to monitor.
68+
:type jobs_query: str
69+
70+
:param query_dialect: Query dialect for data jobs queries. Currently only `metric` is supported.
71+
:type query_dialect: str
72+
6173
:param augment_query: Augment query for aggregate augmented queries. Can be an events query or a reference table query.
6274
:type augment_query: MonitorFormulaAndFunctionAggregateAugmentQuery
6375
@@ -93,6 +105,9 @@ def _composed_schemas(_):
93105
from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_query_definition import (
94106
MonitorFormulaAndFunctionDataQualityQueryDefinition,
95107
)
108+
from datadog_api_client.v1.model.monitor_formula_and_function_data_jobs_query_definition import (
109+
MonitorFormulaAndFunctionDataJobsQueryDefinition,
110+
)
96111
from datadog_api_client.v1.model.monitor_formula_and_function_aggregate_augmented_query_definition import (
97112
MonitorFormulaAndFunctionAggregateAugmentedQueryDefinition,
98113
)
@@ -105,6 +120,7 @@ def _composed_schemas(_):
105120
MonitorFormulaAndFunctionEventQueryDefinition,
106121
MonitorFormulaAndFunctionCostQueryDefinition,
107122
MonitorFormulaAndFunctionDataQualityQueryDefinition,
123+
MonitorFormulaAndFunctionDataJobsQueryDefinition,
108124
MonitorFormulaAndFunctionAggregateAugmentedQueryDefinition,
109125
MonitorFormulaAndFunctionAggregateFilteredQueryDefinition,
110126
],

src/datadog_api_client/v1/model/monitor_options.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_query_definition import (
3636
MonitorFormulaAndFunctionDataQualityQueryDefinition,
3737
)
38+
from datadog_api_client.v1.model.monitor_formula_and_function_data_jobs_query_definition import (
39+
MonitorFormulaAndFunctionDataJobsQueryDefinition,
40+
)
3841
from datadog_api_client.v1.model.monitor_formula_and_function_aggregate_augmented_query_definition import (
3942
MonitorFormulaAndFunctionAggregateAugmentedQueryDefinition,
4043
)
@@ -183,6 +186,7 @@ def __init__(
183186
MonitorFormulaAndFunctionEventQueryDefinition,
184187
MonitorFormulaAndFunctionCostQueryDefinition,
185188
MonitorFormulaAndFunctionDataQualityQueryDefinition,
189+
MonitorFormulaAndFunctionDataJobsQueryDefinition,
186190
MonitorFormulaAndFunctionAggregateAugmentedQueryDefinition,
187191
MonitorFormulaAndFunctionAggregateFilteredQueryDefinition,
188192
]

src/datadog_api_client/v1/model/monitor_type.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class MonitorType(ModelSimple):
1616
"""
1717
The type of the monitor. For more information about `type`, see the [monitor options](https://docs.datadoghq.com/monitors/guide/monitor_api_options/) docs.
1818
19-
:param value: Must be one of ["composite", "event alert", "log alert", "metric alert", "process alert", "query alert", "rum alert", "service check", "synthetics alert", "trace-analytics alert", "slo alert", "event-v2 alert", "audit alert", "ci-pipelines alert", "ci-tests alert", "error-tracking alert", "database-monitoring alert", "network-performance alert", "cost alert", "data-quality alert", "network-path alert"].
19+
:param value: Must be one of ["composite", "event alert", "log alert", "metric alert", "process alert", "query alert", "rum alert", "service check", "synthetics alert", "trace-analytics alert", "slo alert", "event-v2 alert", "audit alert", "ci-pipelines alert", "ci-tests alert", "error-tracking alert", "database-monitoring alert", "network-performance alert", "cost alert", "data-quality alert", "network-path alert", "data-jobs alert"].
2020
:type value: str
2121
"""
2222

@@ -42,6 +42,7 @@ class MonitorType(ModelSimple):
4242
"cost alert",
4343
"data-quality alert",
4444
"network-path alert",
45+
"data-jobs alert",
4546
}
4647
COMPOSITE: ClassVar["MonitorType"]
4748
EVENT_ALERT: ClassVar["MonitorType"]
@@ -64,6 +65,7 @@ class MonitorType(ModelSimple):
6465
COST_ALERT: ClassVar["MonitorType"]
6566
DATA_QUALITY_ALERT: ClassVar["MonitorType"]
6667
NETWORK_PATH_ALERT: ClassVar["MonitorType"]
68+
DATA_JOBS_ALERT: ClassVar["MonitorType"]
6769

6870
@cached_property
6971
def openapi_types(_):
@@ -93,3 +95,4 @@ def openapi_types(_):
9395
MonitorType.COST_ALERT = MonitorType("cost alert")
9496
MonitorType.DATA_QUALITY_ALERT = MonitorType("data-quality alert")
9597
MonitorType.NETWORK_PATH_ALERT = MonitorType("network-path alert")
98+
MonitorType.DATA_JOBS_ALERT = MonitorType("data-jobs alert")

src/datadog_api_client/v1/models/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,9 @@
450450
from datadog_api_client.v1.model.monitor_formula_and_function_cost_query_definition import (
451451
MonitorFormulaAndFunctionCostQueryDefinition,
452452
)
453+
from datadog_api_client.v1.model.monitor_formula_and_function_data_jobs_query_definition import (
454+
MonitorFormulaAndFunctionDataJobsQueryDefinition,
455+
)
453456
from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_data_source import (
454457
MonitorFormulaAndFunctionDataQualityDataSource,
455458
)
@@ -1718,6 +1721,7 @@
17181721
"MonitorFormulaAndFunctionCostAggregator",
17191722
"MonitorFormulaAndFunctionCostDataSource",
17201723
"MonitorFormulaAndFunctionCostQueryDefinition",
1724+
"MonitorFormulaAndFunctionDataJobsQueryDefinition",
17211725
"MonitorFormulaAndFunctionDataQualityDataSource",
17221726
"MonitorFormulaAndFunctionDataQualityModelTypeOverride",
17231727
"MonitorFormulaAndFunctionDataQualityMonitorOptions",

tests/v1/features/monitors.feature

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ Feature: Monitors
4242
When the request is sent
4343
Then the response status is 200 OK
4444

45+
@team:DataDog/monitor-app
46+
Scenario: Create a Data Jobs monitor returns "OK" response
47+
Given new "CreateMonitor" request
48+
And body with value {"name": "{{ unique }}", "type": "data-jobs alert", "query": "formula(\"failed_runs(run_query)\").by(job_name).last(10d) > 0", "message": "Data jobs alert triggered", "tags": ["test:{{ unique_lower_alnum }}", "env:ci"], "options": {"thresholds": {"critical": 0}, "variables": [{"name": "run_query", "jobs_query": "job_name:smoke*", "job_type": "databricks.job", "query_dialect": "metric"}]}}
49+
When the request is sent
50+
Then the response status is 200 OK
51+
And the response "name" is equal to "{{ unique }}"
52+
And the response "type" is equal to "data-jobs alert"
53+
4554
@team:DataDog/monitor-app
4655
Scenario: Create a Data Quality monitor returns "OK" response
4756
Given new "CreateMonitor" request

0 commit comments

Comments
 (0)