Skip to content

Commit 85648d8

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Make datadog agent source address configurable in Observability Pipelines (#3724)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 2bea7ca commit 85648d8

File tree

12 files changed

+315
-77
lines changed

12 files changed

+315
-77
lines changed

.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:

.generator/schemas/v2/openapi.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42913,6 +42913,11 @@ components:
4291342913

4291442914
**Supported pipeline types:** logs, metrics'
4291542915
properties:
42916+
address_key:
42917+
description: Name of the environment variable or secret that holds the listen
42918+
address for the Datadog Agent source.
42919+
example: DATADOG_AGENT_ADDRESS
42920+
type: string
4291642921
id:
4291742922
description: The unique identifier for this component. Used in other parts
4291842923
of the pipeline to reference this component (for example, as the `input`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2026-02-25T17:45:38.518Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"log": {
3+
"_recordingName": "Service Level Objectives/Create a new metric SLO object using bad events formula returns \"OK\" response",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "d5693d5eee1eafa788d069277375e5d9",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 690,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "content-type",
26+
"value": "application/json"
27+
}
28+
],
29+
"headersSize": 547,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"description\":\"Metric SLO using sli_specification\",\"name\":\"Test-Create_a_new_metric_SLO_object_using_bad_events_formula_returns_OK_response-1772041538\",\"sli_specification\":{\"count\":{\"bad_events_formula\":{\"formula\":\"query2\"},\"good_events_formula\":{\"formula\":\"query1 - 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\"],\"target_threshold\":99,\"thresholds\":[{\"target\":99,\"target_display\":\"99.0\",\"timeframe\":\"7d\",\"warning\":99.5,\"warning_display\":\"99.5\"}],\"timeframe\":\"7d\",\"type\":\"metric\",\"warning_threshold\":99.5}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v1/slo"
39+
},
40+
"response": {
41+
"bodySize": 1196,
42+
"content": {
43+
"mimeType": "application/json",
44+
"size": 1196,
45+
"text": "{\"data\":[{\"id\":\"7309ff3752fd519f80f65a2ed3247dbb\",\"name\":\"Test-Create_a_new_metric_SLO_object_using_bad_events_formula_returns_OK_response-1772041538\",\"tags\":[\"env:prod\",\"type:count\"],\"monitor_tags\":[],\"thresholds\":[{\"timeframe\":\"7d\",\"target\":99.0,\"target_display\":\"99.\",\"warning\":99.5,\"warning_display\":\"99.5\"}],\"type\":\"metric\",\"type_id\":1,\"description\":\"Metric SLO using sli_specification\",\"timeframe\":\"7d\",\"warning_threshold\":99.5,\"target_threshold\":99,\"query\":{\"numerator\":\"sum:httpservice.hits{*}.as_count() - sum:httpservice.errors{*}.as_count()\",\"denominator\":\"(sum:httpservice.hits{*}.as_count() - sum:httpservice.errors{*}.as_count()) + (sum:httpservice.errors{*}.as_count())\"},\"creator\":{\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"email\":\"team-intg-tools-libs-spam@datadoghq.com\"},\"created_at\":1772041538,\"modified_at\":1772041538,\"sli_specification\":{\"count\":{\"bad_events_formula\":{\"formula\":\"query2\"},\"good_events_formula\":{\"formula\":\"query1 - query2\"},\"queries\":[{\"data_source\":\"metrics\",\"name\":\"query1\",\"query\":\"sum:httpservice.hits{*}.as_count()\"},{\"data_source\":\"metrics\",\"name\":\"query2\",\"query\":\"sum:httpservice.errors{*}.as_count()\"}]}}}],\"error\":null}\n"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/json"
52+
}
53+
],
54+
"headersSize": 678,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 200,
58+
"statusText": "OK"
59+
},
60+
"startedDateTime": "2026-02-25T17:45:38.526Z",
61+
"time": 172
62+
},
63+
{
64+
"_id": "c0933b3f30b7b24a0ddbdcdf3c1ea62d",
65+
"_order": 0,
66+
"cache": {},
67+
"request": {
68+
"bodySize": 0,
69+
"cookies": [],
70+
"headers": [
71+
{
72+
"_fromType": "array",
73+
"name": "accept",
74+
"value": "application/json"
75+
}
76+
],
77+
"headersSize": 528,
78+
"httpVersion": "HTTP/1.1",
79+
"method": "DELETE",
80+
"queryString": [],
81+
"url": "https://api.datadoghq.com/api/v1/slo/7309ff3752fd519f80f65a2ed3247dbb"
82+
},
83+
"response": {
84+
"bodySize": 59,
85+
"content": {
86+
"mimeType": "application/json",
87+
"size": 59,
88+
"text": "{\"data\":[\"7309ff3752fd519f80f65a2ed3247dbb\"],\"error\":null}\n"
89+
},
90+
"cookies": [],
91+
"headers": [
92+
{
93+
"name": "content-type",
94+
"value": "application/json"
95+
}
96+
],
97+
"headersSize": 674,
98+
"httpVersion": "HTTP/1.1",
99+
"redirectURL": "",
100+
"status": 200,
101+
"statusText": "OK"
102+
},
103+
"startedDateTime": "2026-02-25T17:45:38.707Z",
104+
"time": 219
105+
}
106+
],
107+
"pages": [],
108+
"version": "1.2"
109+
}
110+
}

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

services/observability_pipelines/src/v2/models/ObservabilityPipelineDatadogAgentSource.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import { ObservabilityPipelineTls } from "./ObservabilityPipelineTls";
99
* **Supported pipeline types:** logs, metrics
1010
*/
1111
export class ObservabilityPipelineDatadogAgentSource {
12+
/**
13+
* Name of the environment variable or secret that holds the listen address for the Datadog Agent source.
14+
*/
15+
"addressKey"?: string;
1216
/**
1317
* The unique identifier for this component. Used in other parts of the pipeline to reference this component (for example, as the `input` to downstream components).
1418
*/
@@ -36,6 +40,10 @@ export class ObservabilityPipelineDatadogAgentSource {
3640
* @ignore
3741
*/
3842
static readonly attributeTypeMap: AttributeTypeMap = {
43+
addressKey: {
44+
baseName: "address_key",
45+
type: "string",
46+
},
3947
id: {
4048
baseName: "id",
4149
type: "string",

services/service_level_objectives/src/v1/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ export { SLOCorrectionResponseAttributes } from "./models/SLOCorrectionResponseA
5050
export { SLOCorrectionResponseAttributesModifier } from "./models/SLOCorrectionResponseAttributesModifier";
5151
export { SLOCorrectionType } from "./models/SLOCorrectionType";
5252
export { SLOCountDefinition } from "./models/SLOCountDefinition";
53+
export { SLOCountDefinitionWithBadEventsFormula } from "./models/SLOCountDefinitionWithBadEventsFormula";
54+
export { SLOCountDefinitionWithTotalEventsFormula } from "./models/SLOCountDefinitionWithTotalEventsFormula";
5355
export { SLOCountSpec } from "./models/SLOCountSpec";
5456
export { SLOCreator } from "./models/SLOCreator";
5557
export { SLODataSourceQueryDefinition } from "./models/SLODataSourceQueryDefinition";
Lines changed: 10 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,14 @@
1-
import { AttributeTypeMap } from "@datadog/datadog-api-client";
1+
import { UnparsedObject } from "@datadog/datadog-api-client";
22

3-
import { SLODataSourceQueryDefinition } from "./SLODataSourceQueryDefinition";
4-
import { SLOFormula } from "./SLOFormula";
3+
import { SLOCountDefinitionWithBadEventsFormula } from "./SLOCountDefinitionWithBadEventsFormula";
4+
import { SLOCountDefinitionWithTotalEventsFormula } from "./SLOCountDefinitionWithTotalEventsFormula";
55

66
/**
7-
* A count-based (metric) SLI specification, composed of three parts: the good events formula, the total events formula,
8-
* and the underlying queries.
7+
* A count-based (metric) SLI specification, composed of three parts: the good events formula,
8+
* the bad or total events formula, and the underlying queries.
9+
* Exactly one of `total_events_formula` or `bad_events_formula` must be provided.
910
*/
10-
export class SLOCountDefinition {
11-
/**
12-
* A formula that specifies how to combine the results of multiple queries.
13-
*/
14-
"goodEventsFormula": SLOFormula;
15-
"queries": Array<SLODataSourceQueryDefinition>;
16-
/**
17-
* A formula that specifies how to combine the results of multiple queries.
18-
*/
19-
"totalEventsFormula": SLOFormula;
20-
/**
21-
* A container for additional, undeclared properties.
22-
* This is a holder for any undeclared properties as specified with
23-
* the 'additionalProperties' keyword in the OAS document.
24-
*/
25-
"additionalProperties"?: { [key: string]: any };
26-
/**
27-
* @ignore
28-
*/
29-
"_unparsed"?: boolean;
30-
31-
/**
32-
* @ignore
33-
*/
34-
static readonly attributeTypeMap: AttributeTypeMap = {
35-
goodEventsFormula: {
36-
baseName: "good_events_formula",
37-
type: "SLOFormula",
38-
required: true,
39-
},
40-
queries: {
41-
baseName: "queries",
42-
type: "Array<SLODataSourceQueryDefinition>",
43-
required: true,
44-
},
45-
totalEventsFormula: {
46-
baseName: "total_events_formula",
47-
type: "SLOFormula",
48-
required: true,
49-
},
50-
additionalProperties: {
51-
baseName: "additionalProperties",
52-
type: "{ [key: string]: any; }",
53-
},
54-
};
55-
56-
/**
57-
* @ignore
58-
*/
59-
static getAttributeTypeMap(): AttributeTypeMap {
60-
return SLOCountDefinition.attributeTypeMap;
61-
}
62-
63-
public constructor() {}
64-
}
11+
export type SLOCountDefinition =
12+
| SLOCountDefinitionWithTotalEventsFormula
13+
| SLOCountDefinitionWithBadEventsFormula
14+
| UnparsedObject;

0 commit comments

Comments
 (0)