From 66915a38b3ec473f88a188f4410efed02c50bcad Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Wed, 28 Dec 2022 16:32:40 +0000 Subject: [PATCH] Update API spec to allow primary timeframe, target, and warning (#963) Co-authored-by: ci.datadog-api-spec --- .apigentools-info | 8 +-- .generator/schemas/v1/openapi.yaml | 72 +++++++++++++++++++ .../frozen.json | 2 +- .../recording.har | 38 +++++----- .../frozen.json | 2 +- .../recording.har | 54 +++++++------- .../v1/service-level-objectives/CreateSLO.ts | 3 + .../v1/service-level-objectives/UpdateSLO.ts | 3 + features/v1/service_level_objectives.feature | 10 ++- .../models/SLOResponseData.ts | 31 ++++++++ .../models/ServiceLevelObjective.ts | 31 ++++++++ .../models/ServiceLevelObjectiveRequest.ts | 31 ++++++++ 12 files changed, 231 insertions(+), 54 deletions(-) diff --git a/.apigentools-info b/.apigentools-info index 4c0dd22194a..fe7999b4388 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2022-12-23 16:48:49.357745", - "spec_repo_commit": "1e3acf42" + "regenerated": "2022-12-28 16:10:46.984442", + "spec_repo_commit": "b2d7d94f" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2022-12-23 16:48:49.371587", - "spec_repo_commit": "1e3acf42" + "regenerated": "2022-12-28 16:10:46.996173", + "spec_repo_commit": "b2d7d94f" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index be1b545206d..5647ffe6cb7 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -9710,6 +9710,14 @@ components: description: A tag to apply to your SLO. type: string type: array + target_threshold: + description: 'The target threshold such that when the service level indicator + is above this + + threshold over the given timeframe, the objective is being met.' + example: 99.9 + format: double + type: number thresholds: description: 'The thresholds (timeframes and associated targets) for this service level @@ -9724,8 +9732,24 @@ components: items: $ref: '#/components/schemas/SLOThreshold' type: array + timeframe: + $ref: '#/components/schemas/SLOTimeframe' type: $ref: '#/components/schemas/SLOType' + warning_threshold: + description: 'The optional warning threshold such that when the service + level indicator is + + below this value for the given threshold, but above the target threshold, + the + + objective appears in a "warning" state. This value must be greater than + the target + + threshold.' + example: 99.95 + format: double + type: number type: object SLOThreshold: description: SLO thresholds (target and optionally warning) for a single time @@ -10609,6 +10633,14 @@ components: description: A tag to apply to your SLO. type: string type: array + target_threshold: + description: 'The target threshold such that when the service level indicator + is above this + + threshold over the given timeframe, the objective is being met.' + example: 99.9 + format: double + type: number thresholds: description: 'The thresholds (timeframes and associated targets) for this service level @@ -10623,8 +10655,24 @@ components: items: $ref: '#/components/schemas/SLOThreshold' type: array + timeframe: + $ref: '#/components/schemas/SLOTimeframe' type: $ref: '#/components/schemas/SLOType' + warning_threshold: + description: 'The optional warning threshold such that when the service + level indicator is + + below this value for the given threshold, but above the target threshold, + the + + objective appears in a "warning" state. This value must be greater than + the target + + threshold.' + example: 99.95 + format: double + type: number required: - name - thresholds @@ -10713,6 +10761,14 @@ components: description: A tag to apply to your SLO. type: string type: array + target_threshold: + description: 'The target threshold such that when the service level indicator + is above this + + threshold over the given timeframe, the objective is being met.' + example: 99.9 + format: double + type: number thresholds: description: 'The thresholds (timeframes and associated targets) for this service level @@ -10727,8 +10783,24 @@ components: items: $ref: '#/components/schemas/SLOThreshold' type: array + timeframe: + $ref: '#/components/schemas/SLOTimeframe' type: $ref: '#/components/schemas/SLOType' + warning_threshold: + description: 'The optional warning threshold such that when the service + level indicator is + + below this value for the given threshold, but above the target threshold, + the + + objective appears in a "warning" state. This value must be greater than + the target + + threshold.' + example: 99.95 + format: double + type: number required: - name - thresholds diff --git a/cassettes/v1/Service-Level-Objectives_139838558/Create-an-SLO-object-returns-OK-response_3282353469/frozen.json b/cassettes/v1/Service-Level-Objectives_139838558/Create-an-SLO-object-returns-OK-response_3282353469/frozen.json index 9be0f7fccd4..c9e202cb116 100644 --- a/cassettes/v1/Service-Level-Objectives_139838558/Create-an-SLO-object-returns-OK-response_3282353469/frozen.json +++ b/cassettes/v1/Service-Level-Objectives_139838558/Create-an-SLO-object-returns-OK-response_3282353469/frozen.json @@ -1 +1 @@ -"2022-01-06T00:51:10.554Z" +"2022-12-23T20:34:32.926Z" diff --git a/cassettes/v1/Service-Level-Objectives_139838558/Create-an-SLO-object-returns-OK-response_3282353469/recording.har b/cassettes/v1/Service-Level-Objectives_139838558/Create-an-SLO-object-returns-OK-response_3282353469/recording.har index dc650f248c9..6ba2465b9e1 100644 --- a/cassettes/v1/Service-Level-Objectives_139838558/Create-an-SLO-object-returns-OK-response_3282353469/recording.har +++ b/cassettes/v1/Service-Level-Objectives_139838558/Create-an-SLO-object-returns-OK-response_3282353469/recording.har @@ -8,11 +8,11 @@ }, "entries": [ { - "_id": "c1702e592dcf8b26ec59e9abad095683", + "_id": "f53f975c1b33bc09c44fca7bb9a8ea54", "_order": 0, "cache": {}, "request": { - "bodySize": 422, + "bodySize": 484, "cookies": [], "headers": [ { @@ -26,23 +26,23 @@ "value": "application/json" } ], - "headersSize": 463, + "headersSize": 547, "httpVersion": "HTTP/1.1", "method": "POST", "postData": { "mimeType": "application/json", "params": [], - "text": "{\"description\":\"string\",\"groups\":[\"env:test\",\"role:mysql\"],\"monitor_ids\":[],\"name\":\"Test-Create_an_SLO_object_returns_OK_response-1641430270\",\"query\":{\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\",\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\"},\"tags\":[\"env:prod\",\"app:core\"],\"thresholds\":[{\"target\":95,\"target_display\":\"95.0\",\"timeframe\":\"7d\",\"warning\":98,\"warning_display\":\"98.0\"}],\"type\":\"metric\"}" + "text": "{\"description\":\"string\",\"groups\":[\"env:test\",\"role:mysql\"],\"monitor_ids\":[],\"name\":\"Test-Create_an_SLO_object_returns_OK_response-1671827672\",\"query\":{\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\",\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\"},\"tags\":[\"env:prod\",\"app:core\"],\"target_threshold\":97,\"thresholds\":[{\"target\":95,\"target_display\":\"95.0\",\"timeframe\":\"7d\",\"warning\":98,\"warning_display\":\"98.0\"}],\"timeframe\":\"7d\",\"type\":\"metric\",\"warning_threshold\":98}" }, "queryString": [], "url": "https://api.datadoghq.com/api/v1/slo" }, "response": { - "bodySize": 633, + "bodySize": 696, "content": { "mimeType": "application/json", - "size": 633, - "text": "{\"data\":[{\"description\":\"string\",\"monitor_tags\":[],\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":null,\"email\":\"frog@datadoghq.com\"},\"thresholds\":[{\"warning\":98,\"warning_display\":\"98.\",\"target\":95,\"target_display\":\"95.\",\"timeframe\":\"7d\"}],\"groups\":[\"env:test\",\"role:mysql\"],\"type_id\":1,\"query\":{\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\",\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\"},\"id\":\"d5ee01d8ce6455ffb6f3acd3fa7df153\",\"name\":\"Test-Create_an_SLO_object_returns_OK_response-1641430270\",\"created_at\":1641430270,\"tags\":[\"app:core\",\"env:prod\"],\"modified_at\":1641430270,\"type\":\"metric\"}],\"error\":null}" + "size": 696, + "text": "{\"data\":[{\"id\":\"c7d81cbea88258f3a6a228901328e997\",\"name\":\"Test-Create_an_SLO_object_returns_OK_response-1671827672\",\"tags\":[\"env:prod\",\"app:core\"],\"monitor_tags\":[],\"thresholds\":[{\"timeframe\":\"7d\",\"target\":95.0,\"target_display\":\"95.\",\"warning\":98.0,\"warning_display\":\"98.\"}],\"type\":\"metric\",\"type_id\":1,\"description\":\"string\",\"timeframe\":\"7d\",\"warning_threshold\":98,\"target_threshold\":97,\"query\":{\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\",\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\"},\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"},\"created_at\":1671827673,\"modified_at\":1671827673,\"groups\":[\"env:test\",\"role:mysql\"]}],\"error\":null}\n" }, "cookies": [], "headers": [ @@ -51,17 +51,17 @@ "value": "application/json" } ], - "headersSize": 512, + "headersSize": 619, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-01-06T00:51:10.557Z", - "time": 181 + "startedDateTime": "2022-12-23T20:34:32.948Z", + "time": 597 }, { - "_id": "ccb5271ec0cc82dbf8aedbed85177055", + "_id": "921dc25e64fd749c68dc6e54224d67e5", "_order": 0, "cache": {}, "request": { @@ -74,18 +74,18 @@ "value": "application/json" } ], - "headersSize": 445, + "headersSize": 528, "httpVersion": "HTTP/1.1", "method": "DELETE", "queryString": [], - "url": "https://api.datadoghq.com/api/v1/slo/d5ee01d8ce6455ffb6f3acd3fa7df153" + "url": "https://api.datadoghq.com/api/v1/slo/c7d81cbea88258f3a6a228901328e997" }, "response": { - "bodySize": 58, + "bodySize": 59, "content": { "mimeType": "application/json", - "size": 58, - "text": "{\"data\":[\"d5ee01d8ce6455ffb6f3acd3fa7df153\"],\"error\":null}" + "size": 59, + "text": "{\"data\":[\"c7d81cbea88258f3a6a228901328e997\"],\"error\":null}\n" }, "cookies": [], "headers": [ @@ -94,14 +94,14 @@ "value": "application/json" } ], - "headersSize": 513, + "headersSize": 616, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-01-06T00:51:10.741Z", - "time": 223 + "startedDateTime": "2022-12-23T20:34:33.579Z", + "time": 485 } ], "pages": [], diff --git a/cassettes/v1/Service-Level-Objectives_139838558/Update-an-SLO-returns-OK-response_1448646901/frozen.json b/cassettes/v1/Service-Level-Objectives_139838558/Update-an-SLO-returns-OK-response_1448646901/frozen.json index 0795c37f43b..1b708e43096 100644 --- a/cassettes/v1/Service-Level-Objectives_139838558/Update-an-SLO-returns-OK-response_1448646901/frozen.json +++ b/cassettes/v1/Service-Level-Objectives_139838558/Update-an-SLO-returns-OK-response_1448646901/frozen.json @@ -1 +1 @@ -"2022-03-08T14:18:15.700Z" +"2022-12-23T20:34:34.100Z" diff --git a/cassettes/v1/Service-Level-Objectives_139838558/Update-an-SLO-returns-OK-response_1448646901/recording.har b/cassettes/v1/Service-Level-Objectives_139838558/Update-an-SLO-returns-OK-response_1448646901/recording.har index 20d82935e42..6e5f9627708 100644 --- a/cassettes/v1/Service-Level-Objectives_139838558/Update-an-SLO-returns-OK-response_1448646901/recording.har +++ b/cassettes/v1/Service-Level-Objectives_139838558/Update-an-SLO-returns-OK-response_1448646901/recording.har @@ -8,7 +8,7 @@ }, "entries": [ { - "_id": "e08bddef994240f6252cf083390fcd8f", + "_id": "e3d0ca7b430053338d4e766d78e5dc69", "_order": 0, "cache": {}, "request": { @@ -26,23 +26,23 @@ "value": "application/json" } ], - "headersSize": 547, + "headersSize": 545, "httpVersion": "HTTP/1.1", "method": "POST", "postData": { "mimeType": "application/json", "params": [], - "text": "{\"name\":\"Test-Update_an_SLO_returns_OK_response-1646749095\",\"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\"}" + "text": "{\"name\":\"Test-Update_an_SLO_returns_OK_response-1671827674\",\"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\"}" }, "queryString": [], "url": "https://api.datadoghq.com/api/v1/slo" }, "response": { - "bodySize": 564, + "bodySize": 627, "content": { "mimeType": "application/json", - "size": 564, - "text": "{\"data\":[{\"description\":\"\",\"monitor_tags\":[],\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":null,\"email\":\"frog@datadoghq.com\"},\"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\":\"75d6eadff5155234a11fcf7be783e170\",\"name\":\"Test-Update_an_SLO_returns_OK_response-1646749095\",\"created_at\":1646749096,\"tags\":[],\"modified_at\":1646749096,\"type\":\"metric\"}],\"error\":null}" + "size": 627, + "text": "{\"data\":[{\"id\":\"9ca3260165e5524bb05029ae2cf52ceb\",\"name\":\"Test-Update_an_SLO_returns_OK_response-1671827674\",\"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\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"},\"created_at\":1671827674,\"modified_at\":1671827674}],\"error\":null}\n" }, "cookies": [], "headers": [ @@ -51,21 +51,21 @@ "value": "application/json" } ], - "headersSize": 662, + "headersSize": 619, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-03-08T14:18:15.718Z", - "time": 721 + "startedDateTime": "2022-12-23T20:34:34.105Z", + "time": 491 }, { - "_id": "8f0f1f344c6e52be7c13c8b5c1b151cf", + "_id": "b10bbeec221844ebd52885a99984e8d8", "_order": 0, "cache": {}, "request": { - "bodySize": 260, + "bodySize": 322, "cookies": [], "headers": [ { @@ -85,17 +85,17 @@ "postData": { "mimeType": "application/json", "params": [], - "text": "{\"name\":\"Test-Update_an_SLO_returns_OK_response-1646749095\",\"query\":{\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\",\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\"},\"thresholds\":[{\"target\":97,\"timeframe\":\"7d\",\"warning\":98}],\"type\":\"metric\"}" + "text": "{\"name\":\"Test-Update_an_SLO_returns_OK_response-1671827674\",\"query\":{\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\",\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\"},\"target_threshold\":97,\"thresholds\":[{\"target\":97,\"timeframe\":\"7d\",\"warning\":98}],\"timeframe\":\"7d\",\"type\":\"metric\",\"warning_threshold\":98}" }, "queryString": [], - "url": "https://api.datadoghq.com/api/v1/slo/75d6eadff5155234a11fcf7be783e170" + "url": "https://api.datadoghq.com/api/v1/slo/9ca3260165e5524bb05029ae2cf52ceb" }, "response": { - "bodySize": 564, + "bodySize": 627, "content": { "mimeType": "application/json", - "size": 564, - "text": "{\"data\":[{\"description\":\"\",\"monitor_tags\":[],\"creator\":{\"handle\":\"frog@datadoghq.com\",\"name\":null,\"email\":\"frog@datadoghq.com\"},\"thresholds\":[{\"warning\":98.0,\"warning_display\":\"98.\",\"target\":97.0,\"target_display\":\"97.\",\"timeframe\":\"7d\"}],\"type_id\":1,\"query\":{\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\",\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\"},\"id\":\"75d6eadff5155234a11fcf7be783e170\",\"name\":\"Test-Update_an_SLO_returns_OK_response-1646749095\",\"created_at\":1646749096,\"tags\":[],\"modified_at\":1646749097,\"type\":\"metric\"}],\"error\":null}" + "size": 627, + "text": "{\"data\":[{\"id\":\"9ca3260165e5524bb05029ae2cf52ceb\",\"name\":\"Test-Update_an_SLO_returns_OK_response-1671827674\",\"tags\":[],\"monitor_tags\":[],\"thresholds\":[{\"timeframe\":\"7d\",\"target\":97.0,\"target_display\":\"97.\",\"warning\":98.0,\"warning_display\":\"98.\"}],\"type\":\"metric\",\"type_id\":1,\"description\":\"\",\"timeframe\":\"7d\",\"warning_threshold\":98,\"target_threshold\":97,\"query\":{\"denominator\":\"sum:httpservice.hits{!code:3xx}.as_count()\",\"numerator\":\"sum:httpservice.hits{code:2xx}.as_count()\"},\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\"},\"created_at\":1671827674,\"modified_at\":1671827674}],\"error\":null}\n" }, "cookies": [], "headers": [ @@ -104,17 +104,17 @@ "value": "application/json" } ], - "headersSize": 662, + "headersSize": 619, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-03-08T14:18:16.449Z", - "time": 847 + "startedDateTime": "2022-12-23T20:34:34.604Z", + "time": 441 }, { - "_id": "f3b348cc80bdc0e4be8c073bcfc74db2", + "_id": "1be489288bc8cdf3222e25662faab76e", "_order": 0, "cache": {}, "request": { @@ -131,14 +131,14 @@ "httpVersion": "HTTP/1.1", "method": "DELETE", "queryString": [], - "url": "https://api.datadoghq.com/api/v1/slo/75d6eadff5155234a11fcf7be783e170" + "url": "https://api.datadoghq.com/api/v1/slo/9ca3260165e5524bb05029ae2cf52ceb" }, "response": { - "bodySize": 58, + "bodySize": 59, "content": { "mimeType": "application/json", - "size": 58, - "text": "{\"data\":[\"75d6eadff5155234a11fcf7be783e170\"],\"error\":null}" + "size": 59, + "text": "{\"data\":[\"9ca3260165e5524bb05029ae2cf52ceb\"],\"error\":null}\n" }, "cookies": [], "headers": [ @@ -147,14 +147,14 @@ "value": "application/json" } ], - "headersSize": 662, + "headersSize": 616, "httpVersion": "HTTP/1.1", "redirectURL": "", "status": 200, "statusText": "OK" }, - "startedDateTime": "2022-03-08T14:18:17.306Z", - "time": 546 + "startedDateTime": "2022-12-23T20:34:35.054Z", + "time": 421 } ], "pages": [], diff --git a/examples/v1/service-level-objectives/CreateSLO.ts b/examples/v1/service-level-objectives/CreateSLO.ts index fb6fb5715fd..3dbb26d4e8c 100644 --- a/examples/v1/service-level-objectives/CreateSLO.ts +++ b/examples/v1/service-level-objectives/CreateSLO.ts @@ -28,6 +28,9 @@ const params: v1.ServiceLevelObjectivesApiCreateSLORequest = { warningDisplay: "98.0", }, ], + timeframe: "7d", + targetThreshold: 97.0, + warningThreshold: 98, }, }; diff --git a/examples/v1/service-level-objectives/UpdateSLO.ts b/examples/v1/service-level-objectives/UpdateSLO.ts index 790c3169056..3e9c0fe497a 100644 --- a/examples/v1/service-level-objectives/UpdateSLO.ts +++ b/examples/v1/service-level-objectives/UpdateSLO.ts @@ -22,6 +22,9 @@ const params: v1.ServiceLevelObjectivesApiUpdateSLORequest = { warning: 98.0, }, ], + timeframe: "7d", + targetThreshold: 97.0, + warningThreshold: 98, query: { numerator: "sum:httpservice.hits{code:2xx}.as_count()", denominator: "sum:httpservice.hits{!code:3xx}.as_count()", diff --git a/features/v1/service_level_objectives.feature b/features/v1/service_level_objectives.feature index a211f5f042e..14e89c44265 100644 --- a/features/v1/service_level_objectives.feature +++ b/features/v1/service_level_objectives.feature @@ -58,9 +58,12 @@ Feature: Service Level Objectives @team:DataDog/slo-app Scenario: Create an SLO object returns "OK" response Given new "CreateSLO" request - And body with value {"type":"metric","description":"string","groups":["env:test","role:mysql"],"monitor_ids":[],"name":"{{ unique }}","query":{"denominator":"sum:httpservice.hits{!code:3xx}.as_count()","numerator":"sum:httpservice.hits{code:2xx}.as_count()"},"tags":["env:prod","app:core"],"thresholds":[{"target":95.0,"target_display":"95.0","timeframe":"7d","warning":98,"warning_display":"98.0"}]} + And body with value {"type":"metric","description":"string","groups":["env:test","role:mysql"],"monitor_ids":[],"name":"{{ unique }}","query":{"denominator":"sum:httpservice.hits{!code:3xx}.as_count()","numerator":"sum:httpservice.hits{code:2xx}.as_count()"},"tags":["env:prod","app:core"],"thresholds":[{"target":95.0,"target_display":"95.0","timeframe":"7d","warning":98,"warning_display":"98.0"}],"timeframe":"7d","target_threshold":97.0,"warning_threshold":98} When the request is sent Then the response status is 200 OK + And the response "data[0].timeframe" is equal to "7d" + And the response "data[0].target_threshold" is equal to 97.0 + And the response "data[0].warning_threshold" is equal to 98.0 @generated @skip @team:DataDog/slo-app Scenario: Delete an SLO returns "Conflict" response @@ -216,7 +219,10 @@ Feature: Service Level Objectives Given there is a valid "slo" in the system And new "UpdateSLO" request And request contains "slo_id" parameter from "slo.data[0].id" - And body with value {"type":"metric","name":"{{ slo.data[0].name }}","thresholds":[{"target":97.0,"timeframe":"7d","warning":98.0}],"query":{"numerator":"sum:httpservice.hits{code:2xx}.as_count()","denominator":"sum:httpservice.hits{!code:3xx}.as_count()"}} + And body with value {"type":"metric","name":"{{ slo.data[0].name }}","thresholds":[{"target":97.0,"timeframe":"7d","warning":98.0}],"timeframe":"7d","target_threshold":97.0,"warning_threshold":98,"query":{"numerator":"sum:httpservice.hits{code:2xx}.as_count()","denominator":"sum:httpservice.hits{!code:3xx}.as_count()"}} When the request is sent Then the response status is 200 OK And the response "data[0].thresholds[0].target" is equal to 97.0 + And the response "data[0].timeframe" is equal to "7d" + And the response "data[0].target_threshold" is equal to 97.0 + And the response "data[0].warning_threshold" is equal to 98.0 diff --git a/packages/datadog-api-client-v1/models/SLOResponseData.ts b/packages/datadog-api-client-v1/models/SLOResponseData.ts index 4dfe44cd8b3..67f101d35e0 100644 --- a/packages/datadog-api-client-v1/models/SLOResponseData.ts +++ b/packages/datadog-api-client-v1/models/SLOResponseData.ts @@ -6,6 +6,7 @@ import { Creator } from "./Creator"; import { ServiceLevelObjectiveQuery } from "./ServiceLevelObjectiveQuery"; import { SLOThreshold } from "./SLOThreshold"; +import { SLOTimeframe } from "./SLOTimeframe"; import { SLOType } from "./SLOType"; import { AttributeTypeMap } from "../../datadog-api-client-common/util"; @@ -86,15 +87,31 @@ export class SLOResponseData { * Optional in create/update requests. */ "tags"?: Array; + /** + * The target threshold such that when the service level indicator is above this + * threshold over the given timeframe, the objective is being met. + */ + "targetThreshold"?: number; /** * The thresholds (timeframes and associated targets) for this service level * objective object. */ "thresholds"?: Array; + /** + * The SLO time window options. + */ + "timeframe"?: SLOTimeframe; /** * The type of the service level objective. */ "type"?: SLOType; + /** + * The optional warning threshold such that when the service level indicator is + * below this value for the given threshold, but above the target threshold, the + * objective appears in a "warning" state. This value must be greater than the target + * threshold. + */ + "warningThreshold"?: number; /** * @ignore @@ -157,14 +174,28 @@ export class SLOResponseData { baseName: "tags", type: "Array", }, + targetThreshold: { + baseName: "target_threshold", + type: "number", + format: "double", + }, thresholds: { baseName: "thresholds", type: "Array", }, + timeframe: { + baseName: "timeframe", + type: "SLOTimeframe", + }, type: { baseName: "type", type: "SLOType", }, + warningThreshold: { + baseName: "warning_threshold", + type: "number", + format: "double", + }, }; /** diff --git a/packages/datadog-api-client-v1/models/ServiceLevelObjective.ts b/packages/datadog-api-client-v1/models/ServiceLevelObjective.ts index 458ee1bd674..e3f3396f1cd 100644 --- a/packages/datadog-api-client-v1/models/ServiceLevelObjective.ts +++ b/packages/datadog-api-client-v1/models/ServiceLevelObjective.ts @@ -6,6 +6,7 @@ import { Creator } from "./Creator"; import { ServiceLevelObjectiveQuery } from "./ServiceLevelObjectiveQuery"; import { SLOThreshold } from "./SLOThreshold"; +import { SLOTimeframe } from "./SLOTimeframe"; import { SLOType } from "./SLOType"; import { AttributeTypeMap } from "../../datadog-api-client-common/util"; @@ -82,15 +83,31 @@ export class ServiceLevelObjective { * Optional in create/update requests. */ "tags"?: Array; + /** + * The target threshold such that when the service level indicator is above this + * threshold over the given timeframe, the objective is being met. + */ + "targetThreshold"?: number; /** * The thresholds (timeframes and associated targets) for this service level * objective object. */ "thresholds": Array; + /** + * The SLO time window options. + */ + "timeframe"?: SLOTimeframe; /** * The type of the service level objective. */ "type": SLOType; + /** + * The optional warning threshold such that when the service level indicator is + * below this value for the given threshold, but above the target threshold, the + * objective appears in a "warning" state. This value must be greater than the target + * threshold. + */ + "warningThreshold"?: number; /** * @ignore @@ -149,16 +166,30 @@ export class ServiceLevelObjective { baseName: "tags", type: "Array", }, + targetThreshold: { + baseName: "target_threshold", + type: "number", + format: "double", + }, thresholds: { baseName: "thresholds", type: "Array", required: true, }, + timeframe: { + baseName: "timeframe", + type: "SLOTimeframe", + }, type: { baseName: "type", type: "SLOType", required: true, }, + warningThreshold: { + baseName: "warning_threshold", + type: "number", + format: "double", + }, }; /** diff --git a/packages/datadog-api-client-v1/models/ServiceLevelObjectiveRequest.ts b/packages/datadog-api-client-v1/models/ServiceLevelObjectiveRequest.ts index b764623b83f..cba04494233 100644 --- a/packages/datadog-api-client-v1/models/ServiceLevelObjectiveRequest.ts +++ b/packages/datadog-api-client-v1/models/ServiceLevelObjectiveRequest.ts @@ -5,6 +5,7 @@ */ import { ServiceLevelObjectiveQuery } from "./ServiceLevelObjectiveQuery"; import { SLOThreshold } from "./SLOThreshold"; +import { SLOTimeframe } from "./SLOTimeframe"; import { SLOType } from "./SLOType"; import { AttributeTypeMap } from "../../datadog-api-client-common/util"; @@ -50,15 +51,31 @@ export class ServiceLevelObjectiveRequest { * Optional in create/update requests. */ "tags"?: Array; + /** + * The target threshold such that when the service level indicator is above this + * threshold over the given timeframe, the objective is being met. + */ + "targetThreshold"?: number; /** * The thresholds (timeframes and associated targets) for this service level * objective object. */ "thresholds": Array; + /** + * The SLO time window options. + */ + "timeframe"?: SLOTimeframe; /** * The type of the service level objective. */ "type": SLOType; + /** + * The optional warning threshold such that when the service level indicator is + * below this value for the given threshold, but above the target threshold, the + * objective appears in a "warning" state. This value must be greater than the target + * threshold. + */ + "warningThreshold"?: number; /** * @ignore @@ -95,16 +112,30 @@ export class ServiceLevelObjectiveRequest { baseName: "tags", type: "Array", }, + targetThreshold: { + baseName: "target_threshold", + type: "number", + format: "double", + }, thresholds: { baseName: "thresholds", type: "Array", required: true, }, + timeframe: { + baseName: "timeframe", + type: "SLOTimeframe", + }, type: { baseName: "type", type: "SLOType", required: true, }, + warningThreshold: { + baseName: "warning_threshold", + type: "number", + format: "double", + }, }; /**