Skip to content

Commit 2780875

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 53a6366 of spec repo (#3541)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent ded8edd commit 2780875

File tree

11 files changed

+374
-78
lines changed

11 files changed

+374
-78
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12338,33 +12338,73 @@ components:
1233812338
type: object
1233912339
SLOCountDefinition:
1234012340
description: 'A count-based (metric) SLI specification, composed of three parts:
12341-
the good events formula, the total events formula,
12341+
the good events formula,
1234212342

12343-
and the underlying queries.'
12343+
the bad or total events formula, and the underlying queries.
12344+
12345+
Exactly one of `total_events_formula` or `bad_events_formula` must be provided.'
1234412346
example:
12345-
good_events_formula: query1 - query2
12347+
bad_events_formula: query2
12348+
good_events_formula: query1
1234612349
queries:
1234712350
- data_source: metrics
1234812351
name: query1
12349-
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
12352+
query: sum:trace.servlet.request.hits{!http.status_code:500} by {env}.as_count()
1235012353
- data_source: metrics
1235112354
name: query2
12352-
query: sum:trace.servlet.request.errors{*} by {env}.as_count()
12353-
total_events_formula: query1
12355+
query: sum:trace.servlet.request.hits{http.status_code:500} by {env}.as_count()
12356+
oneOf:
12357+
- $ref: '#/components/schemas/SLOCountDefinitionWithTotalEventsFormula'
12358+
- $ref: '#/components/schemas/SLOCountDefinitionWithBadEventsFormula'
12359+
SLOCountDefinitionWithBadEventsFormula:
12360+
additionalProperties: false
1235412361
properties:
12362+
bad_events_formula:
12363+
$ref: '#/components/schemas/SLOFormula'
12364+
description: The bad events formula (recommended). Total events queries
12365+
can be defined using the `total_events_formula` field as an alternative.
12366+
Only one of `total_events_formula` or `bad_events_formula` must be provided.
1235512367
good_events_formula:
1235612368
$ref: '#/components/schemas/SLOFormula'
1235712369
queries:
1235812370
example:
1235912371
- data_source: metrics
1236012372
name: query1
12361-
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
12373+
query: sum:trace.servlet.request.hits{!http.status_code:500} by {env}.as_count()
12374+
- data_source: metrics
12375+
name: query2
12376+
query: sum:trace.servlet.request.hits{http.status_code:500} by {env}.as_count()
12377+
items:
12378+
$ref: '#/components/schemas/SLODataSourceQueryDefinition'
12379+
minItems: 1
12380+
type: array
12381+
required:
12382+
- good_events_formula
12383+
- bad_events_formula
12384+
- queries
12385+
type: object
12386+
SLOCountDefinitionWithTotalEventsFormula:
12387+
additionalProperties: false
12388+
properties:
12389+
good_events_formula:
12390+
$ref: '#/components/schemas/SLOFormula'
12391+
queries:
12392+
example:
12393+
- data_source: metrics
12394+
name: query1
12395+
query: sum:trace.servlet.request.hits{!http.status_code:500} by {env}.as_count()
12396+
- data_source: metrics
12397+
name: query2
12398+
query: sum:trace.servlet.request.hits{http.status_code:500} by {env}.as_count()
1236212399
items:
1236312400
$ref: '#/components/schemas/SLODataSourceQueryDefinition'
1236412401
minItems: 1
1236512402
type: array
1236612403
total_events_formula:
1236712404
$ref: '#/components/schemas/SLOFormula'
12405+
description: The total events formula. Bad events queries can be defined
12406+
using the `bad_events_formula` field as an alternative. Only one of `total_events_formula`
12407+
or `bad_events_formula` must be provided.
1236812408
required:
1236912409
- good_events_formula
1237012410
- total_events_formula
@@ -12375,15 +12415,15 @@ components:
1237512415
description: A metric SLI specification.
1237612416
example:
1237712417
count:
12378-
good_events_formula: query1 - query2
12418+
bad_events_formula: query2
12419+
good_events_formula: query1
1237912420
queries:
1238012421
- data_source: metrics
1238112422
name: query1
12382-
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
12423+
query: sum:trace.servlet.request.hits{!http.status_code:500} by {env}.as_count()
1238312424
- data_source: metrics
1238412425
name: query2
12385-
query: sum:trace.servlet.request.errors{*} by {env}.as_count()
12386-
total_events_formula: query1
12426+
query: sum:trace.servlet.request.hits{http.status_code:500} by {env}.as_count()
1238712427
properties:
1238812428
count:
1238912429
$ref: '#/components/schemas/SLOCountDefinition'
@@ -13519,7 +13559,7 @@ components:
1351913559
name: query1
1352013560
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
1352113561
- data_source: metrics
13522-
name: query1
13562+
name: query2
1352313563
query: sum:trace.servlet.request.errors{*} by {env}.as_count()
1352413564
threshold: 5
1352513565
properties:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2026-02-25T17:45:38.518Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"log": {
3+
"_recordingName": "Service Level Objectives/Create a new metric SLO object using bad events formula returns \"OK\" response",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "d5693d5eee1eafa788d069277375e5d9",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 690,
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": 547,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"description\":\"Metric SLO using sli_specification\",\"name\":\"Test-Create_a_new_metric_SLO_object_using_bad_events_formula_returns_OK_response-1772041538\",\"sli_specification\":{\"count\":{\"bad_events_formula\":{\"formula\":\"query2\"},\"good_events_formula\":{\"formula\":\"query1 - query2\"},\"queries\":[{\"data_source\":\"metrics\",\"name\":\"query1\",\"query\":\"sum:httpservice.hits{*}.as_count()\"},{\"data_source\":\"metrics\",\"name\":\"query2\",\"query\":\"sum:httpservice.errors{*}.as_count()\"}]}},\"tags\":[\"env:prod\",\"type:count\"],\"target_threshold\":99,\"thresholds\":[{\"target\":99,\"target_display\":\"99.0\",\"timeframe\":\"7d\",\"warning\":99.5,\"warning_display\":\"99.5\"}],\"timeframe\":\"7d\",\"type\":\"metric\",\"warning_threshold\":99.5}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v1/slo"
39+
},
40+
"response": {
41+
"bodySize": 1196,
42+
"content": {
43+
"mimeType": "application/json",
44+
"size": 1196,
45+
"text": "{\"data\":[{\"id\":\"7309ff3752fd519f80f65a2ed3247dbb\",\"name\":\"Test-Create_a_new_metric_SLO_object_using_bad_events_formula_returns_OK_response-1772041538\",\"tags\":[\"env:prod\",\"type:count\"],\"monitor_tags\":[],\"thresholds\":[{\"timeframe\":\"7d\",\"target\":99.0,\"target_display\":\"99.\",\"warning\":99.5,\"warning_display\":\"99.5\"}],\"type\":\"metric\",\"type_id\":1,\"description\":\"Metric SLO using sli_specification\",\"timeframe\":\"7d\",\"warning_threshold\":99.5,\"target_threshold\":99,\"query\":{\"numerator\":\"sum:httpservice.hits{*}.as_count() - sum:httpservice.errors{*}.as_count()\",\"denominator\":\"(sum:httpservice.hits{*}.as_count() - sum:httpservice.errors{*}.as_count()) + (sum:httpservice.errors{*}.as_count())\"},\"creator\":{\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"email\":\"team-intg-tools-libs-spam@datadoghq.com\"},\"created_at\":1772041538,\"modified_at\":1772041538,\"sli_specification\":{\"count\":{\"bad_events_formula\":{\"formula\":\"query2\"},\"good_events_formula\":{\"formula\":\"query1 - query2\"},\"queries\":[{\"data_source\":\"metrics\",\"name\":\"query1\",\"query\":\"sum:httpservice.hits{*}.as_count()\"},{\"data_source\":\"metrics\",\"name\":\"query2\",\"query\":\"sum:httpservice.errors{*}.as_count()\"}]}}}],\"error\":null}\n"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/json"
52+
}
53+
],
54+
"headersSize": 678,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 200,
58+
"statusText": "OK"
59+
},
60+
"startedDateTime": "2026-02-25T17:45:38.526Z",
61+
"time": 172
62+
},
63+
{
64+
"_id": "c0933b3f30b7b24a0ddbdcdf3c1ea62d",
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": 528,
78+
"httpVersion": "HTTP/1.1",
79+
"method": "DELETE",
80+
"queryString": [],
81+
"url": "https://api.datadoghq.com/api/v1/slo/7309ff3752fd519f80f65a2ed3247dbb"
82+
},
83+
"response": {
84+
"bodySize": 59,
85+
"content": {
86+
"mimeType": "application/json",
87+
"size": 59,
88+
"text": "{\"data\":[\"7309ff3752fd519f80f65a2ed3247dbb\"],\"error\":null}\n"
89+
},
90+
"cookies": [],
91+
"headers": [
92+
{
93+
"name": "content-type",
94+
"value": "application/json"
95+
}
96+
],
97+
"headersSize": 674,
98+
"httpVersion": "HTTP/1.1",
99+
"redirectURL": "",
100+
"status": 200,
101+
"statusText": "OK"
102+
},
103+
"startedDateTime": "2026-02-25T17:45:38.707Z",
104+
"time": 219
105+
}
106+
],
107+
"pages": [],
108+
"version": "1.2"
109+
}
110+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* Create a new metric SLO object using bad events formula returns "OK" response
3+
*/
4+
5+
import { client, v1 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v1.ServiceLevelObjectivesApi(configuration);
9+
10+
const params: v1.ServiceLevelObjectivesApiCreateSLORequest = {
11+
body: {
12+
type: "metric",
13+
description: "Metric SLO using sli_specification",
14+
name: "Example-Service-Level-Objective",
15+
sliSpecification: {
16+
count: {
17+
goodEventsFormula: {
18+
formula: "query1 - query2",
19+
},
20+
badEventsFormula: {
21+
formula: "query2",
22+
},
23+
queries: [
24+
{
25+
dataSource: "metrics",
26+
name: "query1",
27+
query: "sum:httpservice.hits{*}.as_count()",
28+
},
29+
{
30+
dataSource: "metrics",
31+
name: "query2",
32+
query: "sum:httpservice.errors{*}.as_count()",
33+
},
34+
],
35+
},
36+
},
37+
tags: ["env:prod", "type:count"],
38+
thresholds: [
39+
{
40+
target: 99.0,
41+
targetDisplay: "99.0",
42+
timeframe: "7d",
43+
warning: 99.5,
44+
warningDisplay: "99.5",
45+
},
46+
],
47+
timeframe: "7d",
48+
targetThreshold: 99.0,
49+
warningThreshold: 99.5,
50+
},
51+
};
52+
53+
apiInstance
54+
.createSLO(params)
55+
.then((data: v1.SLOListResponse) => {
56+
console.log(
57+
"API called successfully. Returned data: " + JSON.stringify(data)
58+
);
59+
})
60+
.catch((error: any) => console.error(error));

features/v1/service_level_objectives.feature

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ Feature: Service Level Objectives
4848
When the request is sent
4949
Then the response status is 200 OK
5050

51+
@team:DataDog/slo-app
52+
Scenario: Create a new metric SLO object using bad events formula returns "OK" response
53+
Given new "CreateSLO" request
54+
And body with value {"type":"metric","description":"Metric SLO using sli_specification","name":"{{ unique }}","sli_specification":{"count":{"good_events_formula":{"formula":"query1 - query2"},"bad_events_formula":{"formula":"query2"},"queries":[{"data_source":"metrics","name":"query1","query":"sum:httpservice.hits{*}.as_count()"},{"data_source":"metrics","name":"query2","query":"sum:httpservice.errors{*}.as_count()"}]}},"tags":["env:prod","type:count"],"thresholds":[{"target":99.0,"target_display":"99.0","timeframe":"7d","warning":99.5,"warning_display":"99.5"}],"timeframe":"7d","target_threshold":99.0,"warning_threshold":99.5}
55+
When the request is sent
56+
Then the response status is 200 OK
57+
And the response "data[0]" has field "sli_specification"
58+
And the response "data[0].sli_specification" has field "count"
59+
And the response "data[0].sli_specification.count" has field "good_events_formula"
60+
And the response "data[0].sli_specification.count" has field "bad_events_formula"
61+
And the response "data[0].sli_specification.count" has field "queries"
62+
And the response "data[0].sli_specification.count.queries" has length 2
63+
5164
@team:DataDog/slo-app
5265
Scenario: Create a new metric SLO object using sli_specification returns "OK" response
5366
Given new "CreateSLO" request
@@ -247,7 +260,7 @@ Feature: Service Level Objectives
247260
Scenario: Update an SLO returns "Not Found" response
248261
Given new "UpdateSLO" request
249262
And request contains "slo_id" parameter from "REPLACE.ME"
250-
And body with value {"description": null, "groups": ["env:prod", "role:mysql"], "monitor_ids": [], "monitor_tags": [], "name": "Custom Metric SLO", "query": {"denominator": "sum:my.custom.metric{*}.as_count()", "numerator": "sum:my.custom.metric{type:good}.as_count()"}, "sli_specification": {"time_slice": {"comparator": "<", "query": {"formulas": [{"formula": "query2/query1"}], "queries": [{"data_source": "metrics", "name": "query1", "query": "sum:trace.servlet.request.hits{*} by {env}.as_count()"}, {"data_source": "metrics", "name": "query1", "query": "sum:trace.servlet.request.errors{*} by {env}.as_count()"}]}, "threshold": 5}}, "tags": ["env:prod", "app:core"], "target_threshold": 99.9, "thresholds": [{"target": 95, "timeframe": "7d"}, {"target": 95, "timeframe": "30d", "warning": 97}], "timeframe": "30d", "type": "metric", "warning_threshold": 99.95}
263+
And body with value {"description": null, "groups": ["env:prod", "role:mysql"], "monitor_ids": [], "monitor_tags": [], "name": "Custom Metric SLO", "query": {"denominator": "sum:my.custom.metric{*}.as_count()", "numerator": "sum:my.custom.metric{type:good}.as_count()"}, "sli_specification": {"time_slice": {"comparator": "<", "query": {"formulas": [{"formula": "query2/query1"}], "queries": [{"data_source": "metrics", "name": "query1", "query": "sum:trace.servlet.request.hits{*} by {env}.as_count()"}, {"data_source": "metrics", "name": "query2", "query": "sum:trace.servlet.request.errors{*} by {env}.as_count()"}]}, "threshold": 5}}, "tags": ["env:prod", "app:core"], "target_threshold": 99.9, "thresholds": [{"target": 95, "timeframe": "7d"}, {"target": 95, "timeframe": "30d", "warning": 97}], "timeframe": "30d", "type": "metric", "warning_threshold": 99.95}
251264
When the request is sent
252265
Then the response status is 404 Not Found
253266

packages/datadog-api-client-v1/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,8 @@ export { SLOCorrectionUpdateData } from "./models/SLOCorrectionUpdateData";
879879
export { SLOCorrectionUpdateRequest } from "./models/SLOCorrectionUpdateRequest";
880880
export { SLOCorrectionUpdateRequestAttributes } from "./models/SLOCorrectionUpdateRequestAttributes";
881881
export { SLOCountDefinition } from "./models/SLOCountDefinition";
882+
export { SLOCountDefinitionWithBadEventsFormula } from "./models/SLOCountDefinitionWithBadEventsFormula";
883+
export { SLOCountDefinitionWithTotalEventsFormula } from "./models/SLOCountDefinitionWithTotalEventsFormula";
882884
export { SLOCountSpec } from "./models/SLOCountSpec";
883885
export { SLOCreator } from "./models/SLOCreator";
884886
export { SLODataSourceQueryDefinition } from "./models/SLODataSourceQueryDefinition";

packages/datadog-api-client-v1/models/ObjectSerializer.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ import { SLOCorrectionResponseAttributesModifier } from "./SLOCorrectionResponse
339339
import { SLOCorrectionUpdateData } from "./SLOCorrectionUpdateData";
340340
import { SLOCorrectionUpdateRequest } from "./SLOCorrectionUpdateRequest";
341341
import { SLOCorrectionUpdateRequestAttributes } from "./SLOCorrectionUpdateRequestAttributes";
342-
import { SLOCountDefinition } from "./SLOCountDefinition";
342+
import { SLOCountDefinitionWithBadEventsFormula } from "./SLOCountDefinitionWithBadEventsFormula";
343+
import { SLOCountDefinitionWithTotalEventsFormula } from "./SLOCountDefinitionWithTotalEventsFormula";
343344
import { SLOCountSpec } from "./SLOCountSpec";
344345
import { SLOCreator } from "./SLOCreator";
345346
import { SLODeleteResponse } from "./SLODeleteResponse";
@@ -2185,7 +2186,10 @@ const typeMap: { [index: string]: any } = {
21852186
SLOCorrectionUpdateData: SLOCorrectionUpdateData,
21862187
SLOCorrectionUpdateRequest: SLOCorrectionUpdateRequest,
21872188
SLOCorrectionUpdateRequestAttributes: SLOCorrectionUpdateRequestAttributes,
2188-
SLOCountDefinition: SLOCountDefinition,
2189+
SLOCountDefinitionWithBadEventsFormula:
2190+
SLOCountDefinitionWithBadEventsFormula,
2191+
SLOCountDefinitionWithTotalEventsFormula:
2192+
SLOCountDefinitionWithTotalEventsFormula,
21892193
SLOCountSpec: SLOCountSpec,
21902194
SLOCreator: SLOCreator,
21912195
SLODeleteResponse: SLODeleteResponse,
@@ -2647,6 +2651,10 @@ const oneOfMap: { [index: string]: string[] } = {
26472651
"NotebookCellUpdateRequest",
26482652
],
26492653
NumberFormatUnit: ["NumberFormatUnitCanonical", "NumberFormatUnitCustom"],
2654+
SLOCountDefinition: [
2655+
"SLOCountDefinitionWithTotalEventsFormula",
2656+
"SLOCountDefinitionWithBadEventsFormula",
2657+
],
26502658
SLODataSourceQueryDefinition: ["FormulaAndFunctionMetricQueryDefinition"],
26512659
SLOSliSpec: ["SLOTimeSliceSpec", "SLOCountSpec"],
26522660
SharedDashboardInvitesData: [

0 commit comments

Comments
 (0)