Skip to content

Commit

Permalink
Regenerate client from commit 1dae0a3f of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Aug 11, 2022
1 parent 66796bb commit d44e283
Show file tree
Hide file tree
Showing 12 changed files with 149 additions and 6 deletions.
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.6.2",
"regenerated": "2022-08-09 11:24:25.402502",
"spec_repo_commit": "f62be169"
"regenerated": "2022-08-11 11:26:24.776405",
"spec_repo_commit": "1dae0a3f"
},
"v2": {
"apigentools_version": "1.6.2",
"regenerated": "2022-08-09 11:24:25.415050",
"spec_repo_commit": "f62be169"
"regenerated": "2022-08-11 11:26:24.790568",
"spec_repo_commit": "1dae0a3f"
}
}
}
36 changes: 36 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6131,6 +6131,17 @@ components:
format: int64
nullable: true
type: integer
group_retention_duration:
description: 'The time span after which groups with missing data are dropped
from the monitor state.

The minimum value is one hour, and the maximum value is 72 hours.

Example values are: "60m", "1h", and "2d".

This option is only available for APM Trace Analytics, Audit Trail, CI,
Error Tracking, Event, Logs, and RUM monitors.'
type: string
groupby_simple_monitor:
description: Whether the log alert monitor triggers a single alert or multiple
alerts when any group breaches a threshold.
Expand Down Expand Up @@ -6221,6 +6232,8 @@ components:
description: A Boolean indicating whether this monitor notifies when data
stops reporting.
type: boolean
on_missing_data:
$ref: '#/components/schemas/OnMissingDataOption'
renotify_interval:
default: null
description: "The number of minutes after the last notification before a
Expand Down Expand Up @@ -7922,6 +7935,29 @@ components:
format: int64
type: integer
type: object
OnMissingDataOption:
description: 'Controls how groups or monitors are treated if an evaluation does
not return any data points.

The default option results in different behavior depending on the monitor
query type.

For monitors using Count queries, an empty monitor evaluation is treated as
0 and is compared to the threshold conditions.

For monitor using any query type other than Count, for example Gauge or Rate,
the monitor shows the last known status.'
enum:
- default
- show_no_data
- show_and_notify_no_data
- resolve
type: string
x-enum-varnames:
- DEFAULT
- SHOW_NO_DATA
- SHOW_AND_NOTIFY_NO_DATA
- RESOLVE
OrgDowngradedResponse:
description: Status of downgrade
properties:
Expand Down
49 changes: 49 additions & 0 deletions examples/v1/monitors/CreateMonitor_3905753798.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Create a monitor with options returns "OK" response
*/

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.MonitorsApi(configuration);

const params: v1.MonitorsApiCreateMonitorRequest = {
body: {
name: "Example-Create_a_monitor_with_options_returns_OK_response",
type: "log alert",
query: `logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2`,
message: "some message Notify: @hipchat-channel",
tags: ["test:examplecreateamonitorwithoptionsreturnsokresponse", "env:ci"],
priority: 3,
options: {
enableLogsSample: true,
escalationMessage: "the situation has escalated",
evaluationDelay: 700,
groupRetentionDuration: "2h",
groupbySimpleMonitor: true,
includeTags: true,
locked: false,
newHostDelay: 600,
noDataTimeframe: undefined,
notifyAudit: false,
notifyNoData: false,
onMissingData: "show_and_notify_no_data",
renotifyInterval: 60,
requireFullWindow: true,
timeoutH: 24,
thresholds: {
critical: 2,
warning: 1,
},
},
},
};

apiInstance
.createMonitor(params)
.then((data: v1.Monitor) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
2 changes: 2 additions & 0 deletions examples/v1/monitors/ValidateExistingMonitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ const params: v1.MonitorsApiValidateExistingMonitorRequest = {
enableLogsSample: true,
escalationMessage: "the situation has escalated",
evaluationDelay: 700,
groupRetentionDuration: "2h",
groupbySimpleMonitor: true,
includeTags: true,
locked: false,
newHostDelay: 600,
noDataTimeframe: undefined,
notifyAudit: false,
notifyNoData: false,
onMissingData: "show_and_notify_no_data",
renotifyInterval: 60,
requireFullWindow: true,
timeoutH: 24,
Expand Down
2 changes: 2 additions & 0 deletions examples/v1/monitors/ValidateMonitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ const params: v1.MonitorsApiValidateMonitorRequest = {
enableLogsSample: true,
escalationMessage: "the situation has escalated",
evaluationDelay: 700,
groupRetentionDuration: "2h",
groupbySimpleMonitor: true,
includeTags: true,
locked: false,
newHostDelay: 600,
noDataTimeframe: undefined,
notifyAudit: false,
notifyNoData: false,
onMissingData: "show_and_notify_no_data",
renotifyInterval: 60,
requireFullWindow: true,
timeoutH: 24,
Expand Down
2 changes: 1 addition & 1 deletion features/v1/given.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"parameters": [
{
"name": "body",
"value": "{\n \"name\": \"{{ unique }}\",\n \"type\": \"log alert\",\n \"query\": \"logs(\\\"service:foo AND type:error\\\").index(\\\"main\\\").rollup(\\\"count\\\").by(\\\"source\\\").last(\\\"5m\\\") > 2\",\n \"message\": \"some message Notify: @hipchat-channel\",\n \"tags\": [\"test:{{ unique_lower_alnum }}\", \"env:ci\"],\n \"priority\": 3,\n \"options\": {\n \"enable_logs_sample\": true,\n \"escalation_message\": \"the situation has escalated\",\n \"evaluation_delay\": 700,\n \"groupby_simple_monitor\": true,\n \"include_tags\": true,\n \"locked\": false,\n \"new_host_delay\": 600,\n \"no_data_timeframe\": null,\n \"notify_audit\": false,\n \"notify_no_data\": false,\n \"renotify_interval\": 60,\n \"require_full_window\": true,\n \"timeout_h\": 24,\n \"thresholds\": { \"critical\": 2, \"warning\": 1 }\n }\n}\n"
"value": "{\n \"name\": \"{{ unique }}\",\n \"type\": \"log alert\",\n \"query\": \"logs(\\\"service:foo AND type:error\\\").index(\\\"main\\\").rollup(\\\"count\\\").by(\\\"source\\\").last(\\\"5m\\\") > 2\",\n \"message\": \"some message Notify: @hipchat-channel\",\n \"tags\": [\"test:{{ unique_lower_alnum }}\", \"env:ci\"],\n \"priority\": 3,\n \"options\": {\n \"enable_logs_sample\": true,\n \"escalation_message\": \"the situation has escalated\",\n \"evaluation_delay\": 700,\n \"group_retention_duration\": \"2h\",\n \"groupby_simple_monitor\": true,\n \"include_tags\": true,\n \"locked\": false,\n \"new_host_delay\": 600,\n \"no_data_timeframe\": null,\n \"notify_audit\": false,\n \"notify_no_data\": false,\n \"on_missing_data\": \"show_and_notify_no_data\",\n \"renotify_interval\": 60,\n \"require_full_window\": true,\n \"timeout_h\": 24,\n \"thresholds\": { \"critical\": 2, \"warning\": 1 }\n }\n}\n"
}
],
"step": "there is a valid \"monitor\" in the system",
Expand Down
2 changes: 2 additions & 0 deletions features/v1/monitor_payload.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
"enable_logs_sample": true,
"escalation_message": "the situation has escalated",
"evaluation_delay": 700,
"group_retention_duration": "2h",
"groupby_simple_monitor": true,
"include_tags": true,
"locked": false,
"new_host_delay": 600,
"no_data_timeframe": null,
"notify_audit": false,
"notify_no_data": false,
"on_missing_data": "show_and_notify_no_data",
"renotify_interval": 60,
"require_full_window": true,
"timeout_h": 24,
Expand Down
9 changes: 8 additions & 1 deletion features/v1/monitors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ Feature: Monitors
When the request is sent
Then the response status is 200 OK

@team:DataDog/monitor-app
Scenario: Create a monitor with options returns "OK" response
Given new "CreateMonitor" request
And body from file "monitor_payload.json"
When the request is sent
Then the response status is 200 OK

@team:DataDog/monitor-app
Scenario: Create an Error Tracking monitor returns "OK" response
Given new "CreateMonitor" request
Expand Down Expand Up @@ -115,7 +122,7 @@ Feature: Monitors
Scenario: Edit a monitor returns "Bad Request" response
Given new "UpdateMonitor" request
And request contains "monitor_id" parameter from "REPLACE.ME"
And body with value {"options": {"escalation_message": "none", "evaluation_delay": null, "include_tags": true, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notify_audit": false, "notify_no_data": false, "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": null, "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "restricted_roles": [], "tags": [], "type": "query alert"}
And body with value {"options": {"escalation_message": "none", "evaluation_delay": null, "include_tags": true, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notify_audit": false, "notify_no_data": false, "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": null, "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "restricted_roles": [], "tags": [], "type": "query alert"}
When the request is sent
Then the response status is 400 Bad Request

Expand Down
1 change: 1 addition & 0 deletions packages/datadog-api-client-v1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ export { NotebookUpdateDataAttributes } from "./models/NotebookUpdateDataAttribu
export { NotebookUpdateRequest } from "./models/NotebookUpdateRequest";
export { NoteWidgetDefinition } from "./models/NoteWidgetDefinition";
export { NoteWidgetDefinitionType } from "./models/NoteWidgetDefinitionType";
export { OnMissingDataOption } from "./models/OnMissingDataOption";
export { Organization } from "./models/Organization";
export { OrganizationBilling } from "./models/OrganizationBilling";
export { OrganizationCreateBody } from "./models/OrganizationCreateBody";
Expand Down
23 changes: 23 additions & 0 deletions packages/datadog-api-client-v1/models/MonitorOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { MonitorOptionsAggregation } from "./MonitorOptionsAggregation";
import { MonitorRenotifyStatusType } from "./MonitorRenotifyStatusType";
import { MonitorThresholds } from "./MonitorThresholds";
import { MonitorThresholdWindowOptions } from "./MonitorThresholdWindowOptions";
import { OnMissingDataOption } from "./OnMissingDataOption";

import { AttributeTypeMap } from "../../datadog-api-client-common/util";

Expand Down Expand Up @@ -41,6 +42,13 @@ export class MonitorOptions {
* This is useful for AWS CloudWatch and other backfilled metrics to ensure the monitor always has data during evaluation.
*/
"evaluationDelay"?: number;
/**
* The time span after which groups with missing data are dropped from the monitor state.
* The minimum value is one hour, and the maximum value is 72 hours.
* Example values are: "60m", "1h", and "2d".
* This option is only available for APM Trace Analytics, Audit Trail, CI, Error Tracking, Event, Logs, and RUM monitors.
*/
"groupRetentionDuration"?: string;
/**
* Whether the log alert monitor triggers a single alert or multiple alerts when any group breaches a threshold.
*/
Expand Down Expand Up @@ -97,6 +105,13 @@ export class MonitorOptions {
* A Boolean indicating whether this monitor notifies when data stops reporting.
*/
"notifyNoData"?: boolean;
/**
* Controls how groups or monitors are treated if an evaluation does not return any data points.
* The default option results in different behavior depending on the monitor query type.
* For monitors using Count queries, an empty monitor evaluation is treated as 0 and is compared to the threshold conditions.
* For monitor using any query type other than Count, for example Gauge or Rate, the monitor shows the last known status.
*/
"onMissingData"?: OnMissingDataOption;
/**
* The number of minutes after the last notification before a monitor re-notifies on the current status.
* It only re-notifies if it’s not resolved.
Expand Down Expand Up @@ -171,6 +186,10 @@ export class MonitorOptions {
type: "number",
format: "int64",
},
groupRetentionDuration: {
baseName: "group_retention_duration",
type: "string",
},
groupbySimpleMonitor: {
baseName: "groupby_simple_monitor",
type: "boolean",
Expand Down Expand Up @@ -216,6 +235,10 @@ export class MonitorOptions {
baseName: "notify_no_data",
type: "boolean",
},
onMissingData: {
baseName: "on_missing_data",
type: "OnMissingDataOption",
},
renotifyInterval: {
baseName: "renotify_interval",
type: "number",
Expand Down
6 changes: 6 additions & 0 deletions packages/datadog-api-client-v1/models/ObjectSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,12 @@ const enumsMap: { [key: string]: any[] } = {
],
NotebookResourceType: ["notebooks"],
NotebookStatus: ["published"],
OnMissingDataOption: [
"default",
"show_no_data",
"show_and_notify_no_data",
"resolve",
],
QuerySortOrder: ["asc", "desc"],
QueryValueWidgetDefinitionType: ["query_value"],
SLOCorrectionCategory: [
Expand Down
15 changes: 15 additions & 0 deletions packages/datadog-api-client-v1/models/OnMissingDataOption.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2020-Present Datadog, Inc.
*/

export type OnMissingDataOption =
| typeof DEFAULT
| typeof SHOW_NO_DATA
| typeof SHOW_AND_NOTIFY_NO_DATA
| typeof RESOLVE;
export const DEFAULT = "default";
export const SHOW_NO_DATA = "show_no_data";
export const SHOW_AND_NOTIFY_NO_DATA = "show_and_notify_no_data";
export const RESOLVE = "resolve";

0 comments on commit d44e283

Please sign in to comment.