Skip to content

Commit 1217c67

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 53a6366 of spec repo (#3035)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent e676324 commit 1217c67

11 files changed

Lines changed: 504 additions & 161 deletions

.generator/schemas/v1/openapi.yaml

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12338,33 +12338,73 @@ components:
1233812338
type: object
1233912339
SLOCountDefinition:
1234012340
description: 'A count-based (metric) SLI specification, composed of three parts:
12341-
the good events formula, the total events formula,
12341+
the good events formula,
1234212342

12343-
and the underlying queries.'
12343+
the bad or total events formula, and the underlying queries.
12344+
12345+
Exactly one of `total_events_formula` or `bad_events_formula` must be provided.'
1234412346
example:
12345-
good_events_formula: query1 - query2
12347+
bad_events_formula: query2
12348+
good_events_formula: query1
1234612349
queries:
1234712350
- data_source: metrics
1234812351
name: query1
12349-
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
12352+
query: sum:trace.servlet.request.hits{!http.status_code:500} by {env}.as_count()
1235012353
- data_source: metrics
1235112354
name: query2
12352-
query: sum:trace.servlet.request.errors{*} by {env}.as_count()
12353-
total_events_formula: query1
12355+
query: sum:trace.servlet.request.hits{http.status_code:500} by {env}.as_count()
12356+
oneOf:
12357+
- $ref: '#/components/schemas/SLOCountDefinitionWithTotalEventsFormula'
12358+
- $ref: '#/components/schemas/SLOCountDefinitionWithBadEventsFormula'
12359+
SLOCountDefinitionWithBadEventsFormula:
12360+
additionalProperties: false
1235412361
properties:
12362+
bad_events_formula:
12363+
$ref: '#/components/schemas/SLOFormula'
12364+
description: The bad events formula (recommended). Total events queries
12365+
can be defined using the `total_events_formula` field as an alternative.
12366+
Only one of `total_events_formula` or `bad_events_formula` must be provided.
1235512367
good_events_formula:
1235612368
$ref: '#/components/schemas/SLOFormula'
1235712369
queries:
1235812370
example:
1235912371
- data_source: metrics
1236012372
name: query1
12361-
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
12373+
query: sum:trace.servlet.request.hits{!http.status_code:500} by {env}.as_count()
12374+
- data_source: metrics
12375+
name: query2
12376+
query: sum:trace.servlet.request.hits{http.status_code:500} by {env}.as_count()
12377+
items:
12378+
$ref: '#/components/schemas/SLODataSourceQueryDefinition'
12379+
minItems: 1
12380+
type: array
12381+
required:
12382+
- good_events_formula
12383+
- bad_events_formula
12384+
- queries
12385+
type: object
12386+
SLOCountDefinitionWithTotalEventsFormula:
12387+
additionalProperties: false
12388+
properties:
12389+
good_events_formula:
12390+
$ref: '#/components/schemas/SLOFormula'
12391+
queries:
12392+
example:
12393+
- data_source: metrics
12394+
name: query1
12395+
query: sum:trace.servlet.request.hits{!http.status_code:500} by {env}.as_count()
12396+
- data_source: metrics
12397+
name: query2
12398+
query: sum:trace.servlet.request.hits{http.status_code:500} by {env}.as_count()
1236212399
items:
1236312400
$ref: '#/components/schemas/SLODataSourceQueryDefinition'
1236412401
minItems: 1
1236512402
type: array
1236612403
total_events_formula:
1236712404
$ref: '#/components/schemas/SLOFormula'
12405+
description: The total events formula. Bad events queries can be defined
12406+
using the `bad_events_formula` field as an alternative. Only one of `total_events_formula`
12407+
or `bad_events_formula` must be provided.
1236812408
required:
1236912409
- good_events_formula
1237012410
- total_events_formula
@@ -12375,15 +12415,15 @@ components:
1237512415
description: A metric SLI specification.
1237612416
example:
1237712417
count:
12378-
good_events_formula: query1 - query2
12418+
bad_events_formula: query2
12419+
good_events_formula: query1
1237912420
queries:
1238012421
- data_source: metrics
1238112422
name: query1
12382-
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
12423+
query: sum:trace.servlet.request.hits{!http.status_code:500} by {env}.as_count()
1238312424
- data_source: metrics
1238412425
name: query2
12385-
query: sum:trace.servlet.request.errors{*} by {env}.as_count()
12386-
total_events_formula: query1
12426+
query: sum:trace.servlet.request.hits{http.status_code:500} by {env}.as_count()
1238712427
properties:
1238812428
count:
1238912429
$ref: '#/components/schemas/SLOCountDefinition'
@@ -13519,7 +13559,7 @@ components:
1351913559
name: query1
1352013560
query: sum:trace.servlet.request.hits{*} by {env}.as_count()
1352113561
- data_source: metrics
13522-
name: query1
13562+
name: query2
1352313563
query: sum:trace.servlet.request.errors{*} by {env}.as_count()
1352413564
threshold: 5
1352513565
properties:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2026-02-25T17:45:38.518Z

cassettes/features/v1/service_level_objectives/Create-a-new-metric-SLO-object-using-bad-events-formula-returns-OK-response.yml

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/v1/service-level-objectives/CreateSLO_512760759.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
description: "Metric SLO using sli_specification",
99
name: "Example-Service-Level-Objective",
1010
sli_specification: DatadogAPIClient::V1::SLOCountSpec.new({
11-
count: DatadogAPIClient::V1::SLOCountDefinition.new({
11+
count: DatadogAPIClient::V1::SLOCountDefinitionWithTotalEventsFormula.new({
1212
good_events_formula: DatadogAPIClient::V1::SLOFormula.new({
1313
formula: "query1 - query2",
1414
}),
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Create a new metric SLO object using bad events formula returns "OK" response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V1::ServiceLevelObjectivesAPI.new
5+
6+
body = DatadogAPIClient::V1::ServiceLevelObjectiveRequest.new({
7+
type: DatadogAPIClient::V1::SLOType::METRIC,
8+
description: "Metric SLO using sli_specification",
9+
name: "Example-Service-Level-Objective",
10+
sli_specification: DatadogAPIClient::V1::SLOCountSpec.new({
11+
count: DatadogAPIClient::V1::SLOCountDefinitionWithBadEventsFormula.new({
12+
good_events_formula: DatadogAPIClient::V1::SLOFormula.new({
13+
formula: "query1 - query2",
14+
}),
15+
bad_events_formula: DatadogAPIClient::V1::SLOFormula.new({
16+
formula: "query2",
17+
}),
18+
queries: [
19+
DatadogAPIClient::V1::FormulaAndFunctionMetricQueryDefinition.new({
20+
data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS,
21+
name: "query1",
22+
query: "sum:httpservice.hits{*}.as_count()",
23+
}),
24+
DatadogAPIClient::V1::FormulaAndFunctionMetricQueryDefinition.new({
25+
data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS,
26+
name: "query2",
27+
query: "sum:httpservice.errors{*}.as_count()",
28+
}),
29+
],
30+
}),
31+
}),
32+
tags: [
33+
"env:prod",
34+
"type:count",
35+
],
36+
thresholds: [
37+
DatadogAPIClient::V1::SLOThreshold.new({
38+
target: 99.0,
39+
target_display: "99.0",
40+
timeframe: DatadogAPIClient::V1::SLOTimeframe::SEVEN_DAYS,
41+
warning: 99.5,
42+
warning_display: "99.5",
43+
}),
44+
],
45+
timeframe: DatadogAPIClient::V1::SLOTimeframe::SEVEN_DAYS,
46+
target_threshold: 99.0,
47+
warning_threshold: 99.5,
48+
})
49+
p api_instance.create_slo(body)

features/v1/service_level_objectives.feature

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ Feature: Service Level Objectives
4848
When the request is sent
4949
Then the response status is 200 OK
5050

51+
@team:DataDog/slo-app
52+
Scenario: Create a new metric SLO object using bad events formula returns "OK" response
53+
Given new "CreateSLO" request
54+
And body with value {"type":"metric","description":"Metric SLO using sli_specification","name":"{{ unique }}","sli_specification":{"count":{"good_events_formula":{"formula":"query1 - query2"},"bad_events_formula":{"formula":"query2"},"queries":[{"data_source":"metrics","name":"query1","query":"sum:httpservice.hits{*}.as_count()"},{"data_source":"metrics","name":"query2","query":"sum:httpservice.errors{*}.as_count()"}]}},"tags":["env:prod","type:count"],"thresholds":[{"target":99.0,"target_display":"99.0","timeframe":"7d","warning":99.5,"warning_display":"99.5"}],"timeframe":"7d","target_threshold":99.0,"warning_threshold":99.5}
55+
When the request is sent
56+
Then the response status is 200 OK
57+
And the response "data[0]" has field "sli_specification"
58+
And the response "data[0].sli_specification" has field "count"
59+
And the response "data[0].sli_specification.count" has field "good_events_formula"
60+
And the response "data[0].sli_specification.count" has field "bad_events_formula"
61+
And the response "data[0].sli_specification.count" has field "queries"
62+
And the response "data[0].sli_specification.count.queries" has length 2
63+
5164
@team:DataDog/slo-app
5265
Scenario: Create a new metric SLO object using sli_specification returns "OK" response
5366
Given new "CreateSLO" request
@@ -247,7 +260,7 @@ Feature: Service Level Objectives
247260
Scenario: Update an SLO returns "Not Found" response
248261
Given new "UpdateSLO" request
249262
And request contains "slo_id" parameter from "REPLACE.ME"
250-
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}
263+
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": "query2", "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}
251264
When the request is sent
252265
Then the response status is 404 Not Found
253266

lib/datadog_api_client/inflector.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,8 @@ def overrides
557557
"v1.slo_correction_update_request" => "SLOCorrectionUpdateRequest",
558558
"v1.slo_correction_update_request_attributes" => "SLOCorrectionUpdateRequestAttributes",
559559
"v1.slo_count_definition" => "SLOCountDefinition",
560+
"v1.slo_count_definition_with_bad_events_formula" => "SLOCountDefinitionWithBadEventsFormula",
561+
"v1.slo_count_definition_with_total_events_formula" => "SLOCountDefinitionWithTotalEventsFormula",
560562
"v1.slo_count_spec" => "SLOCountSpec",
561563
"v1.slo_creator" => "SLOCreator",
562564
"v1.slo_data_source_query_definition" => "SLODataSourceQueryDefinition",

0 commit comments

Comments
 (0)