Skip to content

Commit 637b4f5

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add SLO status and error budget remaining to search API (#1028)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 4bab253 commit 637b4f5

File tree

14 files changed

+248
-42
lines changed

14 files changed

+248
-42
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.4",
7-
"regenerated": "2023-02-14 19:41:06.877915",
8-
"spec_repo_commit": "c0625360"
7+
"regenerated": "2023-02-14 22:24:35.435746",
8+
"spec_repo_commit": "7a7cb634"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2023-02-14 19:41:06.895348",
13-
"spec_repo_commit": "c0625360"
12+
"regenerated": "2023-02-14 22:24:35.448427",
13+
"spec_repo_commit": "7a7cb634"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9697,6 +9697,12 @@ components:
96979697
description: Error message if SLO status or error budget could not be calculated.
96989698
nullable: true
96999699
type: string
9700+
error_budget_remaining:
9701+
description: Remaining error budget of the SLO in percentage.
9702+
example: 100
9703+
format: double
9704+
nullable: true
9705+
type: number
97009706
indexed_at:
97019707
description: 'timestamp (UNIX time in seconds) of when the SLO status and
97029708
error budget
@@ -9711,7 +9717,10 @@ components:
97119717
description: The amount of decimal places the SLI value is accurate to.
97129718
example: 2
97139719
format: int64
9720+
nullable: true
97149721
type: integer
9722+
state:
9723+
$ref: '#/components/schemas/SLOState'
97159724
status:
97169725
description: The status of the SLO.
97179726
example: 100
@@ -9728,6 +9737,7 @@ components:
97289737
type: object
97299738
SLORawErrorBudgetRemaining:
97309739
description: Error budget remaining for an SLO.
9740+
nullable: true
97319741
properties:
97329742
unit:
97339743
description: Error budget remaining unit.
@@ -9917,6 +9927,59 @@ components:
99179927
format: double
99189928
type: number
99199929
type: object
9930+
SLOState:
9931+
description: State of the SLO.
9932+
enum:
9933+
- breached
9934+
- warning
9935+
- ok
9936+
- no_data
9937+
example: ok
9938+
type: string
9939+
x-enum-varnames:
9940+
- BREACHED
9941+
- WARNING
9942+
- OK
9943+
- NO_DATA
9944+
SLOStatus:
9945+
description: Status of the SLO's primary timeframe.
9946+
properties:
9947+
calculation_error:
9948+
description: Error message if SLO status or error budget could not be calculated.
9949+
nullable: true
9950+
type: string
9951+
error_budget_remaining:
9952+
description: Remaining error budget of the SLO in percentage.
9953+
example: 100
9954+
format: double
9955+
nullable: true
9956+
type: number
9957+
indexed_at:
9958+
description: 'timestamp (UNIX time in seconds) of when the SLO status and
9959+
error budget
9960+
9961+
were calculated.'
9962+
example: 1662496260
9963+
format: int64
9964+
type: integer
9965+
raw_error_budget_remaining:
9966+
$ref: '#/components/schemas/SLORawErrorBudgetRemaining'
9967+
sli:
9968+
description: The current service level indicator (SLI) of the SLO, also
9969+
known as 'status'. This is a percentage value from 0-100 (inclusive).
9970+
example: 100
9971+
format: double
9972+
nullable: true
9973+
type: number
9974+
span_precision:
9975+
description: The number of decimal places the SLI value is accurate to.
9976+
example: 2
9977+
format: int64
9978+
nullable: true
9979+
type: integer
9980+
state:
9981+
$ref: '#/components/schemas/SLOState'
9982+
type: object
99209983
SLOThreshold:
99219984
description: SLO thresholds (target and optionally warning) for a single time
99229985
window.
@@ -10549,6 +10612,8 @@ components:
1054910612
type: array
1055010613
slo_type:
1055110614
$ref: '#/components/schemas/SLOType'
10615+
status:
10616+
$ref: '#/components/schemas/SLOStatus'
1055210617
team_tags:
1055310618
description: Tags with the `team` tag key.
1055410619
items:
@@ -25874,9 +25939,6 @@ paths:
2587425939
summary: Search for SLOs
2587525940
tags:
2587625941
- Service Level Objectives
25877-
x-unstable: '**Note**: This endpoint is in public beta.
25878-
25879-
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
2588025942
/api/v1/slo/{slo_id}:
2588125943
delete:
2588225944
description: 'Permanently delete the specified service level objective object.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"2022-09-28T09:39:18.171Z"
1+
"2023-02-14T21:35:39.636Z"

cassettes/v1/Service-Level-Objectives_139838558/Search-for-SLOs-returns-OK-response_1012169361/recording.har

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"entries": [
1010
{
11-
"_id": "c4e48f7ef9a1e661ef7257e9a1929026",
11+
"_id": "79ca7ba409ab3075578fd19fd154a6aa",
1212
"_order": 0,
1313
"cache": {},
1414
"request": {
@@ -32,17 +32,17 @@
3232
"postData": {
3333
"mimeType": "application/json",
3434
"params": [],
35-
"text": "{\"name\":\"Test-Search_for_SLOs_returns_OK_response-1664357958\",\"query\":{\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\",\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\"},\"thresholds\":[{\"target\":95,\"timeframe\":\"7d\",\"warning\":98}],\"type\":\"metric\"}"
35+
"text": "{\"name\":\"Test-Search_for_SLOs_returns_OK_response-1676410539\",\"query\":{\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\",\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\"},\"thresholds\":[{\"target\":95,\"timeframe\":\"7d\",\"warning\":98}],\"type\":\"metric\"}"
3636
},
3737
"queryString": [],
3838
"url": "https://api.datadoghq.com/api/v1/slo"
3939
},
4040
"response": {
41-
"bodySize": 567,
41+
"bodySize": 629,
4242
"content": {
4343
"mimeType": "application/json",
44-
"size": 567,
45-
"text": "{\"data\":[{\"description\":\"\",\"monitor_tags\":[],\"creator\":{\"handle\":\"[email protected]\",\"name\":null,\"email\":\"[email protected]\"},\"thresholds\":[{\"warning\":98.0,\"warning_display\":\"98.\",\"target\":95.0,\"target_display\":\"95.\",\"timeframe\":\"7d\"}],\"type_id\":1,\"query\":{\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\",\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\"},\"id\":\"3e0865c5301c5271a3b4345eb4f14074\",\"name\":\"Test-Search_for_SLOs_returns_OK_response-1664357958\",\"created_at\":1664357958,\"tags\":[],\"modified_at\":1664357958,\"type\":\"metric\"}],\"error\":null}\n"
44+
"size": 629,
45+
"text": "{\"data\":[{\"id\":\"34c97838f5c5578ebe812e5d068977a9\",\"name\":\"Test-Search_for_SLOs_returns_OK_response-1676410539\",\"tags\":[],\"monitor_tags\":[],\"thresholds\":[{\"timeframe\":\"7d\",\"target\":95.0,\"target_display\":\"95.\",\"warning\":98.0,\"warning_display\":\"98.\"}],\"type\":\"metric\",\"type_id\":1,\"description\":\"\",\"timeframe\":\"7d\",\"warning_threshold\":98,\"target_threshold\":95,\"query\":{\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\",\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\"},\"creator\":{\"name\":null,\"handle\":\"[email protected]\",\"email\":\"[email protected]\"},\"created_at\":1676410539,\"modified_at\":1676410539}],\"error\":null}\n"
4646
},
4747
"cookies": [],
4848
"headers": [
@@ -51,17 +51,17 @@
5151
"value": "application/json"
5252
}
5353
],
54-
"headersSize": 618,
54+
"headersSize": 619,
5555
"httpVersion": "HTTP/1.1",
5656
"redirectURL": "",
5757
"status": 200,
5858
"statusText": "OK"
5959
},
60-
"startedDateTime": "2022-09-28T09:39:18.181Z",
61-
"time": 611
60+
"startedDateTime": "2023-02-14T21:35:39.646Z",
61+
"time": 283
6262
},
6363
{
64-
"_id": "d51df83c1bd72348f0fc1154dbe20f8d",
64+
"_id": "20df3a273e22a0e73d3a21844c87a84d",
6565
"_order": 0,
6666
"cache": {},
6767
"request": {
@@ -74,13 +74,13 @@
7474
"value": "application/json"
7575
}
7676
],
77-
"headersSize": 595,
77+
"headersSize": 601,
7878
"httpVersion": "HTTP/1.1",
7979
"method": "GET",
8080
"queryString": [
8181
{
8282
"name": "query",
83-
"value": "Test-Search_for_SLOs_returns_OK_response-1664357958"
83+
"value": "Test-Search_for_SLOs_returns_OK_response-1676410539"
8484
},
8585
{
8686
"name": "page",
@@ -90,14 +90,14 @@
9090
}
9191
}
9292
],
93-
"url": "https://api.datadoghq.com/api/v1/slo/search?query=Test-Search_for_SLOs_returns_OK_response-1664357958&page%5Bsize%5D=20&page%5Bnumber%5D=0"
93+
"url": "https://api.datadoghq.com/api/v1/slo/search?page%5Bnumber%5D=0&page%5Bsize%5D=20&query=Test-Search_for_SLOs_returns_OK_response-1676410539"
9494
},
9595
"response": {
96-
"bodySize": 1323,
96+
"bodySize": 1851,
9797
"content": {
9898
"mimeType": "application/json",
99-
"size": 1323,
100-
"text": "{\"meta\":{\"pagination\":{\"prev_number\":0,\"number\":0,\"last_number\":0,\"next_number\":1,\"first_number\":0,\"total\":1,\"type\":\"number_size\",\"size\":20}},\"data\":{\"attributes\":{\"slos\":[{\"data\":{\"attributes\":{\"team_tags\":[],\"description\":null,\"creator\":{\"id\":1445416,\"email\":\"[email protected]\",\"name\":null},\"created_at\":1664357958,\"env_tags\":[],\"modified_at\":1664357958,\"name\":\"Test-Search_for_SLOs_returns_OK_response-1664357958\",\"service_tags\":[],\"groups\":null,\"all_tags\":[],\"query\":{\"metrics\":null,\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\",\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\"},\"thresholds\":[{\"warning\":98.0,\"warning_display\":\"95\",\"target\":95.0,\"target_display\":\"95\",\"timeframe\":\"7d\"}],\"monitor_ids\":null,\"slo_type\":\"metric\"},\"type\":\"slo\",\"id\":\"3e0865c5301c5271a3b4345eb4f14074\"}}]},\"type\":\"service_level_objective_search_results\"},\"links\":{\"next\":\"https://api.datadoghq.com/api/v1/slo/search?query=Test-Search_for_SLOs_returns_OK_response-1664357958&page[number]=1&page[size]=20\",\"self\":\"https://api.datadoghq.com/api/v1/slo/search?query=Test-Search_for_SLOs_returns_OK_response-1664357958&page%5Bsize%5D=20&page%5Bnumber%5D=0\",\"prev\":null,\"last\":null,\"first\":\"https://api.datadoghq.com/api/v1/slo/search?query=Test-Search_for_SLOs_returns_OK_response-1664357958&page[number]=0&page[size]=20\"}}\n"
99+
"size": 1851,
100+
"text": "{\"data\":{\"type\":\"service_level_objective_search_results\",\"attributes\":{\"slos\":[{\"data\":{\"type\":\"slo\",\"attributes\":{\"monitor_ids\":null,\"all_tags\":[],\"thresholds\":[{\"warning_display\":\"95\",\"target_display\":\"95\",\"target\":95.0,\"warning\":98.0,\"timeframe\":\"7d\"}],\"env_tags\":[],\"groups\":null,\"timeframe\":\"7d\",\"overall_status\":[{\"error_budget_remaining\":null,\"raw_error_budget_remaining\":null,\"indexed_at\":1676409980,\"status\":null,\"span_precision\":null,\"error\":\"The denominator is zero valued\",\"target\":95.0,\"state\":\"no_data\",\"timeframe\":\"7d\"}],\"query\":{\"metrics\":null,\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\",\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\"},\"warning_threshold\":98.0,\"slo_type\":\"metric\",\"name\":\"Test-Search_for_SLOs_returns_OK_response-1676410539\",\"service_tags\":[],\"status\":{\"error_budget_remaining\":null,\"raw_error_budget_remaining\":null,\"indexed_at\":1676409980,\"span_precision\":null,\"state\":\"no_data\",\"sli\":null,\"calculation_error\":\"The denominator is zero valued\"},\"creator\":{\"name\":null,\"id\":1445416,\"email\":\"[email protected]\"},\"created_at\":1676364842,\"modified_at\":1676364842,\"description\":null,\"team_tags\":[],\"target_threshold\":95.0},\"id\":\"18101ab6982f547faba6c9bdc6de9413\"}}]}},\"meta\":{\"pagination\":{\"number\":0,\"first_number\":0,\"prev_number\":0,\"next_number\":1,\"last_number\":0,\"size\":20,\"type\":\"number_size\",\"total\":1}},\"links\":{\"self\":\"https://api.datadoghq.com/api/v1/slo/search?query=Test-Search_for_SLOs_returns_OK_response-1676410539&page%5Bsize%5D=20&page%5Bnumber%5D=0\",\"last\":null,\"next\":\"https://api.datadoghq.com/api/v1/slo/search?query=Test-Search_for_SLOs_returns_OK_response-1676410539&page[number]=1&page[size]=20\",\"prev\":null,\"first\":\"https://api.datadoghq.com/api/v1/slo/search?query=Test-Search_for_SLOs_returns_OK_response-1676410539&page[number]=0&page[size]=20\"}}\n"
101101
},
102102
"cookies": [],
103103
"headers": [
@@ -106,17 +106,17 @@
106106
"value": "application/json"
107107
}
108108
],
109-
"headersSize": 620,
109+
"headersSize": 621,
110110
"httpVersion": "HTTP/1.1",
111111
"redirectURL": "",
112112
"status": 200,
113113
"statusText": "OK"
114114
},
115-
"startedDateTime": "2022-09-28T09:39:20.823Z",
116-
"time": 480
115+
"startedDateTime": "2023-02-14T21:35:39.947Z",
116+
"time": 224
117117
},
118118
{
119-
"_id": "3f20ae90186fea9f9ca374fa44d311a9",
119+
"_id": "256cf1c7a7ee71aaad122b131b20ef56",
120120
"_order": 0,
121121
"cache": {},
122122
"request": {
@@ -133,14 +133,14 @@
133133
"httpVersion": "HTTP/1.1",
134134
"method": "DELETE",
135135
"queryString": [],
136-
"url": "https://api.datadoghq.com/api/v1/slo/3e0865c5301c5271a3b4345eb4f14074"
136+
"url": "https://api.datadoghq.com/api/v1/slo/34c97838f5c5578ebe812e5d068977a9"
137137
},
138138
"response": {
139139
"bodySize": 59,
140140
"content": {
141141
"mimeType": "application/json",
142142
"size": 59,
143-
"text": "{\"data\":[\"3e0865c5301c5271a3b4345eb4f14074\"],\"error\":null}\n"
143+
"text": "{\"data\":[\"34c97838f5c5578ebe812e5d068977a9\"],\"error\":null}\n"
144144
},
145145
"cookies": [],
146146
"headers": [
@@ -149,14 +149,14 @@
149149
"value": "application/json"
150150
}
151151
],
152-
"headersSize": 616,
152+
"headersSize": 617,
153153
"httpVersion": "HTTP/1.1",
154154
"redirectURL": "",
155155
"status": 200,
156156
"statusText": "OK"
157157
},
158-
"startedDateTime": "2022-09-28T09:39:21.320Z",
159-
"time": 568
158+
"startedDateTime": "2023-02-14T21:35:40.188Z",
159+
"time": 396
160160
}
161161
],
162162
"pages": [],

examples/v1/service-level-objectives/SearchSLO.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import { client, v1 } from "@datadog/datadog-api-client";
66

77
const configuration = client.createConfiguration();
8-
configuration.unstableOperations["v1.searchSLO"] = true;
98
const apiInstance = new v1.ServiceLevelObjectivesApi(configuration);
109

1110
// there is a valid "slo" in the system

features/v1/service_level_objectives.feature

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,22 +180,23 @@ Feature: Service Level Objectives
180180

181181
@generated @skip @team:DataDog/slo-app
182182
Scenario: Search for SLOs returns "Bad Request" response
183-
Given operation "SearchSLO" enabled
184-
And new "SearchSLO" request
183+
Given new "SearchSLO" request
185184
When the request is sent
186185
Then the response status is 400 Bad Request
187186

188187
@replay-only @team:DataDog/slo-app
189188
Scenario: Search for SLOs returns "OK" response
190189
Given there is a valid "slo" in the system
191-
And operation "SearchSLO" enabled
192190
And new "SearchSLO" request
193191
And request contains "query" parameter from "slo.data[0].name"
194192
And request contains "page[size]" parameter with value 20
195193
And request contains "page[number]" parameter with value 0
196194
When the request is sent
197195
Then the response status is 200 OK
198196
And the response "data.attributes.slos[0].data.attributes.name" is equal to "{{ slo.data[0].name }}"
197+
And the response "data.attributes.slos[0].data.attributes.overall_status[0].error_budget_remaining" is equal to null
198+
And the response "data.attributes.slos[0].data.attributes.overall_status[0].status" is equal to null
199+
And the response "data.attributes.slos[0].data.attributes.status.state" is equal to "no_data"
199200

200201
@team:DataDog/slo-app
201202
Scenario: Update an SLO returns "Bad Request" response

packages/datadog-api-client-common/configuration.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ export function createConfiguration(
114114
serverIndex: conf.serverIndex || 0,
115115
operationServerIndices: conf.operationServerIndices || {},
116116
unstableOperations: {
117-
"v1.searchSLO": false,
118117
"v2.listEvents": false,
119118
"v2.searchEvents": false,
120119
"v2.createIncident": false,

packages/datadog-api-client-v1/apis/ServiceLevelObjectivesApi.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,11 +430,6 @@ export class ServiceLevelObjectivesApiRequestFactory extends BaseAPIRequestFacto
430430
): Promise<RequestContext> {
431431
const _config = _options || this.configuration;
432432

433-
logger.warn("Using unstable operation 'searchSLO'");
434-
if (!_config.unstableOperations["v1.searchSLO"]) {
435-
throw new Error("Unstable operation 'searchSLO' is disabled");
436-
}
437-
438433
// Path Params
439434
const localVarPath = "/api/v1/slo/search";
440435

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,8 @@ export { SLOOverallStatuses } from "./models/SLOOverallStatuses";
762762
export { SLORawErrorBudgetRemaining } from "./models/SLORawErrorBudgetRemaining";
763763
export { SLOResponse } from "./models/SLOResponse";
764764
export { SLOResponseData } from "./models/SLOResponseData";
765+
export { SLOState } from "./models/SLOState";
766+
export { SLOStatus } from "./models/SLOStatus";
765767
export { SLOThreshold } from "./models/SLOThreshold";
766768
export { SLOTimeframe } from "./models/SLOTimeframe";
767769
export { SLOType } from "./models/SLOType";

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ import { SLOOverallStatuses } from "./SLOOverallStatuses";
304304
import { SLORawErrorBudgetRemaining } from "./SLORawErrorBudgetRemaining";
305305
import { SLOResponse } from "./SLOResponse";
306306
import { SLOResponseData } from "./SLOResponseData";
307+
import { SLOStatus } from "./SLOStatus";
307308
import { SLOThreshold } from "./SLOThreshold";
308309
import { SLOWidgetDefinition } from "./SLOWidgetDefinition";
309310
import { ScatterPlotRequest } from "./ScatterPlotRequest";
@@ -926,6 +927,7 @@ const enumsMap: { [key: string]: any[] } = {
926927
SLOErrorTimeframe: ["7d", "30d", "90d", "all"],
927928
SLOListWidgetDefinitionType: ["slo_list"],
928929
SLOListWidgetRequestType: ["slo_list"],
930+
SLOState: ["breached", "warning", "ok", "no_data"],
929931
SLOTimeframe: ["7d", "30d", "90d", "custom"],
930932
SLOType: ["metric", "monitor"],
931933
SLOTypeNumeric: [0, 1],
@@ -1704,6 +1706,7 @@ const typeMap: { [index: string]: any } = {
17041706
SLORawErrorBudgetRemaining: SLORawErrorBudgetRemaining,
17051707
SLOResponse: SLOResponse,
17061708
SLOResponseData: SLOResponseData,
1709+
SLOStatus: SLOStatus,
17071710
SLOThreshold: SLOThreshold,
17081711
SLOWidgetDefinition: SLOWidgetDefinition,
17091712
ScatterPlotRequest: ScatterPlotRequest,

0 commit comments

Comments
 (0)