Skip to content

Commit 34e9ddb

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit f80ed75d of spec repo
1 parent 5e18246 commit 34e9ddb

File tree

40 files changed

+793
-77
lines changed

40 files changed

+793
-77
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-01-03 19:28:41.267857",
8-
"spec_repo_commit": "b2d74fec"
7+
"regenerated": "2024-01-04 13:54:27.915527",
8+
"spec_repo_commit": "f80ed75d"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-01-03 19:28:41.286788",
13-
"spec_repo_commit": "b2d74fec"
12+
"regenerated": "2024-01-04 13:54:27.980352",
13+
"spec_repo_commit": "f80ed75d"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10244,6 +10244,13 @@ components:
1024410244
nullable: true
1024510245
type: string
1024610246
type: object
10247+
SLODataSourceQueryDefinition:
10248+
description: A formula and function query.
10249+
example:
10250+
data_source: metrics
10251+
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
10252+
oneOf:
10253+
- $ref: '#/components/schemas/FormulaAndFunctionMetricQueryDefinition'
1024710254
SLODeleteResponse:
1024810255
description: A response list of all service level objective deleted.
1024910256
properties:
@@ -10287,6 +10294,20 @@ components:
1028710294
- THIRTY_DAYS
1028810295
- NINETY_DAYS
1028910296
- ALL
10297+
SLOFormula:
10298+
description: A formula that specifies how to combine the results of multiple
10299+
queries.
10300+
example:
10301+
formula: query1 - default_zero(query2)
10302+
properties:
10303+
formula:
10304+
description: The formula string, which is an expression involving named
10305+
queries.
10306+
example: query1 - default_zero(query2)
10307+
type: string
10308+
required:
10309+
- formula
10310+
type: object
1029010311
SLOHistoryMetrics:
1029110312
description: 'A `metric` based SLO history response.
1029210313

@@ -11016,6 +11037,8 @@ components:
1101611037
type: string
1101711038
query:
1101811039
$ref: '#/components/schemas/ServiceLevelObjectiveQuery'
11040+
sli_specification:
11041+
$ref: '#/components/schemas/SLOSliSpec'
1101911042
tags:
1102011043
description: 'A list of tags associated with this service level objective.
1102111044

@@ -11070,6 +11093,11 @@ components:
1107011093
format: double
1107111094
type: number
1107211095
type: object
11096+
SLOSliSpec:
11097+
description: A generic SLI specification. This is currently used for time-slice
11098+
SLOs only.
11099+
oneOf:
11100+
- $ref: '#/components/schemas/SLOTimeSliceSpec'
1107311101
SLOState:
1107411102
description: State of the SLO.
1107511103
enum:
@@ -11170,6 +11198,106 @@ components:
1117011198
- timeframe
1117111199
- target
1117211200
type: object
11201+
SLOTimeSliceComparator:
11202+
description: The comparator used to compare the SLI value to the threshold.
11203+
enum:
11204+
- '>'
11205+
- '>='
11206+
- <
11207+
- <=
11208+
example: '>'
11209+
type: string
11210+
x-enum-varnames:
11211+
- GREATER
11212+
- GREATER_EQUAL
11213+
- LESS
11214+
- LESS_EQUAL
11215+
SLOTimeSliceCondition:
11216+
description: 'The time slice condition, composed of 3 parts: 1. the metric timeseries
11217+
query, 2. the comparator,
11218+
11219+
and 3. the threshold.'
11220+
example:
11221+
comparator: <
11222+
query:
11223+
formulas:
11224+
- formula: query2/query1
11225+
queries:
11226+
- data_source: metrics
11227+
name: query1
11228+
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
11229+
- data_source: metrics
11230+
name: query1
11231+
query: sum:trace.servlet.request.errors{*} by {env}.as_count()
11232+
threshold: 5
11233+
properties:
11234+
comparator:
11235+
$ref: '#/components/schemas/SLOTimeSliceComparator'
11236+
query:
11237+
$ref: '#/components/schemas/SLOTimeSliceQuery'
11238+
threshold:
11239+
description: The threshold value to which each SLI value will be compared.
11240+
example: 5
11241+
format: double
11242+
type: number
11243+
required:
11244+
- comparator
11245+
- threshold
11246+
- query
11247+
type: object
11248+
SLOTimeSliceQuery:
11249+
description: The queries and formula used to calculate the SLI value.
11250+
example:
11251+
formulas:
11252+
- formula: query2/query1
11253+
queries:
11254+
- data_source: metrics
11255+
name: query1
11256+
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
11257+
- data_source: metrics
11258+
name: query1
11259+
query: sum:trace.servlet.request.errors{*} by {env}.as_count()
11260+
properties:
11261+
formulas:
11262+
description: A list that contains exactly one formula, as only a single
11263+
formula may be used in a time-slice SLO.
11264+
items:
11265+
$ref: '#/components/schemas/SLOFormula'
11266+
maxItems: 1
11267+
minItems: 1
11268+
type: array
11269+
queries:
11270+
description: A list of queries that are used to calculate the SLI value.
11271+
items:
11272+
$ref: '#/components/schemas/SLODataSourceQueryDefinition'
11273+
type: array
11274+
required:
11275+
- formulas
11276+
- queries
11277+
type: object
11278+
SLOTimeSliceSpec:
11279+
additionalProperties: false
11280+
description: A time slice SLI specification.
11281+
example:
11282+
time_slice:
11283+
comparator: <
11284+
query:
11285+
formulas:
11286+
- formula: query2/query1
11287+
queries:
11288+
- data_source: metrics
11289+
name: query1
11290+
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
11291+
- data_source: metrics
11292+
name: query1
11293+
query: sum:trace.servlet.request.errors{*} by {env}.as_count()
11294+
threshold: 5
11295+
properties:
11296+
time_slice:
11297+
$ref: '#/components/schemas/SLOTimeSliceCondition'
11298+
required:
11299+
- time_slice
11300+
type: object
1117311301
SLOTimeframe:
1117411302
description: The SLO time window options.
1117511303
enum:
@@ -11189,11 +11317,13 @@ components:
1118911317
enum:
1119011318
- metric
1119111319
- monitor
11320+
- time_slice
1119211321
example: metric
1119311322
type: string
1119411323
x-enum-varnames:
1119511324
- METRIC
1119611325
- MONITOR
11326+
- TIME_SLICE
1119711327
SLOTypeNumeric:
1119811328
description: 'A numeric representation of the type of the service level objective
1119911329
(`0` for
@@ -11204,12 +11334,14 @@ components:
1120411334
enum:
1120511335
- 0
1120611336
- 1
11337+
- 2
1120711338
example: 0
1120811339
format: int32
1120911340
type: integer
1121011341
x-enum-varnames:
1121111342
- MONITOR
1121211343
- METRIC
11344+
- TIME_SLICE
1121311345
SLOWidgetDefinition:
1121411346
description: Use the SLO and uptime widget to track your SLOs (Service Level
1121511347
Objectives) and uptime on screenboards and timeboards.
@@ -12019,6 +12151,8 @@ components:
1201912151
type: string
1202012152
query:
1202112153
$ref: '#/components/schemas/ServiceLevelObjectiveQuery'
12154+
sli_specification:
12155+
$ref: '#/components/schemas/SLOSliSpec'
1202212156
tags:
1202312157
description: 'A list of tags associated with this service level objective.
1202412158

@@ -12148,6 +12282,8 @@ components:
1214812282
type: string
1214912283
query:
1215012284
$ref: '#/components/schemas/ServiceLevelObjectiveQuery'
12285+
sli_specification:
12286+
$ref: '#/components/schemas/SLOSliSpec'
1215112287
tags:
1215212288
description: 'A list of tags associated with this service level objective.
1215312289

docs/datadog_api_client.v1.model.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3333,6 +3333,13 @@ slo\_creator
33333333
:members:
33343334
:show-inheritance:
33353335

3336+
slo\_data\_source\_query\_definition
3337+
------------------------------------
3338+
3339+
.. automodule:: datadog_api_client.v1.model.slo_data_source_query_definition
3340+
:members:
3341+
:show-inheritance:
3342+
33363343
slo\_delete\_response
33373344
---------------------
33383345

@@ -3354,6 +3361,13 @@ slo\_error\_timeframe
33543361
:members:
33553362
:show-inheritance:
33563363

3364+
slo\_formula
3365+
------------
3366+
3367+
.. automodule:: datadog_api_client.v1.model.slo_formula
3368+
:members:
3369+
:show-inheritance:
3370+
33573371
slo\_history\_metrics
33583372
---------------------
33593373

@@ -3508,6 +3522,13 @@ slo\_response\_data
35083522
:members:
35093523
:show-inheritance:
35103524

3525+
slo\_sli\_spec
3526+
--------------
3527+
3528+
.. automodule:: datadog_api_client.v1.model.slo_sli_spec
3529+
:members:
3530+
:show-inheritance:
3531+
35113532
slo\_state
35123533
----------
35133534

@@ -3529,6 +3550,34 @@ slo\_threshold
35293550
:members:
35303551
:show-inheritance:
35313552

3553+
slo\_time\_slice\_comparator
3554+
----------------------------
3555+
3556+
.. automodule:: datadog_api_client.v1.model.slo_time_slice_comparator
3557+
:members:
3558+
:show-inheritance:
3559+
3560+
slo\_time\_slice\_condition
3561+
---------------------------
3562+
3563+
.. automodule:: datadog_api_client.v1.model.slo_time_slice_condition
3564+
:members:
3565+
:show-inheritance:
3566+
3567+
slo\_time\_slice\_query
3568+
-----------------------
3569+
3570+
.. automodule:: datadog_api_client.v1.model.slo_time_slice_query
3571+
:members:
3572+
:show-inheritance:
3573+
3574+
slo\_time\_slice\_spec
3575+
----------------------
3576+
3577+
.. automodule:: datadog_api_client.v1.model.slo_time_slice_spec
3578+
:members:
3579+
:show-inheritance:
3580+
35323581
slo\_timeframe
35333582
--------------
35343583

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
"""
2+
Create a time-slice SLO object 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_formula import SLOFormula
13+
from datadog_api_client.v1.model.slo_threshold import SLOThreshold
14+
from datadog_api_client.v1.model.slo_time_slice_comparator import SLOTimeSliceComparator
15+
from datadog_api_client.v1.model.slo_time_slice_condition import SLOTimeSliceCondition
16+
from datadog_api_client.v1.model.slo_time_slice_query import SLOTimeSliceQuery
17+
from datadog_api_client.v1.model.slo_time_slice_spec import SLOTimeSliceSpec
18+
from datadog_api_client.v1.model.slo_timeframe import SLOTimeframe
19+
from datadog_api_client.v1.model.slo_type import SLOType
20+
21+
body = ServiceLevelObjectiveRequest(
22+
type=SLOType.TIME_SLICE,
23+
description="string",
24+
name="Example-Service-Level-Objective",
25+
sli_specification=SLOTimeSliceSpec(
26+
time_slice=SLOTimeSliceCondition(
27+
query=SLOTimeSliceQuery(
28+
formulas=[
29+
SLOFormula(
30+
formula="query1",
31+
),
32+
],
33+
queries=[
34+
FormulaAndFunctionMetricQueryDefinition(
35+
data_source=FormulaAndFunctionMetricDataSource.METRICS,
36+
name="query1",
37+
query="trace.servlet.request{env:prod}",
38+
),
39+
],
40+
),
41+
comparator=SLOTimeSliceComparator.GREATER,
42+
threshold=5.0,
43+
),
44+
),
45+
tags=[
46+
"env:prod",
47+
],
48+
thresholds=[
49+
SLOThreshold(
50+
target=97.0,
51+
target_display="97.0",
52+
timeframe=SLOTimeframe.SEVEN_DAYS,
53+
warning=98.0,
54+
warning_display="98.0",
55+
),
56+
],
57+
timeframe=SLOTimeframe.SEVEN_DAYS,
58+
target_threshold=97.0,
59+
warning_threshold=98.0,
60+
)
61+
62+
configuration = Configuration()
63+
with ApiClient(configuration) as api_client:
64+
api_instance = ServiceLevelObjectivesApi(api_client)
65+
response = api_instance.create_slo(body=body)
66+
67+
print(response)

0 commit comments

Comments
 (0)