Skip to content

Commit 618a587

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit ffbd7eb of spec repo
1 parent 9839b1e commit 618a587

25 files changed

+350
-233
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11900,6 +11900,60 @@ components:
1190011900
example: UTC
1190111901
type: string
1190211902
type: object
11903+
SLOCountDefinition:
11904+
description: 'A count-based (metric) SLI specification, composed of three parts:
11905+
the good events formula, the total events formula,
11906+
11907+
and the underlying queries.'
11908+
example:
11909+
good_events_formula: query1 - query2
11910+
queries:
11911+
- data_source: metrics
11912+
name: query1
11913+
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
11914+
- data_source: metrics
11915+
name: query2
11916+
query: sum:trace.servlet.request.errors{*} by {env}.as_count()
11917+
total_events_formula: query1
11918+
properties:
11919+
good_events_formula:
11920+
$ref: '#/components/schemas/SLOFormula'
11921+
queries:
11922+
example:
11923+
- data_source: metrics
11924+
name: query1
11925+
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
11926+
items:
11927+
$ref: '#/components/schemas/SLODataSourceQueryDefinition'
11928+
minItems: 1
11929+
type: array
11930+
total_events_formula:
11931+
$ref: '#/components/schemas/SLOFormula'
11932+
required:
11933+
- good_events_formula
11934+
- total_events_formula
11935+
- queries
11936+
type: object
11937+
SLOCountSpec:
11938+
additionalProperties: false
11939+
description: A metric SLI specification.
11940+
example:
11941+
count:
11942+
good_events_formula: query1 - query2
11943+
queries:
11944+
- data_source: metrics
11945+
name: query1
11946+
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
11947+
- data_source: metrics
11948+
name: query2
11949+
query: sum:trace.servlet.request.errors{*} by {env}.as_count()
11950+
total_events_formula: query1
11951+
properties:
11952+
count:
11953+
$ref: '#/components/schemas/SLOCountDefinition'
11954+
required:
11955+
- count
11956+
type: object
1190311957
SLOCreator:
1190411958
description: The creator of the SLO
1190511959
nullable: true
@@ -12747,8 +12801,11 @@ components:
1274712801
type: string
1274812802
query:
1274912803
$ref: '#/components/schemas/ServiceLevelObjectiveQuery'
12804+
description: The metric query of good / total events.
1275012805
sli_specification:
1275112806
$ref: '#/components/schemas/SLOSliSpec'
12807+
description: A generic SLI specification. This is currently used for time-slice
12808+
and count-based (metric) SLOs only.
1275212809
tags:
1275312810
description: 'A list of tags associated with this service level objective.
1275412811

@@ -12804,10 +12861,11 @@ components:
1280412861
type: number
1280512862
type: object
1280612863
SLOSliSpec:
12807-
description: A generic SLI specification. This is currently used for time-slice
12808-
SLOs only.
12864+
description: A generic SLI specification. This is used for time-slice and count-based
12865+
(metric) SLOs only.
1280912866
oneOf:
1281012867
- $ref: '#/components/schemas/SLOTimeSliceSpec'
12868+
- $ref: '#/components/schemas/SLOCountSpec'
1281112869
SLOState:
1281212870
description: State of the SLO.
1281312871
enum:
@@ -13959,7 +14017,8 @@ components:
1395914017
- type
1396014018
type: object
1396114019
ServiceLevelObjectiveQuery:
13962-
description: 'A metric-based SLO. **Required if type is `metric`**. Note that
14020+
description: 'A count-based (metric) SLO query. This field is superseded by
14021+
`sli_specification` but is retained for backwards compatibility. Note that
1396314022
Datadog only allows the sum by aggregator
1396414023

1396514024
to be used because this will sum up all request counts instead of averaging

.generator/schemas/v2/openapi.yaml

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -24023,22 +24023,6 @@ components:
2402324023
type: string
2402424024
flaky_state:
2402524025
$ref: '#/components/schemas/FlakyTestAttributesFlakyState'
24026-
history:
24027-
description: 'Chronological history of status changes for this flaky test,
24028-
ordered from most recent to oldest.
24029-
24030-
Includes state transitions like new -> quarantined -> fixed, along with
24031-
the associated commit SHA when available.'
24032-
example:
24033-
- commit_sha: abc123def456
24034-
status: quarantined
24035-
timestamp: 1704067200000
24036-
- commit_sha: ''
24037-
status: new
24038-
timestamp: 1703980800000
24039-
items:
24040-
$ref: '#/components/schemas/FlakyTestHistory'
24041-
type: array
2404224026
last_flaked_branch:
2404324027
description: The branch name where the test exhibited flakiness for the
2404424028
last time.
@@ -24123,29 +24107,6 @@ components:
2412324107
- FIXED
2412424108
- QUARANTINED
2412524109
- DISABLED
24126-
FlakyTestHistory:
24127-
description: A single history entry representing a status change for a flaky
24128-
test.
24129-
properties:
24130-
commit_sha:
24131-
description: The commit SHA associated with this status change. Will be
24132-
an empty string if the commit SHA is not available.
24133-
example: abc123def456
24134-
type: string
24135-
status:
24136-
description: The test status at this point in history.
24137-
example: quarantined
24138-
type: string
24139-
timestamp:
24140-
description: Unix timestamp in milliseconds when this status change occurred.
24141-
example: 1704067200000
24142-
format: int64
24143-
type: integer
24144-
required:
24145-
- status
24146-
- commit_sha
24147-
- timestamp
24148-
type: object
2414924110
FlakyTestPipelineStats:
2415024111
description: CI pipeline related statistics for the flaky test. This information
2415124112
is only available if test runs are associated with CI pipeline events from
@@ -24292,17 +24253,6 @@ components:
2429224253
properties:
2429324254
filter:
2429424255
$ref: '#/components/schemas/FlakyTestsSearchFilter'
24295-
include_history:
24296-
default: false
24297-
description: 'Whether to include the status change history for each flaky
24298-
test in the response.
24299-
24300-
When set to true, each test will include a `history` array with chronological
24301-
status changes.
24302-
24303-
Defaults to false.'
24304-
example: true
24305-
type: boolean
2430624256
page:
2430724257
$ref: '#/components/schemas/FlakyTestsSearchPageOptions'
2430824258
sort:
@@ -101135,33 +101085,8 @@ paths:
101135101085

101136101086
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
101137101087
post:
101138-
description: 'List endpoint returning flaky tests from Flaky Test Management.
101088+
description: List endpoint returning flaky tests from Flaky Test Management.
101139101089
Results are paginated.
101140-
101141-
101142-
The response includes comprehensive test information including:
101143-
101144-
- Test identification and metadata (module, suite, name)
101145-
101146-
- Flaky state and categorization
101147-
101148-
- First and last flake occurrences (timestamp, branch, commit SHA)
101149-
101150-
- Test execution statistics from the last 7 days (failure rate)
101151-
101152-
- Pipeline impact metrics (failed pipelines count, total lost time)
101153-
101154-
- Complete status change history (optional, ordered from most recent to oldest)
101155-
101156-
101157-
Set `include_history` to `true` in the request to receive the status change
101158-
history for each test.
101159-
101160-
History is disabled by default for better performance.
101161-
101162-
101163-
Results support filtering by various facets including service, environment,
101164-
repository, branch, and test state.'
101165101090
operationId: SearchFlakyTests
101166101091
requestBody:
101167101092
content:

docs/datadog_api_client.v1.model.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3784,6 +3784,20 @@ datadog\_api\_client.v1.model.slo\_correction\_update\_request\_attributes modul
37843784
:members:
37853785
:show-inheritance:
37863786

3787+
datadog\_api\_client.v1.model.slo\_count\_definition module
3788+
-----------------------------------------------------------
3789+
3790+
.. automodule:: datadog_api_client.v1.model.slo_count_definition
3791+
:members:
3792+
:show-inheritance:
3793+
3794+
datadog\_api\_client.v1.model.slo\_count\_spec module
3795+
-----------------------------------------------------
3796+
3797+
.. automodule:: datadog_api_client.v1.model.slo_count_spec
3798+
:members:
3799+
:show-inheritance:
3800+
37873801
datadog\_api\_client.v1.model.slo\_creator module
37883802
-------------------------------------------------
37893803

docs/datadog_api_client.v2.model.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10049,13 +10049,6 @@ datadog\_api\_client.v2.model.flaky\_test\_attributes\_flaky\_state module
1004910049
:members:
1005010050
:show-inheritance:
1005110051

10052-
datadog\_api\_client.v2.model.flaky\_test\_history module
10053-
---------------------------------------------------------
10054-
10055-
.. automodule:: datadog_api_client.v2.model.flaky_test_history
10056-
:members:
10057-
:show-inheritance:
10058-
1005910052
datadog\_api\_client.v2.model.flaky\_test\_pipeline\_stats module
1006010053
-----------------------------------------------------------------
1006110054

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
"""
2+
Create a new metric SLO object using sli_specification returns "OK" response
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v1.api.service_level_objectives_api import ServiceLevelObjectivesApi
7+
from datadog_api_client.v1.model.formula_and_function_metric_data_source import FormulaAndFunctionMetricDataSource
8+
from datadog_api_client.v1.model.formula_and_function_metric_query_definition import (
9+
FormulaAndFunctionMetricQueryDefinition,
10+
)
11+
from datadog_api_client.v1.model.service_level_objective_request import ServiceLevelObjectiveRequest
12+
from datadog_api_client.v1.model.slo_count_definition import SLOCountDefinition
13+
from datadog_api_client.v1.model.slo_count_spec import SLOCountSpec
14+
from datadog_api_client.v1.model.slo_formula import SLOFormula
15+
from datadog_api_client.v1.model.slo_threshold import SLOThreshold
16+
from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe
17+
from datadog_api_client.v1.model.slo_type import SLOType
18+
19+
body = ServiceLevelObjectiveRequest(
20+
type=SLOType.METRIC,
21+
description="Metric SLO using sli_specification",
22+
name="Example-Service-Level-Objective",
23+
sli_specification=SLOCountSpec(
24+
count=SLOCountDefinition(
25+
good_events_formula=SLOFormula(
26+
formula="query1 - query2",
27+
),
28+
total_events_formula=SLOFormula(
29+
formula="query1",
30+
),
31+
queries=[
32+
FormulaAndFunctionMetricQueryDefinition(
33+
data_source=FormulaAndFunctionMetricDataSource.METRICS,
34+
name="query1",
35+
query="sum:httpservice.hits{*}.as_count()",
36+
),
37+
FormulaAndFunctionMetricQueryDefinition(
38+
data_source=FormulaAndFunctionMetricDataSource.METRICS,
39+
name="query2",
40+
query="sum:httpservice.errors{*}.as_count()",
41+
),
42+
],
43+
),
44+
),
45+
tags=[
46+
"env:prod",
47+
"type:count",
48+
],
49+
thresholds=[
50+
SLOThreshold(
51+
target=99.0,
52+
target_display="99.0",
53+
timeframe=SLOTimeframe.SEVEN_DAYS,
54+
warning=99.5,
55+
warning_display="99.5",
56+
),
57+
],
58+
timeframe=SLOTimeframe.SEVEN_DAYS,
59+
target_threshold=99.0,
60+
warning_threshold=99.5,
61+
)
62+
63+
configuration = Configuration()
64+
with ApiClient(configuration) as api_client:
65+
api_instance = ServiceLevelObjectivesApi(api_client)
66+
response = api_instance.create_slo(body=body)
67+
68+
print(response)

examples/v2/test-optimization/SearchFlakyTests.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
filter=FlakyTestsSearchFilter(
1919
query='flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"',
2020
),
21-
include_history=True,
2221
page=FlakyTestsSearchPageOptions(
2322
cursor="eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
2423
limit=25,

examples/v2/test-optimization/SearchFlakyTests_1224086727.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
filter=FlakyTestsSearchFilter(
1919
query='flaky_test_state:active @git.repository.id_v2:"github.com/datadog/shopist"',
2020
),
21-
include_history=True,
2221
page=FlakyTestsSearchPageOptions(
2322
cursor="eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
2423
limit=25,

examples/v2/test-optimization/SearchFlakyTests_209064879.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/datadog_api_client/v1/model/service_level_objective.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe
2323
from datadog_api_client.v1.model.slo_type import SLOType
2424
from datadog_api_client.v1.model.slo_time_slice_spec import SLOTimeSliceSpec
25+
from datadog_api_client.v1.model.slo_count_spec import SLOCountSpec
2526

2627

2728
class ServiceLevelObjective(ModelNormal):
@@ -94,7 +95,7 @@ def __init__(
9495
monitor_ids: Union[List[int], UnsetType] = unset,
9596
monitor_tags: Union[List[str], UnsetType] = unset,
9697
query: Union[ServiceLevelObjectiveQuery, UnsetType] = unset,
97-
sli_specification: Union[SLOSliSpec, SLOTimeSliceSpec, UnsetType] = unset,
98+
sli_specification: Union[SLOSliSpec, SLOTimeSliceSpec, SLOCountSpec, UnsetType] = unset,
9899
tags: Union[List[str], UnsetType] = unset,
99100
target_threshold: Union[float, UnsetType] = unset,
100101
timeframe: Union[SLOTimeframe, UnsetType] = unset,
@@ -151,12 +152,12 @@ def __init__(
151152
:param name: The name of the service level objective object.
152153
:type name: str
153154
154-
:param query: A metric-based SLO. **Required if type is metric**. Note that Datadog only allows the sum by aggregator
155+
:param query: A count-based (metric) SLO query. This field is superseded by ``sli_specification`` but is retained for backwards compatibility. Note that Datadog only allows the sum by aggregator
155156
to be used because this will sum up all request counts instead of averaging them, or taking the max or
156157
min of all of those requests.
157158
:type query: ServiceLevelObjectiveQuery, optional
158159
159-
:param sli_specification: A generic SLI specification. This is currently used for time-slice SLOs only.
160+
:param sli_specification: A generic SLI specification. This is used for time-slice and count-based (metric) SLOs only.
160161
:type sli_specification: SLOSliSpec, optional
161162
162163
:param tags: A list of tags associated with this service level objective.

0 commit comments

Comments
 (0)