From 7eb84e1f138231915583a8bb3528e28349b79229 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 5 Jan 2024 15:10:07 +0000 Subject: [PATCH] Regenerate client from commit 9cbf6566 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v1/openapi.yaml | 136 ++++++++++++++++++ docs/datadog_api_client.v1.model.rst | 49 +++++++ .../CreateSLO_3765703239.py | 67 +++++++++ .../v1/model/service_level_objective.py | 11 ++ .../model/service_level_objective_request.py | 11 ++ .../model/slo_data_source_query_definition.py | 49 +++++++ .../v1/model/slo_formula.py | 33 +++++ .../v1/model/slo_response_data.py | 11 ++ .../v1/model/slo_sli_spec.py | 39 +++++ .../v1/model/slo_time_slice_comparator.py | 44 ++++++ .../v1/model/slo_time_slice_condition.py | 55 +++++++ .../v1/model/slo_time_slice_query.py | 63 ++++++++ .../v1/model/slo_time_slice_spec.py | 41 ++++++ src/datadog_api_client/v1/model/slo_type.py | 5 +- .../v1/model/slo_type_numeric.py | 5 +- src/datadog_api_client/v1/models/__init__.py | 14 ++ ...lice_slo_object_returns_ok_response.frozen | 1 + ...eslice_slo_object_returns_ok_response.yaml | 40 ++++++ ...object_returns_bad_request_response.frozen | 2 +- ...o_object_returns_bad_request_response.yaml | 2 +- ...e_an_slo_object_returns_ok_response.frozen | 2 +- ...ate_an_slo_object_returns_ok_response.yaml | 8 +- ...e_an_slo_returns_not_found_response.frozen | 2 +- ...ete_an_slo_returns_not_found_response.yaml | 4 +- ...t_delete_an_slo_returns_ok_response.frozen | 2 +- ...est_delete_an_slo_returns_ok_response.yaml | 16 ++- ...st_get_all_slos_returns_ok_response.frozen | 2 +- ...test_get_all_slos_returns_ok_response.yaml | 18 ++- ...an_slos_details_returns_ok_response.frozen | 2 +- ...t_an_slos_details_returns_ok_response.yaml | 18 ++- ...an_slos_history_returns_ok_response.frozen | 2 +- ...t_an_slos_history_returns_ok_response.yaml | 26 ++-- ...ions_for_an_slo_returns_ok_response.frozen | 2 +- ...ctions_for_an_slo_returns_ok_response.yaml | 34 +++-- ...an_slo_returns_bad_request_response.frozen | 2 +- ...e_an_slo_returns_bad_request_response.yaml | 16 ++- ...t_update_an_slo_returns_ok_response.frozen | 2 +- ...est_update_an_slo_returns_ok_response.yaml | 14 +- .../features/service_level_objectives.feature | 12 +- 40 files changed, 793 insertions(+), 77 deletions(-) create mode 100644 examples/v1/service-level-objectives/CreateSLO_3765703239.py create mode 100644 src/datadog_api_client/v1/model/slo_data_source_query_definition.py create mode 100644 src/datadog_api_client/v1/model/slo_formula.py create mode 100644 src/datadog_api_client/v1/model/slo_sli_spec.py create mode 100644 src/datadog_api_client/v1/model/slo_time_slice_comparator.py create mode 100644 src/datadog_api_client/v1/model/slo_time_slice_condition.py create mode 100644 src/datadog_api_client/v1/model/slo_time_slice_query.py create mode 100644 src/datadog_api_client/v1/model/slo_time_slice_spec.py create mode 100644 tests/v1/cassettes/test_scenarios/test_create_a_timeslice_slo_object_returns_ok_response.frozen create mode 100644 tests/v1/cassettes/test_scenarios/test_create_a_timeslice_slo_object_returns_ok_response.yaml diff --git a/.apigentools-info b/.apigentools-info index 8fccaf333a..c47c5d1474 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-01-04 15:18:08.876360", - "spec_repo_commit": "e7cfa56f" + "regenerated": "2024-01-05 15:09:31.771541", + "spec_repo_commit": "9cbf6566" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-01-04 15:18:08.899971", - "spec_repo_commit": "e7cfa56f" + "regenerated": "2024-01-05 15:09:31.789729", + "spec_repo_commit": "9cbf6566" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index e35aca8635..d0eb91e2ec 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -10244,6 +10244,13 @@ components: nullable: true type: string type: object + SLODataSourceQueryDefinition: + description: A formula and function query. + example: + data_source: metrics + query: sum:trace.servlet.request.hits{*} by {env}.as_count() + oneOf: + - $ref: '#/components/schemas/FormulaAndFunctionMetricQueryDefinition' SLODeleteResponse: description: A response list of all service level objective deleted. properties: @@ -10287,6 +10294,20 @@ components: - THIRTY_DAYS - NINETY_DAYS - ALL + SLOFormula: + description: A formula that specifies how to combine the results of multiple + queries. + example: + formula: query1 - default_zero(query2) + properties: + formula: + description: The formula string, which is an expression involving named + queries. + example: query1 - default_zero(query2) + type: string + required: + - formula + type: object SLOHistoryMetrics: description: 'A `metric` based SLO history response. @@ -11016,6 +11037,8 @@ components: type: string query: $ref: '#/components/schemas/ServiceLevelObjectiveQuery' + sli_specification: + $ref: '#/components/schemas/SLOSliSpec' tags: description: 'A list of tags associated with this service level objective. @@ -11070,6 +11093,11 @@ components: format: double type: number type: object + SLOSliSpec: + description: A generic SLI specification. This is currently used for time-slice + SLOs only. + oneOf: + - $ref: '#/components/schemas/SLOTimeSliceSpec' SLOState: description: State of the SLO. enum: @@ -11170,6 +11198,106 @@ components: - timeframe - target type: object + SLOTimeSliceComparator: + description: The comparator used to compare the SLI value to the threshold. + enum: + - '>' + - '>=' + - < + - <= + example: '>' + type: string + x-enum-varnames: + - GREATER + - GREATER_EQUAL + - LESS + - LESS_EQUAL + SLOTimeSliceCondition: + description: 'The time-slice condition, composed of 3 parts: 1. the metric timeseries + query, 2. the comparator, + + and 3. the threshold.' + example: + 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 + properties: + comparator: + $ref: '#/components/schemas/SLOTimeSliceComparator' + query: + $ref: '#/components/schemas/SLOTimeSliceQuery' + threshold: + description: The threshold value to which each SLI value will be compared. + example: 5 + format: double + type: number + required: + - comparator + - threshold + - query + type: object + SLOTimeSliceQuery: + description: The queries and formula used to calculate the SLI value. + example: + 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() + properties: + formulas: + description: A list that contains exactly one formula, as only a single + formula may be used in a time-slice SLO. + items: + $ref: '#/components/schemas/SLOFormula' + maxItems: 1 + minItems: 1 + type: array + queries: + description: A list of queries that are used to calculate the SLI value. + items: + $ref: '#/components/schemas/SLODataSourceQueryDefinition' + type: array + required: + - formulas + - queries + type: object + SLOTimeSliceSpec: + additionalProperties: false + description: A time-slice SLI specification. + example: + 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 + properties: + time_slice: + $ref: '#/components/schemas/SLOTimeSliceCondition' + required: + - time_slice + type: object SLOTimeframe: description: The SLO time window options. enum: @@ -11189,11 +11317,13 @@ components: enum: - metric - monitor + - time_slice example: metric type: string x-enum-varnames: - METRIC - MONITOR + - TIME_SLICE SLOTypeNumeric: description: 'A numeric representation of the type of the service level objective (`0` for @@ -11204,12 +11334,14 @@ components: enum: - 0 - 1 + - 2 example: 0 format: int32 type: integer x-enum-varnames: - MONITOR - METRIC + - TIME_SLICE SLOWidgetDefinition: description: Use the SLO and uptime widget to track your SLOs (Service Level Objectives) and uptime on screenboards and timeboards. @@ -12019,6 +12151,8 @@ components: type: string query: $ref: '#/components/schemas/ServiceLevelObjectiveQuery' + sli_specification: + $ref: '#/components/schemas/SLOSliSpec' tags: description: 'A list of tags associated with this service level objective. @@ -12148,6 +12282,8 @@ components: type: string query: $ref: '#/components/schemas/ServiceLevelObjectiveQuery' + sli_specification: + $ref: '#/components/schemas/SLOSliSpec' tags: description: 'A list of tags associated with this service level objective. diff --git a/docs/datadog_api_client.v1.model.rst b/docs/datadog_api_client.v1.model.rst index 45ce6404d6..3201930ab2 100644 --- a/docs/datadog_api_client.v1.model.rst +++ b/docs/datadog_api_client.v1.model.rst @@ -3333,6 +3333,13 @@ slo\_creator :members: :show-inheritance: +slo\_data\_source\_query\_definition +------------------------------------ + +.. automodule:: datadog_api_client.v1.model.slo_data_source_query_definition + :members: + :show-inheritance: + slo\_delete\_response --------------------- @@ -3354,6 +3361,13 @@ slo\_error\_timeframe :members: :show-inheritance: +slo\_formula +------------ + +.. automodule:: datadog_api_client.v1.model.slo_formula + :members: + :show-inheritance: + slo\_history\_metrics --------------------- @@ -3508,6 +3522,13 @@ slo\_response\_data :members: :show-inheritance: +slo\_sli\_spec +-------------- + +.. automodule:: datadog_api_client.v1.model.slo_sli_spec + :members: + :show-inheritance: + slo\_state ---------- @@ -3529,6 +3550,34 @@ slo\_threshold :members: :show-inheritance: +slo\_time\_slice\_comparator +---------------------------- + +.. automodule:: datadog_api_client.v1.model.slo_time_slice_comparator + :members: + :show-inheritance: + +slo\_time\_slice\_condition +--------------------------- + +.. automodule:: datadog_api_client.v1.model.slo_time_slice_condition + :members: + :show-inheritance: + +slo\_time\_slice\_query +----------------------- + +.. automodule:: datadog_api_client.v1.model.slo_time_slice_query + :members: + :show-inheritance: + +slo\_time\_slice\_spec +---------------------- + +.. automodule:: datadog_api_client.v1.model.slo_time_slice_spec + :members: + :show-inheritance: + slo\_timeframe -------------- diff --git a/examples/v1/service-level-objectives/CreateSLO_3765703239.py b/examples/v1/service-level-objectives/CreateSLO_3765703239.py new file mode 100644 index 0000000000..b1eba066b3 --- /dev/null +++ b/examples/v1/service-level-objectives/CreateSLO_3765703239.py @@ -0,0 +1,67 @@ +""" +Create a time-slice SLO object returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v1.api.service_level_objectives_api import ServiceLevelObjectivesApi +from datadog_api_client.v1.model.formula_and_function_metric_data_source import FormulaAndFunctionMetricDataSource +from datadog_api_client.v1.model.formula_and_function_metric_query_definition import ( + FormulaAndFunctionMetricQueryDefinition, +) +from datadog_api_client.v1.model.service_level_objective_request import ServiceLevelObjectiveRequest +from datadog_api_client.v1.model.slo_formula import SLOFormula +from datadog_api_client.v1.model.slo_threshold import SLOThreshold +from datadog_api_client.v1.model.slo_time_slice_comparator import SLOTimeSliceComparator +from datadog_api_client.v1.model.slo_time_slice_condition import SLOTimeSliceCondition +from datadog_api_client.v1.model.slo_time_slice_query import SLOTimeSliceQuery +from datadog_api_client.v1.model.slo_time_slice_spec import SLOTimeSliceSpec +from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe +from datadog_api_client.v1.model.slo_type import SLOType + +body = ServiceLevelObjectiveRequest( + type=SLOType.TIME_SLICE, + description="string", + name="Example-Service-Level-Objective", + sli_specification=SLOTimeSliceSpec( + time_slice=SLOTimeSliceCondition( + query=SLOTimeSliceQuery( + formulas=[ + SLOFormula( + formula="query1", + ), + ], + queries=[ + FormulaAndFunctionMetricQueryDefinition( + data_source=FormulaAndFunctionMetricDataSource.METRICS, + name="query1", + query="trace.servlet.request{env:prod}", + ), + ], + ), + comparator=SLOTimeSliceComparator.GREATER, + threshold=5.0, + ), + ), + tags=[ + "env:prod", + ], + thresholds=[ + SLOThreshold( + target=97.0, + target_display="97.0", + timeframe=SLOTimeframe.SEVEN_DAYS, + warning=98.0, + warning_display="98.0", + ), + ], + timeframe=SLOTimeframe.SEVEN_DAYS, + target_threshold=97.0, + warning_threshold=98.0, +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ServiceLevelObjectivesApi(api_client) + response = api_instance.create_slo(body=body) + + print(response) diff --git a/src/datadog_api_client/v1/model/service_level_objective.py b/src/datadog_api_client/v1/model/service_level_objective.py index ba61c1c0a4..d23cad7efc 100644 --- a/src/datadog_api_client/v1/model/service_level_objective.py +++ b/src/datadog_api_client/v1/model/service_level_objective.py @@ -17,9 +17,11 @@ if TYPE_CHECKING: from datadog_api_client.v1.model.creator import Creator from datadog_api_client.v1.model.service_level_objective_query import ServiceLevelObjectiveQuery + from datadog_api_client.v1.model.slo_sli_spec import SLOSliSpec from datadog_api_client.v1.model.slo_threshold import SLOThreshold from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe from datadog_api_client.v1.model.slo_type import SLOType + from datadog_api_client.v1.model.slo_time_slice_spec import SLOTimeSliceSpec class ServiceLevelObjective(ModelNormal): @@ -27,6 +29,7 @@ class ServiceLevelObjective(ModelNormal): def openapi_types(_): from datadog_api_client.v1.model.creator import Creator from datadog_api_client.v1.model.service_level_objective_query import ServiceLevelObjectiveQuery + from datadog_api_client.v1.model.slo_sli_spec import SLOSliSpec from datadog_api_client.v1.model.slo_threshold import SLOThreshold from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe from datadog_api_client.v1.model.slo_type import SLOType @@ -42,6 +45,7 @@ def openapi_types(_): "monitor_tags": ([str],), "name": (str,), "query": (ServiceLevelObjectiveQuery,), + "sli_specification": (SLOSliSpec,), "tags": ([str],), "target_threshold": (float,), "thresholds": ([SLOThreshold],), @@ -61,6 +65,7 @@ def openapi_types(_): "monitor_tags": "monitor_tags", "name": "name", "query": "query", + "sli_specification": "sli_specification", "tags": "tags", "target_threshold": "target_threshold", "thresholds": "thresholds", @@ -89,6 +94,7 @@ def __init__( monitor_ids: Union[List[int], UnsetType] = unset, monitor_tags: Union[List[str], UnsetType] = unset, query: Union[ServiceLevelObjectiveQuery, UnsetType] = unset, + sli_specification: Union[SLOSliSpec, SLOTimeSliceSpec, UnsetType] = unset, tags: Union[List[str], UnsetType] = unset, target_threshold: Union[float, UnsetType] = unset, timeframe: Union[SLOTimeframe, UnsetType] = unset, @@ -150,6 +156,9 @@ def __init__( min of all of those requests. :type query: ServiceLevelObjectiveQuery, optional + :param sli_specification: A generic SLI specification. This is currently used for time-slice SLOs only. + :type sli_specification: SLOSliSpec, optional + :param tags: A list of tags associated with this service level objective. Always included in service level objective responses (but may be empty). Optional in create/update requests. @@ -193,6 +202,8 @@ def __init__( kwargs["monitor_tags"] = monitor_tags if query is not unset: kwargs["query"] = query + if sli_specification is not unset: + kwargs["sli_specification"] = sli_specification if tags is not unset: kwargs["tags"] = tags if target_threshold is not unset: diff --git a/src/datadog_api_client/v1/model/service_level_objective_request.py b/src/datadog_api_client/v1/model/service_level_objective_request.py index 64710f2247..23680bd625 100644 --- a/src/datadog_api_client/v1/model/service_level_objective_request.py +++ b/src/datadog_api_client/v1/model/service_level_objective_request.py @@ -16,15 +16,18 @@ if TYPE_CHECKING: from datadog_api_client.v1.model.service_level_objective_query import ServiceLevelObjectiveQuery + from datadog_api_client.v1.model.slo_sli_spec import SLOSliSpec from datadog_api_client.v1.model.slo_threshold import SLOThreshold from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe from datadog_api_client.v1.model.slo_type import SLOType + from datadog_api_client.v1.model.slo_time_slice_spec import SLOTimeSliceSpec class ServiceLevelObjectiveRequest(ModelNormal): @cached_property def openapi_types(_): from datadog_api_client.v1.model.service_level_objective_query import ServiceLevelObjectiveQuery + from datadog_api_client.v1.model.slo_sli_spec import SLOSliSpec from datadog_api_client.v1.model.slo_threshold import SLOThreshold from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe from datadog_api_client.v1.model.slo_type import SLOType @@ -35,6 +38,7 @@ def openapi_types(_): "monitor_ids": ([int],), "name": (str,), "query": (ServiceLevelObjectiveQuery,), + "sli_specification": (SLOSliSpec,), "tags": ([str],), "target_threshold": (float,), "thresholds": ([SLOThreshold],), @@ -49,6 +53,7 @@ def openapi_types(_): "monitor_ids": "monitor_ids", "name": "name", "query": "query", + "sli_specification": "sli_specification", "tags": "tags", "target_threshold": "target_threshold", "thresholds": "thresholds", @@ -66,6 +71,7 @@ def __init__( groups: Union[List[str], UnsetType] = unset, monitor_ids: Union[List[int], UnsetType] = unset, query: Union[ServiceLevelObjectiveQuery, UnsetType] = unset, + sli_specification: Union[SLOSliSpec, SLOTimeSliceSpec, UnsetType] = unset, tags: Union[List[str], UnsetType] = unset, target_threshold: Union[float, UnsetType] = unset, timeframe: Union[SLOTimeframe, UnsetType] = unset, @@ -101,6 +107,9 @@ def __init__( min of all of those requests. :type query: ServiceLevelObjectiveQuery, optional + :param sli_specification: A generic SLI specification. This is currently used for time-slice SLOs only. + :type sli_specification: SLOSliSpec, optional + :param tags: A list of tags associated with this service level objective. Always included in service level objective responses (but may be empty). Optional in create/update requests. @@ -134,6 +143,8 @@ def __init__( kwargs["monitor_ids"] = monitor_ids if query is not unset: kwargs["query"] = query + if sli_specification is not unset: + kwargs["sli_specification"] = sli_specification if tags is not unset: kwargs["tags"] = tags if target_threshold is not unset: diff --git a/src/datadog_api_client/v1/model/slo_data_source_query_definition.py b/src/datadog_api_client/v1/model/slo_data_source_query_definition.py new file mode 100644 index 0000000000..6fc35bbdb8 --- /dev/null +++ b/src/datadog_api_client/v1/model/slo_data_source_query_definition.py @@ -0,0 +1,49 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelComposed, + cached_property, +) + + +class SLODataSourceQueryDefinition(ModelComposed): + def __init__(self, **kwargs): + """ + A formula and function query. + + :param aggregator: The aggregation methods available for metrics queries. + :type aggregator: FormulaAndFunctionMetricAggregation, optional + + :param data_source: Data source for metrics queries. + :type data_source: FormulaAndFunctionMetricDataSource + + :param name: Name of the query for use in formulas. + :type name: str + + :param query: Metrics query definition. + :type query: str + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v1.model.formula_and_function_metric_query_definition import ( + FormulaAndFunctionMetricQueryDefinition, + ) + + return { + "oneOf": [ + FormulaAndFunctionMetricQueryDefinition, + ], + } diff --git a/src/datadog_api_client/v1/model/slo_formula.py b/src/datadog_api_client/v1/model/slo_formula.py new file mode 100644 index 0000000000..79ea7cbf45 --- /dev/null +++ b/src/datadog_api_client/v1/model/slo_formula.py @@ -0,0 +1,33 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class SLOFormula(ModelNormal): + @cached_property + def openapi_types(_): + return { + "formula": (str,), + } + + attribute_map = { + "formula": "formula", + } + + def __init__(self_, formula: str, **kwargs): + """ + A formula that specifies how to combine the results of multiple queries. + + :param formula: The formula string, which is an expression involving named queries. + :type formula: str + """ + super().__init__(kwargs) + + self_.formula = formula diff --git a/src/datadog_api_client/v1/model/slo_response_data.py b/src/datadog_api_client/v1/model/slo_response_data.py index 54e8c331e6..f04e495b2b 100644 --- a/src/datadog_api_client/v1/model/slo_response_data.py +++ b/src/datadog_api_client/v1/model/slo_response_data.py @@ -17,9 +17,11 @@ if TYPE_CHECKING: from datadog_api_client.v1.model.creator import Creator from datadog_api_client.v1.model.service_level_objective_query import ServiceLevelObjectiveQuery + from datadog_api_client.v1.model.slo_sli_spec import SLOSliSpec from datadog_api_client.v1.model.slo_threshold import SLOThreshold from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe from datadog_api_client.v1.model.slo_type import SLOType + from datadog_api_client.v1.model.slo_time_slice_spec import SLOTimeSliceSpec class SLOResponseData(ModelNormal): @@ -27,6 +29,7 @@ class SLOResponseData(ModelNormal): def openapi_types(_): from datadog_api_client.v1.model.creator import Creator from datadog_api_client.v1.model.service_level_objective_query import ServiceLevelObjectiveQuery + from datadog_api_client.v1.model.slo_sli_spec import SLOSliSpec from datadog_api_client.v1.model.slo_threshold import SLOThreshold from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe from datadog_api_client.v1.model.slo_type import SLOType @@ -43,6 +46,7 @@ def openapi_types(_): "monitor_tags": ([str],), "name": (str,), "query": (ServiceLevelObjectiveQuery,), + "sli_specification": (SLOSliSpec,), "tags": ([str],), "target_threshold": (float,), "thresholds": ([SLOThreshold],), @@ -63,6 +67,7 @@ def openapi_types(_): "monitor_tags": "monitor_tags", "name": "name", "query": "query", + "sli_specification": "sli_specification", "tags": "tags", "target_threshold": "target_threshold", "thresholds": "thresholds", @@ -90,6 +95,7 @@ def __init__( monitor_tags: Union[List[str], UnsetType] = unset, name: Union[str, UnsetType] = unset, query: Union[ServiceLevelObjectiveQuery, UnsetType] = unset, + sli_specification: Union[SLOSliSpec, SLOTimeSliceSpec, UnsetType] = unset, tags: Union[List[str], UnsetType] = unset, target_threshold: Union[float, UnsetType] = unset, thresholds: Union[List[SLOThreshold], UnsetType] = unset, @@ -156,6 +162,9 @@ def __init__( min of all of those requests. :type query: ServiceLevelObjectiveQuery, optional + :param sli_specification: A generic SLI specification. This is currently used for time-slice SLOs only. + :type sli_specification: SLOSliSpec, optional + :param tags: A list of tags associated with this service level objective. Always included in service level objective responses (but may be empty). Optional in create/update requests. @@ -203,6 +212,8 @@ def __init__( kwargs["name"] = name if query is not unset: kwargs["query"] = query + if sli_specification is not unset: + kwargs["sli_specification"] = sli_specification if tags is not unset: kwargs["tags"] = tags if target_threshold is not unset: diff --git a/src/datadog_api_client/v1/model/slo_sli_spec.py b/src/datadog_api_client/v1/model/slo_sli_spec.py new file mode 100644 index 0000000000..eddd4e0e78 --- /dev/null +++ b/src/datadog_api_client/v1/model/slo_sli_spec.py @@ -0,0 +1,39 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelComposed, + cached_property, +) + + +class SLOSliSpec(ModelComposed): + def __init__(self, **kwargs): + """ + A generic SLI specification. This is currently used for time-slice SLOs only. + + :param time_slice: The time-slice condition, composed of 3 parts: 1. the metric timeseries query, 2. the comparator, + and 3. the threshold. + :type time_slice: SLOTimeSliceCondition + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v1.model.slo_time_slice_spec import SLOTimeSliceSpec + + return { + "oneOf": [ + SLOTimeSliceSpec, + ], + } diff --git a/src/datadog_api_client/v1/model/slo_time_slice_comparator.py b/src/datadog_api_client/v1/model/slo_time_slice_comparator.py new file mode 100644 index 0000000000..6ec4c3780a --- /dev/null +++ b/src/datadog_api_client/v1/model/slo_time_slice_comparator.py @@ -0,0 +1,44 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class SLOTimeSliceComparator(ModelSimple): + """ + The comparator used to compare the SLI value to the threshold. + + :param value: Must be one of [">", ">=", "<", "<="]. + :type value: str + """ + + allowed_values = { + ">", + ">=", + "<", + "<=", + } + GREATER: ClassVar["SLOTimeSliceComparator"] + GREATER_EQUAL: ClassVar["SLOTimeSliceComparator"] + LESS: ClassVar["SLOTimeSliceComparator"] + LESS_EQUAL: ClassVar["SLOTimeSliceComparator"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +SLOTimeSliceComparator.GREATER = SLOTimeSliceComparator(">") +SLOTimeSliceComparator.GREATER_EQUAL = SLOTimeSliceComparator(">=") +SLOTimeSliceComparator.LESS = SLOTimeSliceComparator("<") +SLOTimeSliceComparator.LESS_EQUAL = SLOTimeSliceComparator("<=") diff --git a/src/datadog_api_client/v1/model/slo_time_slice_condition.py b/src/datadog_api_client/v1/model/slo_time_slice_condition.py new file mode 100644 index 0000000000..2f3666908c --- /dev/null +++ b/src/datadog_api_client/v1/model/slo_time_slice_condition.py @@ -0,0 +1,55 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.slo_time_slice_comparator import SLOTimeSliceComparator + from datadog_api_client.v1.model.slo_time_slice_query import SLOTimeSliceQuery + + +class SLOTimeSliceCondition(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.slo_time_slice_comparator import SLOTimeSliceComparator + from datadog_api_client.v1.model.slo_time_slice_query import SLOTimeSliceQuery + + return { + "comparator": (SLOTimeSliceComparator,), + "query": (SLOTimeSliceQuery,), + "threshold": (float,), + } + + attribute_map = { + "comparator": "comparator", + "query": "query", + "threshold": "threshold", + } + + def __init__(self_, comparator: SLOTimeSliceComparator, query: SLOTimeSliceQuery, threshold: float, **kwargs): + """ + The time-slice condition, composed of 3 parts: 1. the metric timeseries query, 2. the comparator, + and 3. the threshold. + + :param comparator: The comparator used to compare the SLI value to the threshold. + :type comparator: SLOTimeSliceComparator + + :param query: The queries and formula used to calculate the SLI value. + :type query: SLOTimeSliceQuery + + :param threshold: The threshold value to which each SLI value will be compared. + :type threshold: float + """ + super().__init__(kwargs) + + self_.comparator = comparator + self_.query = query + self_.threshold = threshold diff --git a/src/datadog_api_client/v1/model/slo_time_slice_query.py b/src/datadog_api_client/v1/model/slo_time_slice_query.py new file mode 100644 index 0000000000..8b62eb3685 --- /dev/null +++ b/src/datadog_api_client/v1/model/slo_time_slice_query.py @@ -0,0 +1,63 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.slo_formula import SLOFormula + from datadog_api_client.v1.model.slo_data_source_query_definition import SLODataSourceQueryDefinition + from datadog_api_client.v1.model.formula_and_function_metric_query_definition import ( + FormulaAndFunctionMetricQueryDefinition, + ) + + +class SLOTimeSliceQuery(ModelNormal): + validations = { + "formulas": { + "max_items": 1, + "min_items": 1, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.slo_formula import SLOFormula + from datadog_api_client.v1.model.slo_data_source_query_definition import SLODataSourceQueryDefinition + + return { + "formulas": ([SLOFormula],), + "queries": ([SLODataSourceQueryDefinition],), + } + + attribute_map = { + "formulas": "formulas", + "queries": "queries", + } + + def __init__( + self_, + formulas: List[SLOFormula], + queries: List[Union[SLODataSourceQueryDefinition, FormulaAndFunctionMetricQueryDefinition]], + **kwargs, + ): + """ + The queries and formula used to calculate the SLI value. + + :param formulas: A list that contains exactly one formula, as only a single formula may be used in a time-slice SLO. + :type formulas: [SLOFormula] + + :param queries: A list of queries that are used to calculate the SLI value. + :type queries: [SLODataSourceQueryDefinition] + """ + super().__init__(kwargs) + + self_.formulas = formulas + self_.queries = queries diff --git a/src/datadog_api_client/v1/model/slo_time_slice_spec.py b/src/datadog_api_client/v1/model/slo_time_slice_spec.py new file mode 100644 index 0000000000..18b9df5a25 --- /dev/null +++ b/src/datadog_api_client/v1/model/slo_time_slice_spec.py @@ -0,0 +1,41 @@ +# 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 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.slo_time_slice_condition import SLOTimeSliceCondition + + +class SLOTimeSliceSpec(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.slo_time_slice_condition import SLOTimeSliceCondition + + return { + "time_slice": (SLOTimeSliceCondition,), + } + + attribute_map = { + "time_slice": "time_slice", + } + + def __init__(self_, time_slice: SLOTimeSliceCondition, **kwargs): + """ + A time-slice SLI specification. + + :param time_slice: The time-slice condition, composed of 3 parts: 1. the metric timeseries query, 2. the comparator, + and 3. the threshold. + :type time_slice: SLOTimeSliceCondition + """ + super().__init__(kwargs) + + self_.time_slice = time_slice diff --git a/src/datadog_api_client/v1/model/slo_type.py b/src/datadog_api_client/v1/model/slo_type.py index bde47e6a96..bc02fd629a 100644 --- a/src/datadog_api_client/v1/model/slo_type.py +++ b/src/datadog_api_client/v1/model/slo_type.py @@ -16,16 +16,18 @@ class SLOType(ModelSimple): """ The type of the service level objective. - :param value: Must be one of ["metric", "monitor"]. + :param value: Must be one of ["metric", "monitor", "time_slice"]. :type value: str """ allowed_values = { "metric", "monitor", + "time_slice", } METRIC: ClassVar["SLOType"] MONITOR: ClassVar["SLOType"] + TIME_SLICE: ClassVar["SLOType"] @cached_property def openapi_types(_): @@ -36,3 +38,4 @@ def openapi_types(_): SLOType.METRIC = SLOType("metric") SLOType.MONITOR = SLOType("monitor") +SLOType.TIME_SLICE = SLOType("time_slice") diff --git a/src/datadog_api_client/v1/model/slo_type_numeric.py b/src/datadog_api_client/v1/model/slo_type_numeric.py index b0beb3fbd9..3ff607d229 100644 --- a/src/datadog_api_client/v1/model/slo_type_numeric.py +++ b/src/datadog_api_client/v1/model/slo_type_numeric.py @@ -18,16 +18,18 @@ class SLOTypeNumeric(ModelSimple): monitor, `1` for metric). Always included in service level objective responses. Ignored in create/update requests. - :param value: Must be one of [0, 1]. + :param value: Must be one of [0, 1, 2]. :type value: int """ allowed_values = { 0, 1, + 2, } MONITOR: ClassVar["SLOTypeNumeric"] METRIC: ClassVar["SLOTypeNumeric"] + TIME_SLICE: ClassVar["SLOTypeNumeric"] @cached_property def openapi_types(_): @@ -38,3 +40,4 @@ def openapi_types(_): SLOTypeNumeric.MONITOR = SLOTypeNumeric(0) SLOTypeNumeric.METRIC = SLOTypeNumeric(1) +SLOTypeNumeric.TIME_SLICE = SLOTypeNumeric(2) diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index 6a9285b70a..dcda89e108 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -483,9 +483,11 @@ from datadog_api_client.v1.model.slo_correction_update_request import SLOCorrectionUpdateRequest from datadog_api_client.v1.model.slo_correction_update_request_attributes import SLOCorrectionUpdateRequestAttributes from datadog_api_client.v1.model.slo_creator import SLOCreator +from datadog_api_client.v1.model.slo_data_source_query_definition import SLODataSourceQueryDefinition from datadog_api_client.v1.model.slo_delete_response import SLODeleteResponse from datadog_api_client.v1.model.slo_error_budget_remaining_data import SLOErrorBudgetRemainingData from datadog_api_client.v1.model.slo_error_timeframe import SLOErrorTimeframe +from datadog_api_client.v1.model.slo_formula import SLOFormula from datadog_api_client.v1.model.slo_history_metrics import SLOHistoryMetrics from datadog_api_client.v1.model.slo_history_metrics_series import SLOHistoryMetricsSeries from datadog_api_client.v1.model.slo_history_metrics_series_metadata import SLOHistoryMetricsSeriesMetadata @@ -508,9 +510,14 @@ from datadog_api_client.v1.model.slo_raw_error_budget_remaining import SLORawErrorBudgetRemaining from datadog_api_client.v1.model.slo_response import SLOResponse from datadog_api_client.v1.model.slo_response_data import SLOResponseData +from datadog_api_client.v1.model.slo_sli_spec import SLOSliSpec from datadog_api_client.v1.model.slo_state import SLOState from datadog_api_client.v1.model.slo_status import SLOStatus from datadog_api_client.v1.model.slo_threshold import SLOThreshold +from datadog_api_client.v1.model.slo_time_slice_comparator import SLOTimeSliceComparator +from datadog_api_client.v1.model.slo_time_slice_condition import SLOTimeSliceCondition +from datadog_api_client.v1.model.slo_time_slice_query import SLOTimeSliceQuery +from datadog_api_client.v1.model.slo_time_slice_spec import SLOTimeSliceSpec from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe from datadog_api_client.v1.model.slo_type import SLOType from datadog_api_client.v1.model.slo_type_numeric import SLOTypeNumeric @@ -1381,9 +1388,11 @@ "SLOCorrectionUpdateRequest", "SLOCorrectionUpdateRequestAttributes", "SLOCreator", + "SLODataSourceQueryDefinition", "SLODeleteResponse", "SLOErrorBudgetRemainingData", "SLOErrorTimeframe", + "SLOFormula", "SLOHistoryMetrics", "SLOHistoryMetricsSeries", "SLOHistoryMetricsSeriesMetadata", @@ -1406,9 +1415,14 @@ "SLORawErrorBudgetRemaining", "SLOResponse", "SLOResponseData", + "SLOSliSpec", "SLOState", "SLOStatus", "SLOThreshold", + "SLOTimeSliceComparator", + "SLOTimeSliceCondition", + "SLOTimeSliceQuery", + "SLOTimeSliceSpec", "SLOTimeframe", "SLOType", "SLOTypeNumeric", diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_timeslice_slo_object_returns_ok_response.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_timeslice_slo_object_returns_ok_response.frozen new file mode 100644 index 0000000000..0d30f46814 --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_a_timeslice_slo_object_returns_ok_response.frozen @@ -0,0 +1 @@ +2024-01-03T22:54:44.816Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_timeslice_slo_object_returns_ok_response.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_timeslice_slo_object_returns_ok_response.yaml new file mode 100644 index 0000000000..0373bdc9ed --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_a_timeslice_slo_object_returns_ok_response.yaml @@ -0,0 +1,40 @@ +interactions: +- request: + body: '{"description":"string","name":"Test-Create_a_time_slice_SLO_object_returns_OK_response-1704322484","sli_specification":{"time_slice":{"comparator":">","query":{"formulas":[{"formula":"query1"}],"queries":[{"data_source":"metrics","name":"query1","query":"trace.servlet.request{env:prod}"}]},"threshold":5}},"tags":["env:prod"],"target_threshold":97,"thresholds":[{"target":97,"target_display":"97.0","timeframe":"7d","warning":98,"warning_display":"98.0"}],"timeframe":"7d","type":"time_slice","warning_threshold":98}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/slo + response: + body: + string: '{"data":[{"id":"776b80141eda520bbfae33e897849f61","name":"Test-Create_a_time_slice_SLO_object_returns_OK_response-1704322484","tags":["env:prod"],"monitor_tags":[],"thresholds":[{"timeframe":"7d","target":97.0,"target_display":"97.","warning":98.0,"warning_display":"98."}],"type":"time_slice","type_id":2,"description":"string","timeframe":"7d","warning_threshold":98,"target_threshold":97,"creator":{"name":null,"handle":"frog@datadoghq.com","email":"frog@datadoghq.com"},"created_at":1704322485,"modified_at":1704322485,"sli_specification":{"time_slice":{"comparator":">","query":{"formulas":[{"formula":"query1"}],"queries":[{"data_source":"metrics","name":"query1","query":"trace.servlet.request{env:prod}"}]},"threshold":5,"query_interval_seconds":300}}}],"error":null} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/slo/776b80141eda520bbfae33e897849f61 + response: + body: + string: '{"data":["776b80141eda520bbfae33e897849f61"],"error":null} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v1/cassettes/test_scenarios/test_create_an_slo_object_returns_bad_request_response.frozen b/tests/v1/cassettes/test_scenarios/test_create_an_slo_object_returns_bad_request_response.frozen index 04ad7cb742..931d2be7c2 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_an_slo_object_returns_bad_request_response.frozen +++ b/tests/v1/cassettes/test_scenarios/test_create_an_slo_object_returns_bad_request_response.frozen @@ -1 +1 @@ -2022-01-06T00:51:10.351Z \ No newline at end of file +2024-01-03T22:54:45.312Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_an_slo_object_returns_bad_request_response.yaml b/tests/v1/cassettes/test_scenarios/test_create_an_slo_object_returns_bad_request_response.yaml index f30952f65c..d6712daf40 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_an_slo_object_returns_bad_request_response.yaml +++ b/tests/v1/cassettes/test_scenarios/test_create_an_slo_object_returns_bad_request_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"name":"Test-Create_an_SLO_object_returns_Bad_Request_response-1641430270","thresholds":[{"target":95,"target_display":"95.0","timeframe":"7d","warning":98,"warning_display":"98.0"}],"type":"monitor"}' + body: '{"name":"Test-Create_an_SLO_object_returns_Bad_Request_response-1704322485","thresholds":[{"target":95,"target_display":"95.0","timeframe":"7d","warning":98,"warning_display":"98.0"}],"type":"monitor"}' headers: accept: - application/json diff --git a/tests/v1/cassettes/test_scenarios/test_create_an_slo_object_returns_ok_response.frozen b/tests/v1/cassettes/test_scenarios/test_create_an_slo_object_returns_ok_response.frozen index c04d9ebdbc..4c19057022 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_an_slo_object_returns_ok_response.frozen +++ b/tests/v1/cassettes/test_scenarios/test_create_an_slo_object_returns_ok_response.frozen @@ -1 +1 @@ -2023-01-26T10:51:10.970Z \ No newline at end of file +2024-01-03T22:54:45.425Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_an_slo_object_returns_ok_response.yaml b/tests/v1/cassettes/test_scenarios/test_create_an_slo_object_returns_ok_response.yaml index 4c11e317f3..3d888642b6 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_an_slo_object_returns_ok_response.yaml +++ b/tests/v1/cassettes/test_scenarios/test_create_an_slo_object_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"description":"string","groups":["env:test","role:mysql"],"monitor_ids":[],"name":"Test-Create_an_SLO_object_returns_OK_response-1674730270","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":97,"target_display":"97.0","timeframe":"7d","warning":98,"warning_display":"98.0"}],"timeframe":"7d","type":"metric","warning_threshold":98}' + body: '{"description":"string","groups":["env:test","role:mysql"],"monitor_ids":[],"name":"Test-Create_an_SLO_object_returns_OK_response-1704322485","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":97,"target_display":"97.0","timeframe":"7d","warning":98,"warning_display":"98.0"}],"timeframe":"7d","type":"metric","warning_threshold":98}' headers: accept: - application/json @@ -10,7 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v1/slo response: body: - string: '{"data":[{"id":"fbad7e9ce0aa5a32aa14224b91c699c6","name":"Test-Create_an_SLO_object_returns_OK_response-1674730270","tags":["env:prod","app:core"],"monitor_tags":[],"thresholds":[{"timeframe":"7d","target":97.0,"target_display":"97.","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":1674730271,"modified_at":1674730271,"groups":["env:test","role:mysql"]}],"error":null} + string: '{"data":[{"id":"6a3ffb99fc285f4f947ccf83d888558b","name":"Test-Create_an_SLO_object_returns_OK_response-1704322485","tags":["app:core","env:prod"],"monitor_tags":[],"thresholds":[{"timeframe":"7d","target":97.0,"target_display":"97.","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":1704322485,"modified_at":1704322485,"groups":["env:test","role:mysql"]}],"error":null} ' headers: @@ -25,10 +25,10 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/slo/fbad7e9ce0aa5a32aa14224b91c699c6 + uri: https://api.datadoghq.com/api/v1/slo/6a3ffb99fc285f4f947ccf83d888558b response: body: - string: '{"data":["fbad7e9ce0aa5a32aa14224b91c699c6"],"error":null} + string: '{"data":["6a3ffb99fc285f4f947ccf83d888558b"],"error":null} ' headers: diff --git a/tests/v1/cassettes/test_scenarios/test_delete_an_slo_returns_not_found_response.frozen b/tests/v1/cassettes/test_scenarios/test_delete_an_slo_returns_not_found_response.frozen index f99e15030d..b861a89a73 100644 --- a/tests/v1/cassettes/test_scenarios/test_delete_an_slo_returns_not_found_response.frozen +++ b/tests/v1/cassettes/test_scenarios/test_delete_an_slo_returns_not_found_response.frozen @@ -1 +1 @@ -2022-01-06T00:51:10.974Z \ No newline at end of file +2024-01-03T22:54:45.952Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_delete_an_slo_returns_not_found_response.yaml b/tests/v1/cassettes/test_scenarios/test_delete_an_slo_returns_not_found_response.yaml index f43a2c62b8..f39303e4f6 100644 --- a/tests/v1/cassettes/test_scenarios/test_delete_an_slo_returns_not_found_response.yaml +++ b/tests/v1/cassettes/test_scenarios/test_delete_an_slo_returns_not_found_response.yaml @@ -5,10 +5,10 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/slo/testdeleteansloreturnsnotfoundresponse1641430270 + uri: https://api.datadoghq.com/api/v1/slo/testdeleteansloreturnsnotfoundresponse1704322485 response: body: - string: '{"errors":["SLO not found: testdeleteansloreturnsnotfoundresponse1641430270 + string: '{"errors":["SLO not found: testdeleteansloreturnsnotfoundresponse1704322485 not found"]}' headers: content-type: diff --git a/tests/v1/cassettes/test_scenarios/test_delete_an_slo_returns_ok_response.frozen b/tests/v1/cassettes/test_scenarios/test_delete_an_slo_returns_ok_response.frozen index f998a181ae..84e1b4e444 100644 --- a/tests/v1/cassettes/test_scenarios/test_delete_an_slo_returns_ok_response.frozen +++ b/tests/v1/cassettes/test_scenarios/test_delete_an_slo_returns_ok_response.frozen @@ -1 +1 @@ -2022-01-06T00:51:11.158Z \ No newline at end of file +2024-01-03T22:54:46.108Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_delete_an_slo_returns_ok_response.yaml b/tests/v1/cassettes/test_scenarios/test_delete_an_slo_returns_ok_response.yaml index 0635dd3f60..aa5f0532c6 100644 --- a/tests/v1/cassettes/test_scenarios/test_delete_an_slo_returns_ok_response.yaml +++ b/tests/v1/cassettes/test_scenarios/test_delete_an_slo_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"name":"Test-Delete_an_SLO_returns_OK_response-1641430271","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"}' + body: '{"name":"Test-Delete_an_SLO_returns_OK_response-1704322486","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"}' headers: accept: - application/json @@ -10,7 +10,9 @@ interactions: uri: https://api.datadoghq.com/api/v1/slo response: body: - string: '{"data":[{"description":"","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"}],"type_id":1,"query":{"denominator":"sum:httpservice.hits{!code:3xx}.as_count()","numerator":"sum:httpservice.hits{code:2xx}.as_count()"},"id":"7c7a8700d1125ac99aa0ffa12f686b89","name":"Test-Delete_an_SLO_returns_OK_response-1641430271","created_at":1641430271,"tags":[],"modified_at":1641430271,"type":"metric"}],"error":null}' + string: '{"data":[{"id":"6065f42541b856f3abaf255e6a61de79","name":"Test-Delete_an_SLO_returns_OK_response-1704322486","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":1704322486,"modified_at":1704322486}],"error":null} + + ' headers: content-type: - application/json @@ -23,10 +25,12 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/slo/7c7a8700d1125ac99aa0ffa12f686b89 + uri: https://api.datadoghq.com/api/v1/slo/6065f42541b856f3abaf255e6a61de79 response: body: - string: '{"data":["7c7a8700d1125ac99aa0ffa12f686b89"],"error":null}' + string: '{"data":["6065f42541b856f3abaf255e6a61de79"],"error":null} + + ' headers: content-type: - application/json @@ -39,10 +43,10 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/slo/7c7a8700d1125ac99aa0ffa12f686b89 + uri: https://api.datadoghq.com/api/v1/slo/6065f42541b856f3abaf255e6a61de79 response: body: - string: '{"errors":["SLO not found: 7c7a8700d1125ac99aa0ffa12f686b89 not found"]}' + string: '{"errors":["SLO not found: 6065f42541b856f3abaf255e6a61de79 not found"]}' headers: content-type: - application/json diff --git a/tests/v1/cassettes/test_scenarios/test_get_all_slos_returns_ok_response.frozen b/tests/v1/cassettes/test_scenarios/test_get_all_slos_returns_ok_response.frozen index fb6bf3e09d..8d2d61c2b8 100644 --- a/tests/v1/cassettes/test_scenarios/test_get_all_slos_returns_ok_response.frozen +++ b/tests/v1/cassettes/test_scenarios/test_get_all_slos_returns_ok_response.frozen @@ -1 +1 @@ -2022-03-08T14:09:49.857Z \ No newline at end of file +2024-01-03T22:54:47.632Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_get_all_slos_returns_ok_response.yaml b/tests/v1/cassettes/test_scenarios/test_get_all_slos_returns_ok_response.yaml index b8b3ab5fdd..ee8272252e 100644 --- a/tests/v1/cassettes/test_scenarios/test_get_all_slos_returns_ok_response.yaml +++ b/tests/v1/cassettes/test_scenarios/test_get_all_slos_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"name":"Test-Get_all_SLOs_returns_OK_response-1646748589","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"}' + body: '{"name":"Test-Get_all_SLOs_returns_OK_response-1704322487","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"}' headers: accept: - application/json @@ -10,7 +10,9 @@ interactions: uri: https://api.datadoghq.com/api/v1/slo response: body: - string: '{"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":"11b6985a7e135c529ea6e1d02d742dd8","name":"Test-Get_all_SLOs_returns_OK_response-1646748589","created_at":1646748590,"tags":[],"modified_at":1646748590,"type":"metric"}],"error":null}' + string: '{"data":[{"id":"c2ce7fb6030c5c0b8035d1ce94dec12c","name":"Test-Get_all_SLOs_returns_OK_response-1704322487","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":1704322487,"modified_at":1704322487}],"error":null} + + ' headers: content-type: - application/json @@ -23,10 +25,12 @@ interactions: accept: - application/json method: GET - uri: https://api.datadoghq.com/api/v1/slo?ids=11b6985a7e135c529ea6e1d02d742dd8 + uri: https://api.datadoghq.com/api/v1/slo?ids=c2ce7fb6030c5c0b8035d1ce94dec12c response: body: - string: '{"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":"11b6985a7e135c529ea6e1d02d742dd8","name":"Test-Get_all_SLOs_returns_OK_response-1646748589","created_at":1646748590,"tags":[],"modified_at":1646748590,"type":"metric"}],"error":null}' + string: '{"data":[{"id":"c2ce7fb6030c5c0b8035d1ce94dec12c","name":"Test-Get_all_SLOs_returns_OK_response-1704322487","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.0,"target_threshold":95.0,"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":1704322487,"modified_at":1704322487}],"error":null} + + ' headers: content-type: - application/json @@ -39,10 +43,12 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/slo/11b6985a7e135c529ea6e1d02d742dd8 + uri: https://api.datadoghq.com/api/v1/slo/c2ce7fb6030c5c0b8035d1ce94dec12c response: body: - string: '{"data":["11b6985a7e135c529ea6e1d02d742dd8"],"error":null}' + string: '{"data":["c2ce7fb6030c5c0b8035d1ce94dec12c"],"error":null} + + ' headers: content-type: - application/json diff --git a/tests/v1/cassettes/test_scenarios/test_get_an_slos_details_returns_ok_response.frozen b/tests/v1/cassettes/test_scenarios/test_get_an_slos_details_returns_ok_response.frozen index 34aad93e40..02d09fae47 100644 --- a/tests/v1/cassettes/test_scenarios/test_get_an_slos_details_returns_ok_response.frozen +++ b/tests/v1/cassettes/test_scenarios/test_get_an_slos_details_returns_ok_response.frozen @@ -1 +1 @@ -2022-03-08T13:51:10.786Z \ No newline at end of file +2024-01-03T22:54:48.137Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_get_an_slos_details_returns_ok_response.yaml b/tests/v1/cassettes/test_scenarios/test_get_an_slos_details_returns_ok_response.yaml index 87647b392f..b3694753ac 100644 --- a/tests/v1/cassettes/test_scenarios/test_get_an_slos_details_returns_ok_response.yaml +++ b/tests/v1/cassettes/test_scenarios/test_get_an_slos_details_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"name":"Test-Get_an_SLO_s_details_returns_OK_response-1646747470","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"}' + body: '{"name":"Test-Get_an_SLO_s_details_returns_OK_response-1704322488","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"}' headers: accept: - application/json @@ -10,7 +10,9 @@ interactions: uri: https://api.datadoghq.com/api/v1/slo response: body: - string: '{"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":"152e72d970e15e799e4b195d7193ed18","name":"Test-Get_an_SLO_s_details_returns_OK_response-1646747470","created_at":1646747471,"tags":[],"modified_at":1646747471,"type":"metric"}],"error":null}' + string: '{"data":[{"id":"ebf2e048f49a5134b61a586438c66505","name":"Test-Get_an_SLO_s_details_returns_OK_response-1704322488","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":1704322488,"modified_at":1704322488}],"error":null} + + ' headers: content-type: - application/json @@ -23,10 +25,12 @@ interactions: accept: - application/json method: GET - uri: https://api.datadoghq.com/api/v1/slo/152e72d970e15e799e4b195d7193ed18 + uri: https://api.datadoghq.com/api/v1/slo/ebf2e048f49a5134b61a586438c66505 response: body: - string: '{"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":"152e72d970e15e799e4b195d7193ed18","name":"Test-Get_an_SLO_s_details_returns_OK_response-1646747470","created_at":1646747471,"tags":[],"modified_at":1646747471,"type":"metric"},"error":null}' + string: '{"data":{"id":"ebf2e048f49a5134b61a586438c66505","name":"Test-Get_an_SLO_s_details_returns_OK_response-1704322488","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.0,"target_threshold":95.0,"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":1704322488,"modified_at":1704322488},"error":null} + + ' headers: content-type: - application/json @@ -39,10 +43,12 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/slo/152e72d970e15e799e4b195d7193ed18 + uri: https://api.datadoghq.com/api/v1/slo/ebf2e048f49a5134b61a586438c66505 response: body: - string: '{"data":["152e72d970e15e799e4b195d7193ed18"],"error":null}' + string: '{"data":["ebf2e048f49a5134b61a586438c66505"],"error":null} + + ' headers: content-type: - application/json diff --git a/tests/v1/cassettes/test_scenarios/test_get_an_slos_history_returns_ok_response.frozen b/tests/v1/cassettes/test_scenarios/test_get_an_slos_history_returns_ok_response.frozen index 324ba61bcf..0598ce8782 100644 --- a/tests/v1/cassettes/test_scenarios/test_get_an_slos_history_returns_ok_response.frozen +++ b/tests/v1/cassettes/test_scenarios/test_get_an_slos_history_returns_ok_response.frozen @@ -1 +1 @@ -2022-03-08T13:59:13.427Z \ No newline at end of file +2024-01-03T22:54:48.654Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_get_an_slos_history_returns_ok_response.yaml b/tests/v1/cassettes/test_scenarios/test_get_an_slos_history_returns_ok_response.yaml index 643aab35a8..d80ca06b97 100644 --- a/tests/v1/cassettes/test_scenarios/test_get_an_slos_history_returns_ok_response.yaml +++ b/tests/v1/cassettes/test_scenarios/test_get_an_slos_history_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"name":"Test-Get_an_SLO_s_history_returns_OK_response-1646747953","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"}' + body: '{"name":"Test-Get_an_SLO_s_history_returns_OK_response-1704322488","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"}' headers: accept: - application/json @@ -10,7 +10,9 @@ interactions: uri: https://api.datadoghq.com/api/v1/slo response: body: - string: '{"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":"9236f988e3d25ac6982fd4319912ec43","name":"Test-Get_an_SLO_s_history_returns_OK_response-1646747953","created_at":1646747953,"tags":[],"modified_at":1646747953,"type":"metric"}],"error":null}' + string: '{"data":[{"id":"627a3ccd24af50beb8eacbd36c5962f9","name":"Test-Get_an_SLO_s_history_returns_OK_response-1704322488","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":1704322488,"modified_at":1704322488}],"error":null} + + ' headers: content-type: - application/json @@ -23,14 +25,16 @@ interactions: accept: - application/json method: GET - uri: https://api.datadoghq.com/api/v1/slo/9236f988e3d25ac6982fd4319912ec43/history?from_ts=1646661553&to_ts=1646747953 + uri: https://api.datadoghq.com/api/v1/slo/627a3ccd24af50beb8eacbd36c5962f9/history?from_ts=1704236088&to_ts=1704322488 response: body: - string: '{"errors":null,"data":{"to_ts":1646747953,"type_id":1,"series":{"res_type":"time_series","denominator":{"count":13,"sum":0.0,"values":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],"metadata":{"unit":null,"query_index":1,"aggr":"sum","scope":"!code:3xx","metric":"default_zero(httpservice.hits)","expression":"default_zero(sum:httpservice.hits{!code:3xx}.as_count())","tag_set":[]}},"graph_query":"default_zero(sum:httpservice.hits{code:2xx}.as_count()), - default_zero(sum:httpservice.hits{!code:3xx}.as_count()) - default_zero(sum:httpservice.hits{code:2xx}.as_count())","resp_version":2,"interval":7200,"numerator":{"count":13,"sum":0.0,"values":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],"metadata":{"unit":null,"query_index":0,"aggr":"sum","scope":"code:2xx","metric":"default_zero(httpservice.hits)","expression":"default_zero(sum:httpservice.hits{code:2xx}.as_count())","tag_set":[]}},"bad_series_query":"default_zero(sum:httpservice.hits{!code:3xx}.as_count()) - - default_zero(sum:httpservice.hits{code:2xx}.as_count())","times":[1646654400000.0,1646661600000.0,1646668800000.0,1646676000000.0,1646683200000.0,1646690400000.0,1646697600000.0,1646704800000.0,1646712000000.0,1646719200000.0,1646726400000.0,1646733600000.0,1646740800000.0],"denominator_query":"default_zero(sum:httpservice.hits{!code:3xx}.as_count())","from_date":1646661553000,"numerator_query":"default_zero(sum:httpservice.hits{code:2xx}.as_count())","to_date":1646747953000,"timing":"0.0103521347046","query":"default_zero(sum:httpservice.hits{code:2xx}.as_count()), - default_zero(sum:httpservice.hits{!code:3xx}.as_count())","message":""},"thresholds":{"7d":{"warning":98.0,"warning_display":"98.","target":95.0,"target_display":"95.","timeframe":"7d"}},"overall":{"uptime":null,"errors":[{"error_type":"ZERO_VALUED_DENOMINATOR","error_message":"The - denominator is zero valued"}],"sli_value":null,"precision":{"7d":0},"corrections":[],"span_precision":2},"from_ts":1646661553,"group_by":[],"slo":{"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":"9236f988e3d25ac6982fd4319912ec43","name":"Test-Get_an_SLO_s_history_returns_OK_response-1646747953","created_at":1646747953,"tags":[],"modified_at":1646747953,"type":"metric"},"type":"metric"}}' + string: '{"data":{"thresholds":{"7d":{"timeframe":"7d","target":95.0,"target_display":"95.","warning":98.0,"warning_display":"98."}},"from_ts":1704236088,"to_ts":1704322488,"type":"metric","type_id":1,"slo":{"id":"627a3ccd24af50beb8eacbd36c5962f9","name":"Test-Get_an_SLO_s_history_returns_OK_response-1704322488","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.0,"target_threshold":95.0,"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":1704322488,"modified_at":1704322488},"group_by":[],"series":{"timing":"0.02146005630493164","res_type":"time_series","resp_version":2,"query":"default_zero(sum:httpservice.hits{code:2xx}.as_count()), + default_zero(sum:httpservice.hits{!code:3xx}.as_count())","from_date":1704236088000,"to_date":1704322488000,"message":"","interval":7200,"times":[1704235800000.0,1704240000000.0,1704247200000.0,1704254400000.0,1704261600000.0,1704268800000.0,1704276000000.0,1704283200000.0,1704290400000.0,1704297600000.0,1704304800000.0,1704312000000.0,1704319200000.0],"numerator":{"values":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],"metadata":{"unit":null,"query_index":0,"aggr":"sum","metric":"default_zero(httpservice.hits)","tag_set":[],"expression":"default_zero(sum:httpservice.hits{code:2xx}.as_count())","scope":"code:2xx"},"sum":0.0,"count":13},"denominator":{"values":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],"metadata":{"unit":null,"query_index":1,"aggr":"sum","metric":"default_zero(httpservice.hits)","tag_set":[],"expression":"default_zero(sum:httpservice.hits{!code:3xx}.as_count())","scope":"!code:3xx"},"sum":0.0,"count":13},"numerator_query":"default_zero(sum:httpservice.hits{code:2xx}.as_count())","denominator_query":"default_zero(sum:httpservice.hits{!code:3xx}.as_count())","bad_series_query":"default_zero(sum:httpservice.hits{!code:3xx}.as_count()) + - default_zero(sum:httpservice.hits{code:2xx}.as_count())","graph_query":"default_zero(sum:httpservice.hits{code:2xx}.as_count()), + default_zero(sum:httpservice.hits{!code:3xx}.as_count()) - default_zero(sum:httpservice.hits{code:2xx}.as_count())"},"overall":{"errors":[{"error_message":"The + denominator is zero valued","error_type":"ZERO_VALUED_DENOMINATOR"}],"sli_value":null,"span_precision":2,"precision":{"7d":0},"uptime":null,"corrections":[],"state":"no_data"}},"errors":null} + + ' headers: content-type: - application/json @@ -43,10 +47,12 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/slo/9236f988e3d25ac6982fd4319912ec43 + uri: https://api.datadoghq.com/api/v1/slo/627a3ccd24af50beb8eacbd36c5962f9 response: body: - string: '{"data":["9236f988e3d25ac6982fd4319912ec43"],"error":null}' + string: '{"data":["627a3ccd24af50beb8eacbd36c5962f9"],"error":null} + + ' headers: content-type: - application/json diff --git a/tests/v1/cassettes/test_scenarios/test_get_corrections_for_an_slo_returns_ok_response.frozen b/tests/v1/cassettes/test_scenarios/test_get_corrections_for_an_slo_returns_ok_response.frozen index 0b05e38af0..9d1d459ec9 100644 --- a/tests/v1/cassettes/test_scenarios/test_get_corrections_for_an_slo_returns_ok_response.frozen +++ b/tests/v1/cassettes/test_scenarios/test_get_corrections_for_an_slo_returns_ok_response.frozen @@ -1 +1 @@ -2022-05-12T09:50:24.737Z \ No newline at end of file +2024-01-03T22:54:46.662Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_get_corrections_for_an_slo_returns_ok_response.yaml b/tests/v1/cassettes/test_scenarios/test_get_corrections_for_an_slo_returns_ok_response.yaml index 737c702ed3..4299458d7e 100644 --- a/tests/v1/cassettes/test_scenarios/test_get_corrections_for_an_slo_returns_ok_response.yaml +++ b/tests/v1/cassettes/test_scenarios/test_get_corrections_for_an_slo_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"name":"Test-Get_Corrections_For_an_SLO_returns_OK_response-1652349024","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"}' + body: '{"name":"Test-Get_Corrections_For_an_SLO_returns_OK_response-1704322486","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"}' headers: accept: - application/json @@ -10,7 +10,9 @@ interactions: uri: https://api.datadoghq.com/api/v1/slo response: body: - string: '{"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":"dd2615cf2fbf56098f3cf4965d37892f","name":"Test-Get_Corrections_For_an_SLO_returns_OK_response-1652349024","created_at":1652349025,"tags":[],"modified_at":1652349025,"type":"metric"}],"error":null}' + string: '{"data":[{"id":"029b3b619a6255eb899c46681dd7038f","name":"Test-Get_Corrections_For_an_SLO_returns_OK_response-1704322486","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":1704322486,"modified_at":1704322486}],"error":null} + + ' headers: content-type: - application/json @@ -18,7 +20,7 @@ interactions: code: 200 message: OK - request: - body: '{"data":{"attributes":{"category":"Other","description":"Test Correction","end":1652352624,"slo_id":"dd2615cf2fbf56098f3cf4965d37892f","start":1652349024,"timezone":"UTC"},"type":"correction"}}' + body: '{"data":{"attributes":{"category":"Other","description":"Test Correction","end":1704326086,"slo_id":"029b3b619a6255eb899c46681dd7038f","start":1704322486,"timezone":"UTC"},"type":"correction"}}' headers: accept: - application/json @@ -28,8 +30,10 @@ interactions: uri: https://api.datadoghq.com/api/v1/slo/correction response: body: - string: '{"data":{"type":"correction","id":"f2b8ad40-d1d8-11ec-a01e-da7ad0902002","attributes":{"slo_id":"dd2615cf2fbf56098f3cf4965d37892f","start":1652349024,"end":1652352624,"description":"Test - Correction","category":"Other","timezone":"UTC","created_at":null,"modified_at":null,"rrule":null,"duration":null,"creator":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"modifier":null}}}' + string: '{"data":{"type":"correction","id":"17b61420-aa8b-11ee-97f2-da7ad0902002","attributes":{"slo_id":"029b3b619a6255eb899c46681dd7038f","start":1704322486,"end":1704326086,"description":"Test + Correction","category":"Other","timezone":"UTC","created_at":null,"modified_at":null,"rrule":null,"duration":null,"creator":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"modifier":null}}} + + ' headers: content-type: - application/json @@ -42,11 +46,13 @@ interactions: accept: - application/json method: GET - uri: https://api.datadoghq.com/api/v1/slo/dd2615cf2fbf56098f3cf4965d37892f/corrections + uri: https://api.datadoghq.com/api/v1/slo/029b3b619a6255eb899c46681dd7038f/corrections response: body: - string: '{"meta":{"pagination":{"type":"offset_limit","prev_offset":0,"next_offset":10,"offset":0,"limit":10,"total":1,"first_offset":0,"last_offset":0}},"data":[{"type":"correction","id":"f2b8ad40-d1d8-11ec-a01e-da7ad0902002","attributes":{"slo_id":"dd2615cf2fbf56098f3cf4965d37892f","start":1652349024,"end":1652352624,"description":"Test - Correction","category":"Other","timezone":"UTC","created_at":1652349025,"modified_at":1652349025,"rrule":null,"duration":null,"creator":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"modifier":null}}],"links":{"next":"https://api.datadoghq.com/api/v1/slo/dd2615cf2fbf56098f3cf4965d37892f/corrections?page[offset]=10&page[limit]=10","self":"https://api.datadoghq.com/api/v1/slo/dd2615cf2fbf56098f3cf4965d37892f/corrections","prev":null,"last":null,"first":"https://api.datadoghq.com/api/v1/slo/dd2615cf2fbf56098f3cf4965d37892f/corrections?page[offset]=0&page[limit]=10"}}' + string: '{"data":[{"type":"correction","id":"17b61420-aa8b-11ee-97f2-da7ad0902002","attributes":{"slo_id":"029b3b619a6255eb899c46681dd7038f","start":1704322486,"end":1704326086,"description":"Test + Correction","category":"Other","timezone":"UTC","created_at":1704322487,"modified_at":1704322487,"rrule":null,"duration":null,"creator":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"modifier":null}}],"meta":{"pagination":{"offset":0,"first_offset":0,"prev_offset":0,"next_offset":10,"last_offset":0,"limit":10,"type":"offset_limit","total":1}},"links":{"self":"https://api.datadoghq.com/api/v1/slo/029b3b619a6255eb899c46681dd7038f/corrections","last":null,"next":"https://api.datadoghq.com/api/v1/slo/029b3b619a6255eb899c46681dd7038f/corrections?page[offset]=10&page[limit]=10","prev":null,"first":"https://api.datadoghq.com/api/v1/slo/029b3b619a6255eb899c46681dd7038f/corrections?page[offset]=0&page[limit]=10"}} + + ' headers: content-type: - application/json @@ -59,11 +65,13 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v1/slo/correction/f2b8ad40-d1d8-11ec-a01e-da7ad0902002 + uri: https://api.datadoghq.com/api/v1/slo/correction/17b61420-aa8b-11ee-97f2-da7ad0902002 response: body: string: '' - headers: {} + headers: + content-type: + - text/html; charset=utf-8 status: code: 204 message: No Content @@ -73,10 +81,12 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/slo/dd2615cf2fbf56098f3cf4965d37892f + uri: https://api.datadoghq.com/api/v1/slo/029b3b619a6255eb899c46681dd7038f response: body: - string: '{"data":["dd2615cf2fbf56098f3cf4965d37892f"],"error":null}' + string: '{"data":["029b3b619a6255eb899c46681dd7038f"],"error":null} + + ' headers: content-type: - application/json diff --git a/tests/v1/cassettes/test_scenarios/test_update_an_slo_returns_bad_request_response.frozen b/tests/v1/cassettes/test_scenarios/test_update_an_slo_returns_bad_request_response.frozen index 37ba6cab0e..a38c0a46eb 100644 --- a/tests/v1/cassettes/test_scenarios/test_update_an_slo_returns_bad_request_response.frozen +++ b/tests/v1/cassettes/test_scenarios/test_update_an_slo_returns_bad_request_response.frozen @@ -1 +1 @@ -2022-01-06T00:51:12.843Z \ No newline at end of file +2024-01-03T22:54:49.226Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_update_an_slo_returns_bad_request_response.yaml b/tests/v1/cassettes/test_scenarios/test_update_an_slo_returns_bad_request_response.yaml index 23d7920b42..aee531bb55 100644 --- a/tests/v1/cassettes/test_scenarios/test_update_an_slo_returns_bad_request_response.yaml +++ b/tests/v1/cassettes/test_scenarios/test_update_an_slo_returns_bad_request_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"name":"Test-Update_an_SLO_returns_Bad_Request_response-1641430272","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"}' + body: '{"name":"Test-Update_an_SLO_returns_Bad_Request_response-1704322489","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"}' headers: accept: - application/json @@ -10,7 +10,9 @@ interactions: uri: https://api.datadoghq.com/api/v1/slo response: body: - string: '{"data":[{"description":"","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"}],"type_id":1,"query":{"denominator":"sum:httpservice.hits{!code:3xx}.as_count()","numerator":"sum:httpservice.hits{code:2xx}.as_count()"},"id":"f21337f0ea7059f986448228aaa11f09","name":"Test-Update_an_SLO_returns_Bad_Request_response-1641430272","created_at":1641430273,"tags":[],"modified_at":1641430273,"type":"metric"}],"error":null}' + string: '{"data":[{"id":"9000070725e15b55a16fa1b2bcd1909c","name":"Test-Update_an_SLO_returns_Bad_Request_response-1704322489","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":1704322489,"modified_at":1704322489}],"error":null} + + ' headers: content-type: - application/json @@ -18,14 +20,14 @@ interactions: code: 200 message: OK - request: - body: '{"name":"Test-Update_an_SLO_returns_Bad_Request_response-1641430272","thresholds":[{"target":95,"target_display":"95.0","timeframe":"7d","warning":98,"warning_display":"98.0"}],"type":"monitor"}' + body: '{"name":"Test-Update_an_SLO_returns_Bad_Request_response-1704322489","thresholds":[{"target":95,"target_display":"95.0","timeframe":"7d","warning":98,"warning_display":"98.0"}],"type":"monitor"}' headers: accept: - application/json content-type: - application/json method: PUT - uri: https://api.datadoghq.com/api/v1/slo/f21337f0ea7059f986448228aaa11f09 + uri: https://api.datadoghq.com/api/v1/slo/9000070725e15b55a16fa1b2bcd1909c response: body: string: '{"errors":["Invalid payload: must specify the query for count types"]}' @@ -41,10 +43,12 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/slo/f21337f0ea7059f986448228aaa11f09 + uri: https://api.datadoghq.com/api/v1/slo/9000070725e15b55a16fa1b2bcd1909c response: body: - string: '{"data":["f21337f0ea7059f986448228aaa11f09"],"error":null}' + string: '{"data":["9000070725e15b55a16fa1b2bcd1909c"],"error":null} + + ' headers: content-type: - application/json diff --git a/tests/v1/cassettes/test_scenarios/test_update_an_slo_returns_ok_response.frozen b/tests/v1/cassettes/test_scenarios/test_update_an_slo_returns_ok_response.frozen index 5e9bd3a34b..b83299dd7c 100644 --- a/tests/v1/cassettes/test_scenarios/test_update_an_slo_returns_ok_response.frozen +++ b/tests/v1/cassettes/test_scenarios/test_update_an_slo_returns_ok_response.frozen @@ -1 +1 @@ -2022-12-23T20:34:34.100Z \ No newline at end of file +2024-01-03T22:54:49.748Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_update_an_slo_returns_ok_response.yaml b/tests/v1/cassettes/test_scenarios/test_update_an_slo_returns_ok_response.yaml index 41fa229d24..0a221a13c6 100644 --- a/tests/v1/cassettes/test_scenarios/test_update_an_slo_returns_ok_response.yaml +++ b/tests/v1/cassettes/test_scenarios/test_update_an_slo_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"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"}' + body: '{"name":"Test-Update_an_SLO_returns_OK_response-1704322489","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"}' headers: accept: - application/json @@ -10,7 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v1/slo response: body: - string: '{"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} + string: '{"data":[{"id":"f38441f875995acc9682503ee2d1901e","name":"Test-Update_an_SLO_returns_OK_response-1704322489","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":1704322489,"modified_at":1704322489}],"error":null} ' headers: @@ -20,17 +20,17 @@ interactions: code: 200 message: OK - request: - body: '{"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}' + body: '{"name":"Test-Update_an_SLO_returns_OK_response-1704322489","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}' headers: accept: - application/json content-type: - application/json method: PUT - uri: https://api.datadoghq.com/api/v1/slo/9ca3260165e5524bb05029ae2cf52ceb + uri: https://api.datadoghq.com/api/v1/slo/f38441f875995acc9682503ee2d1901e response: body: - string: '{"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} + string: '{"data":[{"id":"f38441f875995acc9682503ee2d1901e","name":"Test-Update_an_SLO_returns_OK_response-1704322489","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":1704322489,"modified_at":1704322490}],"error":null} ' headers: @@ -45,10 +45,10 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/slo/9ca3260165e5524bb05029ae2cf52ceb + uri: https://api.datadoghq.com/api/v1/slo/f38441f875995acc9682503ee2d1901e response: body: - string: '{"data":["9ca3260165e5524bb05029ae2cf52ceb"],"error":null} + string: '{"data":["f38441f875995acc9682503ee2d1901e"],"error":null} ' headers: diff --git a/tests/v1/features/service_level_objectives.feature b/tests/v1/features/service_level_objectives.feature index 75e721bb43..c5534618a7 100644 --- a/tests/v1/features/service_level_objectives.feature +++ b/tests/v1/features/service_level_objectives.feature @@ -48,6 +48,16 @@ Feature: Service Level Objectives When the request is sent Then the response status is 200 OK + @team:DataDog/slo-app + Scenario: Create a time-slice SLO object returns "OK" response + Given new "CreateSLO" request + And body with value {"type":"time_slice","description":"string","name":"{{ unique }}","sli_specification":{"time_slice":{"query":{"formulas":[{"formula":"query1"}],"queries":[{"data_source":"metrics","name":"query1","query":"trace.servlet.request{env:prod}"}]},"comparator":">","threshold":5}},"tags":["env:prod"],"thresholds":[{"target":97.0,"target_display":"97.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 + @team:DataDog/slo-app Scenario: Create an SLO object returns "Bad Request" response Given new "CreateSLO" request @@ -220,7 +230,7 @@ Feature: Service Level Objectives Scenario: Update an SLO returns "Not Found" response Given new "UpdateSLO" request And request contains "slo_id" parameter from "REPLACE.ME" - 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()"}, "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} + 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} When the request is sent Then the response status is 404 Not Found