Skip to content

Commit e58c7a5

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
feat - Add data-quality alert monitor type support (#3265)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 8dae715 commit e58c7a5

12 files changed

Lines changed: 454 additions & 0 deletions

File tree

.generator/schemas/v1/openapi.yaml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7534,6 +7534,104 @@ components:
75347534
- data_source
75357535
- query
75367536
type: object
7537+
MonitorFormulaAndFunctionDataQualityDataSource:
7538+
description: Data source for data quality queries.
7539+
enum:
7540+
- data_quality_metrics
7541+
example: data_quality_metrics
7542+
type: string
7543+
x-enum-varnames:
7544+
- DATA_QUALITY_METRICS
7545+
MonitorFormulaAndFunctionDataQualityMeasure:
7546+
description: 'The data quality measure to query. Common values include:
7547+
7548+
`bytes`, `cardinality`, `custom`, `freshness`, `max`, `mean`, `min`,
7549+
7550+
`nullness`, `percent_negative`, `percent_zero`, `row_count`, `stddev`,
7551+
7552+
`sum`, `uniqueness`. Additional values may be supported.'
7553+
example: row_count
7554+
type: string
7555+
MonitorFormulaAndFunctionDataQualityModelTypeOverride:
7556+
description: Override for the model type used in anomaly detection.
7557+
enum:
7558+
- freshness
7559+
- percentage
7560+
- any
7561+
type: string
7562+
x-enum-varnames:
7563+
- FRESHNESS
7564+
- PERCENTAGE
7565+
- ANY
7566+
MonitorFormulaAndFunctionDataQualityMonitorOptions:
7567+
description: Monitor configuration options for data quality queries.
7568+
properties:
7569+
crontab_override:
7570+
description: Crontab expression to override the default schedule.
7571+
example: '* * * 10'
7572+
type: string
7573+
custom_sql:
7574+
description: Custom SQL query for the monitor.
7575+
example: SELECT COUNT(*) FROM users AS dd_value
7576+
type: string
7577+
custom_where:
7578+
description: Custom WHERE clause for the query.
7579+
example: USER_ID = 123
7580+
type: string
7581+
group_by_columns:
7582+
description: Columns to group results by.
7583+
example:
7584+
- col1
7585+
- col2
7586+
items:
7587+
type: string
7588+
type: array
7589+
model_type_override:
7590+
$ref: '#/components/schemas/MonitorFormulaAndFunctionDataQualityModelTypeOverride'
7591+
type: object
7592+
MonitorFormulaAndFunctionDataQualityQueryDefinition:
7593+
description: A formula and functions data quality query.
7594+
properties:
7595+
data_source:
7596+
$ref: '#/components/schemas/MonitorFormulaAndFunctionDataQualityDataSource'
7597+
filter:
7598+
description: Filter expression used to match on data entities. Uses Aastra
7599+
query syntax.
7600+
example: search for column where `database:production AND table:users`
7601+
type: string
7602+
group_by:
7603+
description: Optional grouping fields for aggregation.
7604+
example:
7605+
- entity_id
7606+
items:
7607+
type: string
7608+
type: array
7609+
measure:
7610+
$ref: '#/components/schemas/MonitorFormulaAndFunctionDataQualityMeasure'
7611+
monitor_options:
7612+
$ref: '#/components/schemas/MonitorFormulaAndFunctionDataQualityMonitorOptions'
7613+
name:
7614+
description: Name of the query for use in formulas.
7615+
example: query1
7616+
type: string
7617+
schema_version:
7618+
description: Schema version for the data quality query.
7619+
example: 0.0.1
7620+
type: string
7621+
scope:
7622+
description: 'Optional scoping expression to further filter metrics. Uses
7623+
metrics filter syntax.
7624+
7625+
This is useful when an entity has been configured to emit metrics with
7626+
additional tags.'
7627+
example: env:production
7628+
type: string
7629+
required:
7630+
- name
7631+
- data_source
7632+
- measure
7633+
- filter
7634+
type: object
75377635
MonitorFormulaAndFunctionEventAggregation:
75387636
description: Aggregation methods for event platform queries.
75397637
enum:
@@ -7685,6 +7783,7 @@ components:
76857783
oneOf:
76867784
- $ref: '#/components/schemas/MonitorFormulaAndFunctionEventQueryDefinition'
76877785
- $ref: '#/components/schemas/MonitorFormulaAndFunctionCostQueryDefinition'
7786+
- $ref: '#/components/schemas/MonitorFormulaAndFunctionDataQualityQueryDefinition'
76887787
MonitorGroupSearchResponse:
76897788
description: The response of a monitor group search.
76907789
example:
@@ -8523,6 +8622,7 @@ components:
85238622
- database-monitoring alert
85248623
- network-performance alert
85258624
- cost alert
8625+
- data-quality alert
85268626
example: query alert
85278627
type: string
85288628
x-enum-varnames:
@@ -8545,6 +8645,7 @@ components:
85458645
- DATABASE_MONITORING_ALERT
85468646
- NETWORK_PERFORMANCE_ALERT
85478647
- COST_ALERT
8648+
- DATA_QUALITY_ALERT
85488649
MonitorUpdateRequest:
85498650
description: Object describing a monitor update request.
85508651
properties:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2026-01-12T17:23:49.629Z"
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"log": {
3+
"_recordingName": "Monitors/Create a Data Quality monitor returns \"OK\" response",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "09dbbe87ffa480b059d2f4f4bb6a2d62",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 520,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "content-type",
26+
"value": "application/json"
27+
}
28+
],
29+
"headersSize": 555,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"message\":\"Data quality alert triggered\",\"name\":\"Test-Create_a_Data_Quality_monitor_returns_OK_response-1768238629\",\"options\":{\"thresholds\":{\"critical\":100},\"variables\":[{\"data_source\":\"data_quality_metrics\",\"filter\":\"search for column where `database:production AND table:users`\",\"group_by\":[\"entity_id\"],\"measure\":\"row_count\",\"name\":\"query1\"}]},\"priority\":3,\"query\":\"formula(\\\"query1\\\").last(\\\"5m\\\") > 100\",\"tags\":[\"test:testcreateadataqualitymonitorreturnsokresponse1768238629\",\"env:ci\"],\"type\":\"data-quality alert\"}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v1/monitor"
39+
},
40+
"response": {
41+
"bodySize": 1088,
42+
"content": {
43+
"mimeType": "application/json",
44+
"size": 1088,
45+
"text": "{\"id\":250323411,\"org_id\":321813,\"type\":\"data-quality alert\",\"name\":\"Test-Create_a_Data_Quality_monitor_returns_OK_response-1768238629\",\"message\":\"Data quality alert triggered\",\"tags\":[\"test:testcreateadataqualitymonitorreturnsokresponse1768238629\",\"env:ci\"],\"query\":\"formula(\\\"query1\\\").last(\\\"5m\\\") > 100\",\"options\":{\"thresholds\":{\"critical\":100.0},\"variables\":[{\"data_source\":\"data_quality_metrics\",\"filter\":\"search for column where `database:production AND table:users`\",\"group_by\":[\"entity_id\"],\"measure\":\"row_count\",\"name\":\"query1\"}],\"notify_no_data\":false,\"notify_audit\":false,\"new_host_delay\":300,\"include_tags\":true,\"silenced\":{}},\"multi\":false,\"created_at\":1768238629000,\"created\":\"2026-01-12T17:23:49.782143+00:00\",\"modified\":\"2026-01-12T17:23:49.782143+00:00\",\"deleted\":null,\"priority\":3,\"restricted_roles\":null,\"restriction_policy\":null,\"draft_status\":\"published\",\"assets\":[],\"overall_state_modified\":null,\"overall_state\":\"No Data\",\"creator\":{\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"email\":\"team-intg-tools-libs-spam@datadoghq.com\",\"id\":2320499}}\n"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/json"
52+
}
53+
],
54+
"headersSize": 680,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 200,
58+
"statusText": "OK"
59+
},
60+
"startedDateTime": "2026-01-12T17:23:49.637Z",
61+
"time": 205
62+
},
63+
{
64+
"_id": "8aa5bcb8a1681f4e66bc94bc158d0c77",
65+
"_order": 0,
66+
"cache": {},
67+
"request": {
68+
"bodySize": 0,
69+
"cookies": [],
70+
"headers": [
71+
{
72+
"_fromType": "array",
73+
"name": "accept",
74+
"value": "application/json"
75+
}
76+
],
77+
"headersSize": 513,
78+
"httpVersion": "HTTP/1.1",
79+
"method": "DELETE",
80+
"queryString": [],
81+
"url": "https://api.datadoghq.com/api/v1/monitor/250323411"
82+
},
83+
"response": {
84+
"bodySize": 33,
85+
"content": {
86+
"mimeType": "application/json",
87+
"size": 33,
88+
"text": "{\"deleted_monitor_id\":250323411}\n"
89+
},
90+
"cookies": [],
91+
"headers": [
92+
{
93+
"name": "content-type",
94+
"value": "application/json"
95+
}
96+
],
97+
"headersSize": 547,
98+
"httpVersion": "HTTP/1.1",
99+
"redirectURL": "",
100+
"status": 200,
101+
"statusText": "OK"
102+
},
103+
"startedDateTime": "2026-01-12T17:23:49.850Z",
104+
"time": 279
105+
}
106+
],
107+
"pages": [],
108+
"version": "1.2"
109+
}
110+
}

features/v1/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 Quality monitor returns "OK" response
47+
Given new "CreateMonitor" request
48+
And body with value {"name": "{{ unique }}", "type": "data-quality alert", "query": "formula(\"query1\").last(\"5m\") > 100", "message": "Data quality alert triggered", "tags": ["test:{{ unique_lower_alnum }}", "env:ci"], "priority": 3, "options": {"thresholds": {"critical": 100}, "variables": [{"name": "query1", "data_source": "data_quality_metrics", "measure": "row_count", "filter": "search for column where `database:production AND table:users`", "group_by": ["entity_id"]}]}}
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-quality alert"
53+
4554
@team:DataDog/monitor-app
4655
Scenario: Create a RUM formula and functions monitor returns "OK" response
4756
Given new "CreateMonitor" request

services/monitors/src/v1/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export { MonitorDraftStatus } from "./models/MonitorDraftStatus";
2727
export { MonitorFormulaAndFunctionCostAggregator } from "./models/MonitorFormulaAndFunctionCostAggregator";
2828
export { MonitorFormulaAndFunctionCostDataSource } from "./models/MonitorFormulaAndFunctionCostDataSource";
2929
export { MonitorFormulaAndFunctionCostQueryDefinition } from "./models/MonitorFormulaAndFunctionCostQueryDefinition";
30+
export { MonitorFormulaAndFunctionDataQualityDataSource } from "./models/MonitorFormulaAndFunctionDataQualityDataSource";
31+
export { MonitorFormulaAndFunctionDataQualityModelTypeOverride } from "./models/MonitorFormulaAndFunctionDataQualityModelTypeOverride";
32+
export { MonitorFormulaAndFunctionDataQualityMonitorOptions } from "./models/MonitorFormulaAndFunctionDataQualityMonitorOptions";
33+
export { MonitorFormulaAndFunctionDataQualityQueryDefinition } from "./models/MonitorFormulaAndFunctionDataQualityQueryDefinition";
3034
export { MonitorFormulaAndFunctionEventAggregation } from "./models/MonitorFormulaAndFunctionEventAggregation";
3135
export { MonitorFormulaAndFunctionEventQueryDefinition } from "./models/MonitorFormulaAndFunctionEventQueryDefinition";
3236
export { MonitorFormulaAndFunctionEventQueryDefinitionCompute } from "./models/MonitorFormulaAndFunctionEventQueryDefinitionCompute";
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { UnparsedObject } from "@datadog/datadog-api-client";
2+
3+
/**
4+
* Data source for data quality queries.
5+
*/
6+
export type MonitorFormulaAndFunctionDataQualityDataSource =
7+
| typeof DATA_QUALITY_METRICS
8+
| UnparsedObject;
9+
export const DATA_QUALITY_METRICS = "data_quality_metrics";
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { UnparsedObject } from "@datadog/datadog-api-client";
2+
3+
/**
4+
* Override for the model type used in anomaly detection.
5+
*/
6+
export type MonitorFormulaAndFunctionDataQualityModelTypeOverride =
7+
| typeof FRESHNESS
8+
| typeof PERCENTAGE
9+
| typeof ANY
10+
| UnparsedObject;
11+
export const FRESHNESS = "freshness";
12+
export const PERCENTAGE = "percentage";
13+
export const ANY = "any";
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import { AttributeTypeMap } from "@datadog/datadog-api-client";
2+
3+
import { MonitorFormulaAndFunctionDataQualityModelTypeOverride } from "./MonitorFormulaAndFunctionDataQualityModelTypeOverride";
4+
5+
/**
6+
* Monitor configuration options for data quality queries.
7+
*/
8+
export class MonitorFormulaAndFunctionDataQualityMonitorOptions {
9+
/**
10+
* Crontab expression to override the default schedule.
11+
*/
12+
"crontabOverride"?: string;
13+
/**
14+
* Custom SQL query for the monitor.
15+
*/
16+
"customSql"?: string;
17+
/**
18+
* Custom WHERE clause for the query.
19+
*/
20+
"customWhere"?: string;
21+
/**
22+
* Columns to group results by.
23+
*/
24+
"groupByColumns"?: Array<string>;
25+
/**
26+
* Override for the model type used in anomaly detection.
27+
*/
28+
"modelTypeOverride"?: MonitorFormulaAndFunctionDataQualityModelTypeOverride;
29+
/**
30+
* A container for additional, undeclared properties.
31+
* This is a holder for any undeclared properties as specified with
32+
* the 'additionalProperties' keyword in the OAS document.
33+
*/
34+
"additionalProperties"?: { [key: string]: any };
35+
/**
36+
* @ignore
37+
*/
38+
"_unparsed"?: boolean;
39+
40+
/**
41+
* @ignore
42+
*/
43+
static readonly attributeTypeMap: AttributeTypeMap = {
44+
crontabOverride: {
45+
baseName: "crontab_override",
46+
type: "string",
47+
},
48+
customSql: {
49+
baseName: "custom_sql",
50+
type: "string",
51+
},
52+
customWhere: {
53+
baseName: "custom_where",
54+
type: "string",
55+
},
56+
groupByColumns: {
57+
baseName: "group_by_columns",
58+
type: "Array<string>",
59+
},
60+
modelTypeOverride: {
61+
baseName: "model_type_override",
62+
type: "MonitorFormulaAndFunctionDataQualityModelTypeOverride",
63+
},
64+
additionalProperties: {
65+
baseName: "additionalProperties",
66+
type: "{ [key: string]: any; }",
67+
},
68+
};
69+
70+
/**
71+
* @ignore
72+
*/
73+
static getAttributeTypeMap(): AttributeTypeMap {
74+
return MonitorFormulaAndFunctionDataQualityMonitorOptions.attributeTypeMap;
75+
}
76+
77+
public constructor() {}
78+
}

0 commit comments

Comments
 (0)