Skip to content

Commit 121ab3d

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add query_interval_seconds to time-slice SLO condition parameters (#1936)
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 6d78b57 commit 121ab3d

File tree

8 files changed

+98
-10
lines changed

8 files changed

+98
-10
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.6",
7-
"regenerated": "2024-04-02 13:17:39.250860",
8-
"spec_repo_commit": "de9967cc"
7+
"regenerated": "2024-04-03 15:02:14.618599",
8+
"spec_repo_commit": "e8144990"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-04-02 13:17:39.275860",
13-
"spec_repo_commit": "de9967cc"
12+
"regenerated": "2024-04-03 15:02:14.635120",
13+
"spec_repo_commit": "e8144990"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11370,7 +11370,8 @@ components:
1137011370
description: 'The time-slice condition, composed of 3 parts: 1. the metric timeseries
1137111371
query, 2. the comparator,
1137211372

11373-
and 3. the threshold.'
11373+
and 3. the threshold. Optionally, a fourth part, the query interval, can be
11374+
provided.'
1137411375
example:
1137511376
comparator: <
1137611377
query:
@@ -11389,6 +11390,8 @@ components:
1138911390
$ref: '#/components/schemas/SLOTimeSliceComparator'
1139011391
query:
1139111392
$ref: '#/components/schemas/SLOTimeSliceQuery'
11393+
query_interval_seconds:
11394+
$ref: '#/components/schemas/SLOTimeSliceInterval'
1139211395
threshold:
1139311396
description: The threshold value to which each SLI value will be compared.
1139411397
example: 5
@@ -11399,6 +11402,22 @@ components:
1139911402
- threshold
1140011403
- query
1140111404
type: object
11405+
SLOTimeSliceInterval:
11406+
description: 'The interval used when querying data, which defines the size of
11407+
a time slice.
11408+
11409+
Two values are allowed: 60 (1 minute) and 300 (5 minutes).
11410+
11411+
If not provided, the value defaults to 300 (5 minutes).'
11412+
enum:
11413+
- 60
11414+
- 300
11415+
example: 300
11416+
format: int32
11417+
type: integer
11418+
x-enum-varnames:
11419+
- ONE_MINUTE
11420+
- FIVE_MINUTES
1140211421
SLOTimeSliceQuery:
1140311422
description: The queries and formula used to calculate the SLI value.
1140411423
example:

docs/datadog_api_client.v1.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3571,6 +3571,13 @@ slo\_time\_slice\_condition
35713571
:members:
35723572
:show-inheritance:
35733573

3574+
slo\_time\_slice\_interval
3575+
--------------------------
3576+
3577+
.. automodule:: datadog_api_client.v1.model.slo_time_slice_interval
3578+
:members:
3579+
:show-inheritance:
3580+
35743581
slo\_time\_slice\_query
35753582
-----------------------
35763583

src/datadog_api_client/v1/model/slo_sli_spec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(self, **kwargs):
1616
A generic SLI specification. This is currently used for time-slice SLOs only.
1717
1818
:param time_slice: The time-slice condition, composed of 3 parts: 1. the metric timeseries query, 2. the comparator,
19-
and 3. the threshold.
19+
and 3. the threshold. Optionally, a fourth part, the query interval, can be provided.
2020
:type time_slice: SLOTimeSliceCondition
2121
"""
2222
super().__init__(kwargs)

src/datadog_api_client/v1/model/slo_time_slice_condition.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,71 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6-
from typing import TYPE_CHECKING
6+
from typing import Union, TYPE_CHECKING
77

88
from datadog_api_client.model_utils import (
99
ModelNormal,
1010
cached_property,
11+
unset,
12+
UnsetType,
1113
)
1214

1315

1416
if TYPE_CHECKING:
1517
from datadog_api_client.v1.model.slo_time_slice_comparator import SLOTimeSliceComparator
1618
from datadog_api_client.v1.model.slo_time_slice_query import SLOTimeSliceQuery
19+
from datadog_api_client.v1.model.slo_time_slice_interval import SLOTimeSliceInterval
1720

1821

1922
class SLOTimeSliceCondition(ModelNormal):
2023
@cached_property
2124
def openapi_types(_):
2225
from datadog_api_client.v1.model.slo_time_slice_comparator import SLOTimeSliceComparator
2326
from datadog_api_client.v1.model.slo_time_slice_query import SLOTimeSliceQuery
27+
from datadog_api_client.v1.model.slo_time_slice_interval import SLOTimeSliceInterval
2428

2529
return {
2630
"comparator": (SLOTimeSliceComparator,),
2731
"query": (SLOTimeSliceQuery,),
32+
"query_interval_seconds": (SLOTimeSliceInterval,),
2833
"threshold": (float,),
2934
}
3035

3136
attribute_map = {
3237
"comparator": "comparator",
3338
"query": "query",
39+
"query_interval_seconds": "query_interval_seconds",
3440
"threshold": "threshold",
3541
}
3642

37-
def __init__(self_, comparator: SLOTimeSliceComparator, query: SLOTimeSliceQuery, threshold: float, **kwargs):
43+
def __init__(
44+
self_,
45+
comparator: SLOTimeSliceComparator,
46+
query: SLOTimeSliceQuery,
47+
threshold: float,
48+
query_interval_seconds: Union[SLOTimeSliceInterval, UnsetType] = unset,
49+
**kwargs,
50+
):
3851
"""
3952
The time-slice condition, composed of 3 parts: 1. the metric timeseries query, 2. the comparator,
40-
and 3. the threshold.
53+
and 3. the threshold. Optionally, a fourth part, the query interval, can be provided.
4154
4255
:param comparator: The comparator used to compare the SLI value to the threshold.
4356
:type comparator: SLOTimeSliceComparator
4457
4558
:param query: The queries and formula used to calculate the SLI value.
4659
:type query: SLOTimeSliceQuery
4760
61+
:param query_interval_seconds: The interval used when querying data, which defines the size of a time slice.
62+
Two values are allowed: 60 (1 minute) and 300 (5 minutes).
63+
If not provided, the value defaults to 300 (5 minutes).
64+
:type query_interval_seconds: SLOTimeSliceInterval, optional
65+
4866
:param threshold: The threshold value to which each SLI value will be compared.
4967
:type threshold: float
5068
"""
69+
if query_interval_seconds is not unset:
70+
kwargs["query_interval_seconds"] = query_interval_seconds
5171
super().__init__(kwargs)
5272

5373
self_.comparator = comparator
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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 SLOTimeSliceInterval(ModelSimple):
16+
"""
17+
The interval used when querying data, which defines the size of a time slice.
18+
Two values are allowed: 60 (1 minute) and 300 (5 minutes).
19+
If not provided, the value defaults to 300 (5 minutes).
20+
21+
:param value: Must be one of [60, 300].
22+
:type value: int
23+
"""
24+
25+
allowed_values = {
26+
60,
27+
300,
28+
}
29+
ONE_MINUTE: ClassVar["SLOTimeSliceInterval"]
30+
FIVE_MINUTES: ClassVar["SLOTimeSliceInterval"]
31+
32+
@cached_property
33+
def openapi_types(_):
34+
return {
35+
"value": (int,),
36+
}
37+
38+
39+
SLOTimeSliceInterval.ONE_MINUTE = SLOTimeSliceInterval(60)
40+
SLOTimeSliceInterval.FIVE_MINUTES = SLOTimeSliceInterval(300)

src/datadog_api_client/v1/model/slo_time_slice_spec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(self_, time_slice: SLOTimeSliceCondition, **kwargs):
3333
A time-slice SLI specification.
3434
3535
:param time_slice: The time-slice condition, composed of 3 parts: 1. the metric timeseries query, 2. the comparator,
36-
and 3. the threshold.
36+
and 3. the threshold. Optionally, a fourth part, the query interval, can be provided.
3737
:type time_slice: SLOTimeSliceCondition
3838
"""
3939
super().__init__(kwargs)

src/datadog_api_client/v1/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@
517517
from datadog_api_client.v1.model.slo_threshold import SLOThreshold
518518
from datadog_api_client.v1.model.slo_time_slice_comparator import SLOTimeSliceComparator
519519
from datadog_api_client.v1.model.slo_time_slice_condition import SLOTimeSliceCondition
520+
from datadog_api_client.v1.model.slo_time_slice_interval import SLOTimeSliceInterval
520521
from datadog_api_client.v1.model.slo_time_slice_query import SLOTimeSliceQuery
521522
from datadog_api_client.v1.model.slo_time_slice_spec import SLOTimeSliceSpec
522523
from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe
@@ -1416,6 +1417,7 @@
14161417
"SLOThreshold",
14171418
"SLOTimeSliceComparator",
14181419
"SLOTimeSliceCondition",
1420+
"SLOTimeSliceInterval",
14191421
"SLOTimeSliceQuery",
14201422
"SLOTimeSliceSpec",
14211423
"SLOTimeframe",

0 commit comments

Comments
 (0)