Skip to content

Commit 93a65ec

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add SLO status and error budget remaining to search API (#1344)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
1 parent ee7ecfa commit 93a65ec

14 files changed

+275
-24
lines changed

.apigentools-info

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

.generator/schemas/v1/openapi.yaml

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

docs/datadog_api_client.v1.model.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3186,6 +3186,20 @@ slo\_response\_data
31863186
:members:
31873187
:show-inheritance:
31883188

3189+
slo\_state
3190+
----------
3191+
3192+
.. automodule:: datadog_api_client.v1.model.slo_state
3193+
:members:
3194+
:show-inheritance:
3195+
3196+
slo\_status
3197+
-----------
3198+
3199+
.. automodule:: datadog_api_client.v1.model.slo_status
3200+
:members:
3201+
:show-inheritance:
3202+
31893203
slo\_threshold
31903204
--------------
31913205

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
SLO_DATA_0_NAME = environ["SLO_DATA_0_NAME"]
1111

1212
configuration = Configuration()
13-
configuration.unstable_operations["search_slo"] = True
1413
with ApiClient(configuration) as api_client:
1514
api_instance = ServiceLevelObjectivesApi(api_client)
1615
response = api_instance.search_slo(

src/datadog_api_client/configuration.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ def __init__(
221221
# Keep track of unstable operations
222222
self.unstable_operations = _UnstableOperations(
223223
{
224-
"v1.search_slo": False,
225224
"v2.list_events": False,
226225
"v2.search_events": False,
227226
"v2.create_incident": False,

src/datadog_api_client/v1/model/search_service_level_objective_attributes.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from datadog_api_client.v1.model.slo_overall_statuses import SLOOverallStatuses
2020
from datadog_api_client.v1.model.search_slo_query import SearchSLOQuery
2121
from datadog_api_client.v1.model.slo_type import SLOType
22+
from datadog_api_client.v1.model.slo_status import SLOStatus
2223
from datadog_api_client.v1.model.search_slo_threshold import SearchSLOThreshold
2324

2425

@@ -29,6 +30,7 @@ def openapi_types(_):
2930
from datadog_api_client.v1.model.slo_overall_statuses import SLOOverallStatuses
3031
from datadog_api_client.v1.model.search_slo_query import SearchSLOQuery
3132
from datadog_api_client.v1.model.slo_type import SLOType
33+
from datadog_api_client.v1.model.slo_status import SLOStatus
3234
from datadog_api_client.v1.model.search_slo_threshold import SearchSLOThreshold
3335

3436
return {
@@ -45,6 +47,7 @@ def openapi_types(_):
4547
"query": (SearchSLOQuery,),
4648
"service_tags": ([str],),
4749
"slo_type": (SLOType,),
50+
"status": (SLOStatus,),
4851
"team_tags": ([str],),
4952
"thresholds": ([SearchSLOThreshold],),
5053
}
@@ -63,6 +66,7 @@ def openapi_types(_):
6366
"query": "query",
6467
"service_tags": "service_tags",
6568
"slo_type": "slo_type",
69+
"status": "status",
6670
"team_tags": "team_tags",
6771
"thresholds": "thresholds",
6872
}
@@ -86,6 +90,7 @@ def __init__(
8690
query: Union[SearchSLOQuery, none_type, UnsetType] = unset,
8791
service_tags: Union[List[str], UnsetType] = unset,
8892
slo_type: Union[SLOType, UnsetType] = unset,
93+
status: Union[SLOStatus, UnsetType] = unset,
8994
team_tags: Union[List[str], UnsetType] = unset,
9095
thresholds: Union[List[SearchSLOThreshold], UnsetType] = unset,
9196
**kwargs,
@@ -145,6 +150,9 @@ def __init__(
145150
:param slo_type: The type of the service level objective.
146151
:type slo_type: SLOType, optional
147152
153+
:param status: Status of the SLO's primary timeframe.
154+
:type status: SLOStatus, optional
155+
148156
:param team_tags: Tags with the ``team`` tag key.
149157
:type team_tags: [str], optional
150158
@@ -178,6 +186,8 @@ def __init__(
178186
kwargs["service_tags"] = service_tags
179187
if slo_type is not unset:
180188
kwargs["slo_type"] = slo_type
189+
if status is not unset:
190+
kwargs["status"] = status
181191
if team_tags is not unset:
182192
kwargs["team_tags"] = team_tags
183193
if thresholds is not unset:

src/datadog_api_client/v1/model/slo_overall_statuses.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,36 @@
1616

1717
if TYPE_CHECKING:
1818
from datadog_api_client.v1.model.slo_raw_error_budget_remaining import SLORawErrorBudgetRemaining
19+
from datadog_api_client.v1.model.slo_state import SLOState
1920
from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe
2021

2122

2223
class SLOOverallStatuses(ModelNormal):
2324
@cached_property
2425
def openapi_types(_):
2526
from datadog_api_client.v1.model.slo_raw_error_budget_remaining import SLORawErrorBudgetRemaining
27+
from datadog_api_client.v1.model.slo_state import SLOState
2628
from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe
2729

2830
return {
2931
"error": (str, none_type),
32+
"error_budget_remaining": (float, none_type),
3033
"indexed_at": (int,),
3134
"raw_error_budget_remaining": (SLORawErrorBudgetRemaining,),
32-
"span_precision": (int,),
35+
"span_precision": (int, none_type),
36+
"state": (SLOState,),
3337
"status": (float, none_type),
3438
"target": (float,),
3539
"timeframe": (SLOTimeframe,),
3640
}
3741

3842
attribute_map = {
3943
"error": "error",
44+
"error_budget_remaining": "error_budget_remaining",
4045
"indexed_at": "indexed_at",
4146
"raw_error_budget_remaining": "raw_error_budget_remaining",
4247
"span_precision": "span_precision",
48+
"state": "state",
4349
"status": "status",
4450
"target": "target",
4551
"timeframe": "timeframe",
@@ -48,9 +54,11 @@ def openapi_types(_):
4854
def __init__(
4955
self_,
5056
error: Union[str, none_type, UnsetType] = unset,
57+
error_budget_remaining: Union[float, none_type, UnsetType] = unset,
5158
indexed_at: Union[int, UnsetType] = unset,
52-
raw_error_budget_remaining: Union[SLORawErrorBudgetRemaining, UnsetType] = unset,
53-
span_precision: Union[int, UnsetType] = unset,
59+
raw_error_budget_remaining: Union[SLORawErrorBudgetRemaining, none_type, UnsetType] = unset,
60+
span_precision: Union[int, none_type, UnsetType] = unset,
61+
state: Union[SLOState, UnsetType] = unset,
5462
status: Union[float, none_type, UnsetType] = unset,
5563
target: Union[float, UnsetType] = unset,
5664
timeframe: Union[SLOTimeframe, UnsetType] = unset,
@@ -62,15 +70,21 @@ def __init__(
6270
:param error: Error message if SLO status or error budget could not be calculated.
6371
:type error: str, none_type, optional
6472
73+
:param error_budget_remaining: Remaining error budget of the SLO in percentage.
74+
:type error_budget_remaining: float, none_type, optional
75+
6576
:param indexed_at: timestamp (UNIX time in seconds) of when the SLO status and error budget
6677
were calculated.
6778
:type indexed_at: int, optional
6879
6980
:param raw_error_budget_remaining: Error budget remaining for an SLO.
70-
:type raw_error_budget_remaining: SLORawErrorBudgetRemaining, optional
81+
:type raw_error_budget_remaining: SLORawErrorBudgetRemaining, none_type, optional
7182
7283
:param span_precision: The amount of decimal places the SLI value is accurate to.
73-
:type span_precision: int, optional
84+
:type span_precision: int, none_type, optional
85+
86+
:param state: State of the SLO.
87+
:type state: SLOState, optional
7488
7589
:param status: The status of the SLO.
7690
:type status: float, none_type, optional
@@ -83,12 +97,16 @@ def __init__(
8397
"""
8498
if error is not unset:
8599
kwargs["error"] = error
100+
if error_budget_remaining is not unset:
101+
kwargs["error_budget_remaining"] = error_budget_remaining
86102
if indexed_at is not unset:
87103
kwargs["indexed_at"] = indexed_at
88104
if raw_error_budget_remaining is not unset:
89105
kwargs["raw_error_budget_remaining"] = raw_error_budget_remaining
90106
if span_precision is not unset:
91107
kwargs["span_precision"] = span_precision
108+
if state is not unset:
109+
kwargs["state"] = state
92110
if status is not unset:
93111
kwargs["status"] = status
94112
if target is not unset:

src/datadog_api_client/v1/model/slo_raw_error_budget_remaining.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515

1616
class SLORawErrorBudgetRemaining(ModelNormal):
17+
_nullable = True
18+
1719
@cached_property
1820
def openapi_types(_):
1921
return {
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
7+
from datadog_api_client.model_utils import (
8+
ModelSimple,
9+
cached_property,
10+
)
11+
12+
from typing import ClassVar
13+
14+
15+
class SLOState(ModelSimple):
16+
"""
17+
State of the SLO.
18+
19+
:param value: Must be one of ["breached", "warning", "ok", "no_data"].
20+
:type value: str
21+
"""
22+
23+
allowed_values = {
24+
"breached",
25+
"warning",
26+
"ok",
27+
"no_data",
28+
}
29+
BREACHED: ClassVar["SLOState"]
30+
WARNING: ClassVar["SLOState"]
31+
OK: ClassVar["SLOState"]
32+
NO_DATA: ClassVar["SLOState"]
33+
34+
@cached_property
35+
def openapi_types(_):
36+
return {
37+
"value": (str,),
38+
}
39+
40+
41+
SLOState.BREACHED = SLOState("breached")
42+
SLOState.WARNING = SLOState("warning")
43+
SLOState.OK = SLOState("ok")
44+
SLOState.NO_DATA = SLOState("no_data")

0 commit comments

Comments
 (0)