Skip to content

Commit 8b31a4a

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 4e5eacb of spec repo
1 parent cefb669 commit 8b31a4a

16 files changed

Lines changed: 1068 additions & 0 deletions

‎.generator/schemas/v1/openapi.yaml‎

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8997,6 +8997,61 @@ components:
89978997
type: string
89988998
x-enum-varnames:
89998999
- DATA_QUALITY_METRICS
9000+
MonitorFormulaAndFunctionDataQualityDiffFunction:
9001+
description: |-
9002+
Function applied to the measure before it is compared against the predicted bounds.
9003+
enum:
9004+
- DIFF
9005+
- DIFF_PERCENT
9006+
example: "DIFF"
9007+
type: string
9008+
x-enum-varnames:
9009+
- DIFF
9010+
- DIFF_PERCENT
9011+
MonitorFormulaAndFunctionDataQualityDiffType:
9012+
description: |-
9013+
How the difference between the source and target measures is computed.
9014+
`absolute` subtracts the two values, `diff_percent` expresses the difference
9015+
as a percentage of the source value.
9016+
enum:
9017+
- absolute
9018+
- diff_percent
9019+
example: "absolute"
9020+
type: string
9021+
x-enum-varnames:
9022+
- ABSOLUTE
9023+
- DIFF_PERCENT
9024+
MonitorFormulaAndFunctionDataQualityEntityMetricConfig:
9025+
description: |-
9026+
Measure configuration for one side of a source to target comparison.
9027+
properties:
9028+
custom_sql:
9029+
description: Custom SQL query used to compute the measure for this entity.
9030+
example: "SELECT COUNT(*) FROM users AS dd_value"
9031+
type: string
9032+
custom_where:
9033+
description: Custom WHERE clause applied when computing the measure for this entity.
9034+
example: "USER_ID = 123"
9035+
type: string
9036+
entity_id:
9037+
description: Identifier of the data entity to measure.
9038+
example: "01234567-89ab-cdef-0123-456789abcdef"
9039+
type: string
9040+
entity_type:
9041+
description: Type of the data entity to measure.
9042+
example: "table"
9043+
type: string
9044+
group_by_columns:
9045+
description: Columns to group results by when computing the measure for this entity.
9046+
example: ["col1", "col2"]
9047+
items:
9048+
description: A column name to group results by.
9049+
type: string
9050+
type: array
9051+
required:
9052+
- entity_id
9053+
- entity_type
9054+
type: object
90009055
MonitorFormulaAndFunctionDataQualityMeasure:
90019056
description: |-
90029057
The data quality measure to query. Common values include:
@@ -9005,6 +9060,58 @@ components:
90059060
`sum`, `uniqueness`. Additional values may be supported.
90069061
example: "row_count"
90079062
type: string
9063+
MonitorFormulaAndFunctionDataQualityModelBoundsOverride:
9064+
description: |-
9065+
Restricts which predicted bound the monitor alerts on. `UPPER_ONLY` alerts only when
9066+
the measure rises above the upper bound, `LOWER_ONLY` only when it falls below the
9067+
lower bound. When unset, the monitor alerts on both.
9068+
enum:
9069+
- UPPER_ONLY
9070+
- LOWER_ONLY
9071+
example: "UPPER_ONLY"
9072+
type: string
9073+
x-enum-varnames:
9074+
- UPPER_ONLY
9075+
- LOWER_ONLY
9076+
MonitorFormulaAndFunctionDataQualityModelConfiguration:
9077+
description: |-
9078+
Tuning options for the anomaly detection model used by the monitor.
9079+
properties:
9080+
auto_resolve_days:
9081+
description: |-
9082+
Number of days after which an open alert is automatically resolved.
9083+
When unset, alerts stay open until the measure returns within bounds.
9084+
example: 7
9085+
format: int32
9086+
maximum: 365
9087+
type: integer
9088+
enable_flatline_detection:
9089+
description: |-
9090+
Whether to alert when the measure stops changing entirely.
9091+
Defaults to `true`.
9092+
example: true
9093+
type: boolean
9094+
function:
9095+
$ref: "#/components/schemas/MonitorFormulaAndFunctionDataQualityDiffFunction"
9096+
min_lower_bound_size:
9097+
description: |-
9098+
Minimum distance between the predicted value and the lower bound. Widening the
9099+
lower bound to at least this size suppresses alerts on small downward deviations.
9100+
When unset, no minimum is enforced.
9101+
example: 10.0
9102+
format: double
9103+
type: number
9104+
min_upper_bound_size:
9105+
description: |-
9106+
Minimum distance between the predicted value and the upper bound. Widening the
9107+
upper bound to at least this size suppresses alerts on small upward deviations.
9108+
When unset, no minimum is enforced.
9109+
example: 10.0
9110+
format: double
9111+
type: number
9112+
model_bounds_override:
9113+
$ref: "#/components/schemas/MonitorFormulaAndFunctionDataQualityModelBoundsOverride"
9114+
type: object
90089115
MonitorFormulaAndFunctionDataQualityModelTypeOverride:
90099116
description: Override for the model type used in anomaly detection.
90109117
enum:
@@ -9038,6 +9145,8 @@ components:
90389145
description: A column name to group results by.
90399146
type: string
90409147
type: array
9148+
model_configuration:
9149+
$ref: "#/components/schemas/MonitorFormulaAndFunctionDataQualityModelConfiguration"
90419150
model_type_override:
90429151
$ref: "#/components/schemas/MonitorFormulaAndFunctionDataQualityModelTypeOverride"
90439152
sensitivity:
@@ -9048,6 +9157,8 @@ components:
90489157
example: 3.0
90499158
format: double
90509159
type: number
9160+
source_to_target_config:
9161+
$ref: "#/components/schemas/MonitorFormulaAndFunctionDataQualitySourceToTargetConfig"
90519162
type: object
90529163
MonitorFormulaAndFunctionDataQualityQueryDefinition:
90539164
description: A formula and functions data quality query.
@@ -9090,6 +9201,27 @@ components:
90909201
- measure
90919202
- filter
90929203
type: object
9204+
MonitorFormulaAndFunctionDataQualitySourceToTargetConfig:
9205+
description: |-
9206+
Configuration for a source to target monitor, which compares the same measure
9207+
across two data entities and alerts on the difference between them.
9208+
properties:
9209+
diff_type:
9210+
$ref: "#/components/schemas/MonitorFormulaAndFunctionDataQualityDiffType"
9211+
entity_type:
9212+
description: Type of the data entities being compared.
9213+
example: "table"
9214+
type: string
9215+
source:
9216+
$ref: "#/components/schemas/MonitorFormulaAndFunctionDataQualityEntityMetricConfig"
9217+
target:
9218+
$ref: "#/components/schemas/MonitorFormulaAndFunctionDataQualityEntityMetricConfig"
9219+
required:
9220+
- source
9221+
- target
9222+
- diff_type
9223+
- entity_type
9224+
type: object
90939225
MonitorFormulaAndFunctionEventAggregation:
90949226
description: Aggregation methods for event platform queries.
90959227
enum:
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
"""
2+
Create a Data Quality monitor with a model configuration 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_quality_data_source import (
9+
MonitorFormulaAndFunctionDataQualityDataSource,
10+
)
11+
from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_diff_function import (
12+
MonitorFormulaAndFunctionDataQualityDiffFunction,
13+
)
14+
from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_model_bounds_override import (
15+
MonitorFormulaAndFunctionDataQualityModelBoundsOverride,
16+
)
17+
from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_model_configuration import (
18+
MonitorFormulaAndFunctionDataQualityModelConfiguration,
19+
)
20+
from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_monitor_options import (
21+
MonitorFormulaAndFunctionDataQualityMonitorOptions,
22+
)
23+
from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_query_definition import (
24+
MonitorFormulaAndFunctionDataQualityQueryDefinition,
25+
)
26+
from datadog_api_client.v1.model.monitor_options import MonitorOptions
27+
from datadog_api_client.v1.model.monitor_thresholds import MonitorThresholds
28+
from datadog_api_client.v1.model.monitor_type import MonitorType
29+
30+
body = Monitor(
31+
name="Example-Monitor",
32+
type=MonitorType.DATA_QUALITY_ALERT,
33+
query='formula("query1").last("5m") > 100',
34+
message="Data quality alert triggered",
35+
tags=[
36+
"test:examplemonitor",
37+
"env:ci",
38+
],
39+
priority=3,
40+
options=MonitorOptions(
41+
thresholds=MonitorThresholds(
42+
critical=100.0,
43+
),
44+
variables=[
45+
MonitorFormulaAndFunctionDataQualityQueryDefinition(
46+
name="query1",
47+
data_source=MonitorFormulaAndFunctionDataQualityDataSource.DATA_QUALITY_METRICS,
48+
measure="row_count",
49+
filter="search for column where `database:production AND table:users`",
50+
group_by=[
51+
"entity_id",
52+
],
53+
monitor_options=MonitorFormulaAndFunctionDataQualityMonitorOptions(
54+
model_configuration=MonitorFormulaAndFunctionDataQualityModelConfiguration(
55+
auto_resolve_days=7,
56+
enable_flatline_detection=True,
57+
function=MonitorFormulaAndFunctionDataQualityDiffFunction.DIFF,
58+
min_lower_bound_size=10.0,
59+
min_upper_bound_size=10.0,
60+
model_bounds_override=MonitorFormulaAndFunctionDataQualityModelBoundsOverride.UPPER_ONLY,
61+
),
62+
),
63+
),
64+
],
65+
),
66+
)
67+
68+
configuration = Configuration()
69+
with ApiClient(configuration) as api_client:
70+
api_instance = MonitorsApi(api_client)
71+
response = api_instance.create_monitor(body=body)
72+
73+
print(response)
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
"""
2+
Create a Data Quality monitor with a source to target configuration 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_quality_data_source import (
9+
MonitorFormulaAndFunctionDataQualityDataSource,
10+
)
11+
from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_diff_type import (
12+
MonitorFormulaAndFunctionDataQualityDiffType,
13+
)
14+
from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_entity_metric_config import (
15+
MonitorFormulaAndFunctionDataQualityEntityMetricConfig,
16+
)
17+
from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_monitor_options import (
18+
MonitorFormulaAndFunctionDataQualityMonitorOptions,
19+
)
20+
from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_query_definition import (
21+
MonitorFormulaAndFunctionDataQualityQueryDefinition,
22+
)
23+
from datadog_api_client.v1.model.monitor_formula_and_function_data_quality_source_to_target_config import (
24+
MonitorFormulaAndFunctionDataQualitySourceToTargetConfig,
25+
)
26+
from datadog_api_client.v1.model.monitor_options import MonitorOptions
27+
from datadog_api_client.v1.model.monitor_thresholds import MonitorThresholds
28+
from datadog_api_client.v1.model.monitor_type import MonitorType
29+
30+
body = Monitor(
31+
name="Example-Monitor",
32+
type=MonitorType.DATA_QUALITY_ALERT,
33+
query='formula("query1").last("5m") > 100',
34+
message="Data quality alert triggered",
35+
tags=[
36+
"test:examplemonitor",
37+
"env:ci",
38+
],
39+
priority=3,
40+
options=MonitorOptions(
41+
thresholds=MonitorThresholds(
42+
critical=100.0,
43+
),
44+
variables=[
45+
MonitorFormulaAndFunctionDataQualityQueryDefinition(
46+
name="query1",
47+
data_source=MonitorFormulaAndFunctionDataQualityDataSource.DATA_QUALITY_METRICS,
48+
measure="row_count",
49+
filter="search for column where `database:production AND table:users`",
50+
group_by=[
51+
"entity_id",
52+
],
53+
monitor_options=MonitorFormulaAndFunctionDataQualityMonitorOptions(
54+
source_to_target_config=MonitorFormulaAndFunctionDataQualitySourceToTargetConfig(
55+
source=MonitorFormulaAndFunctionDataQualityEntityMetricConfig(
56+
entity_id="source-entity-id",
57+
entity_type="table",
58+
),
59+
target=MonitorFormulaAndFunctionDataQualityEntityMetricConfig(
60+
entity_id="target-entity-id",
61+
entity_type="table",
62+
),
63+
diff_type=MonitorFormulaAndFunctionDataQualityDiffType.ABSOLUTE,
64+
entity_type="table",
65+
),
66+
),
67+
),
68+
],
69+
),
70+
)
71+
72+
configuration = Configuration()
73+
with ApiClient(configuration) as api_client:
74+
api_instance = MonitorsApi(api_client)
75+
response = api_instance.create_monitor(body=body)
76+
77+
print(response)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
ModelSimple,
9+
cached_property,
10+
)
11+
12+
from typing import ClassVar
13+
14+
15+
class MonitorFormulaAndFunctionDataQualityDiffFunction(ModelSimple):
16+
"""
17+
Function applied to the measure before it is compared against the predicted bounds.
18+
19+
:param value: Must be one of ["DIFF", "DIFF_PERCENT"].
20+
:type value: str
21+
"""
22+
23+
allowed_values = {
24+
"DIFF",
25+
"DIFF_PERCENT",
26+
}
27+
DIFF: ClassVar["MonitorFormulaAndFunctionDataQualityDiffFunction"]
28+
DIFF_PERCENT: ClassVar["MonitorFormulaAndFunctionDataQualityDiffFunction"]
29+
30+
@cached_property
31+
def openapi_types(_):
32+
return {
33+
"value": (str,),
34+
}
35+
36+
37+
MonitorFormulaAndFunctionDataQualityDiffFunction.DIFF = MonitorFormulaAndFunctionDataQualityDiffFunction("DIFF")
38+
MonitorFormulaAndFunctionDataQualityDiffFunction.DIFF_PERCENT = MonitorFormulaAndFunctionDataQualityDiffFunction(
39+
"DIFF_PERCENT"
40+
)

0 commit comments

Comments
 (0)