Skip to content

Commit 17dfbcc

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Adds OpenTelemetry source support for metrics pipelines (#3581)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent b597057 commit 17dfbcc

File tree

6 files changed

+139
-2
lines changed

6 files changed

+139
-2
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44821,7 +44821,7 @@ components:
4482144821
Protocol (OTLP) over gRPC and HTTP.
4482244822

4482344823

44824-
**Supported pipeline types:** logs'
44824+
**Supported pipeline types:** logs, metrics'
4482544825
properties:
4482644826
grpc_address_key:
4482744827
description: Environment variable name containing the gRPC server address
@@ -44851,6 +44851,7 @@ components:
4485144851
type: object
4485244852
x-pipeline-types:
4485344853
- logs
44854+
- metrics
4485444855
ObservabilityPipelineOpentelemetrySourceType:
4485544856
default: opentelemetry
4485644857
description: The source type. The value should always be `opentelemetry`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2026-03-10T16:11:47.487Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"log": {
3+
"_recordingName": "Observability Pipelines/Validate a metrics pipeline with opentelemetry source returns \"OK\" response",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "fd62c635471ab911f21d26a9cd87afdc",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 499,
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": 582,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"data\":{\"attributes\":{\"config\":{\"destinations\":[{\"id\":\"datadog-metrics-destination\",\"inputs\":[\"my-processor-group\"],\"type\":\"datadog_metrics\"}],\"pipeline_type\":\"metrics\",\"processor_groups\":[{\"enabled\":true,\"id\":\"my-processor-group\",\"include\":\"*\",\"inputs\":[\"opentelemetry-source\"],\"processors\":[{\"enabled\":true,\"id\":\"filter-processor\",\"include\":\"env:production\",\"type\":\"filter\"}]}],\"sources\":[{\"id\":\"opentelemetry-source\",\"type\":\"opentelemetry\"}]},\"name\":\"Metrics OTel Pipeline\"},\"type\":\"pipelines\"}}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v2/obs-pipelines/pipelines/validate"
39+
},
40+
"response": {
41+
"bodySize": 14,
42+
"content": {
43+
"mimeType": "application/vnd.api+json",
44+
"size": 14,
45+
"text": "{\"errors\":[]}\n"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/vnd.api+json"
52+
}
53+
],
54+
"headersSize": 370,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 200,
58+
"statusText": "OK"
59+
},
60+
"startedDateTime": "2026-03-10T16:11:48.649Z",
61+
"time": 211
62+
}
63+
],
64+
"pages": [],
65+
"version": "1.2"
66+
}
67+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* Validate a metrics pipeline with opentelemetry source returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v2.ObservabilityPipelinesApi(configuration);
9+
10+
const params: v2.ObservabilityPipelinesApiValidatePipelineRequest = {
11+
body: {
12+
data: {
13+
attributes: {
14+
config: {
15+
pipelineType: "metrics",
16+
destinations: [
17+
{
18+
id: "datadog-metrics-destination",
19+
inputs: ["my-processor-group"],
20+
type: "datadog_metrics",
21+
},
22+
],
23+
processorGroups: [
24+
{
25+
enabled: true,
26+
id: "my-processor-group",
27+
include: "*",
28+
inputs: ["opentelemetry-source"],
29+
processors: [
30+
{
31+
enabled: true,
32+
id: "filter-processor",
33+
include: "env:production",
34+
type: "filter",
35+
},
36+
],
37+
},
38+
],
39+
sources: [
40+
{
41+
id: "opentelemetry-source",
42+
type: "opentelemetry",
43+
},
44+
],
45+
},
46+
name: "Metrics OTel Pipeline",
47+
},
48+
type: "pipelines",
49+
},
50+
},
51+
};
52+
53+
apiInstance
54+
.validatePipeline(params)
55+
.then((data: v2.ValidationResponse) => {
56+
console.log(
57+
"API called successfully. Returned data: " + JSON.stringify(data)
58+
);
59+
})
60+
.catch((error: any) => console.error(error));

features/v2/observability_pipelines.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,14 @@ Feature: Observability Pipelines
149149
And the response "data.attributes.config.destinations" has length 1
150150
And the response "data.attributes.config.destinations[0].id" is equal to "updated-datadog-logs-destination-id"
151151

152+
@team:DataDog/observability-pipelines
153+
Scenario: Validate a metrics pipeline with opentelemetry source returns "OK" response
154+
Given new "ValidatePipeline" request
155+
And body with value {"data": {"attributes": {"config": {"pipeline_type": "metrics", "destinations": [{"id": "datadog-metrics-destination", "inputs": ["my-processor-group"], "type": "datadog_metrics"}], "processor_groups": [{"enabled": true, "id": "my-processor-group", "include": "*", "inputs": ["opentelemetry-source"], "processors": [{"enabled": true, "id": "filter-processor", "include": "env:production", "type": "filter"}]}], "sources": [{"id": "opentelemetry-source", "type": "opentelemetry"}]}, "name": "Metrics OTel Pipeline"}, "type": "pipelines"}}
156+
When the request is sent
157+
Then the response status is 200 OK
158+
And the response "errors" has length 0
159+
152160
@team:DataDog/observability-pipelines
153161
Scenario: Validate an observability pipeline returns "Bad Request" response
154162
Given new "ValidatePipeline" request

packages/datadog-api-client-v2/models/ObservabilityPipelineOpentelemetrySource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { AttributeTypeMap } from "../../datadog-api-client-common/util";
1111
/**
1212
* The `opentelemetry` source receives telemetry data using the OpenTelemetry Protocol (OTLP) over gRPC and HTTP.
1313
*
14-
* **Supported pipeline types:** logs
14+
* **Supported pipeline types:** logs, metrics
1515
*/
1616
export class ObservabilityPipelineOpentelemetrySource {
1717
/**

0 commit comments

Comments
 (0)