Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2875,6 +2875,7 @@ components:
- ci_tests
- ci_pipelines
- incident_analytics
- product_analytics
example: logs
type: string
x-enum-varnames:
Expand All @@ -2889,6 +2890,7 @@ components:
- CI_TESTS
- CI_PIPELINES
- INCIDENT_ANALYTICS
- PRODUCT_ANALYTICS
FormulaAndFunctionMetricAggregation:
description: The aggregation methods available for metrics queries.
enum:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"2025-09-18T18:51:17.951Z"
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"log": {
"_recordingName": "Dashboards/Create a new timeseries widget with product_analytics data source",
"creator": {
"comment": "persister:fs",
"name": "Polly.JS",
"version": "6.0.5"
},
"entries": [
{
"_id": "8fcc4923c4ef8c94eabcb970afb3a8e2",
"_order": 0,
"cache": {},
"request": {
"bodySize": 678,
"cookies": [],
"headers": [
{
"_fromType": "array",
"name": "accept",
"value": "application/json"
},
{
"_fromType": "array",
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 559,
"httpVersion": "HTTP/1.1",
"method": "POST",
"postData": {
"mimeType": "application/json",
"params": [],
"text": "{\"layout_type\":\"ordered\",\"reflow_type\":\"auto\",\"title\":\"Test-Create_a_new_timeseries_widget_with_product_analytics_data_source-1758221477 with product_analytics datasource\",\"widgets\":[{\"definition\":{\"legend_columns\":[\"avg\",\"min\",\"max\",\"value\",\"sum\"],\"legend_layout\":\"auto\",\"requests\":[{\"display_type\":\"line\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"compute\":{\"aggregation\":\"count\"},\"data_source\":\"product_analytics\",\"group_by\":[],\"indexes\":[\"*\"],\"name\":\"query1\",\"search\":{\"query\":\"test_level:test\"}}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"show_legend\":true,\"time\":{},\"title\":\"\",\"type\":\"timeseries\"}}]}"
},
"queryString": [],
"url": "https://api.datadoghq.com/api/v1/dashboard"
},
"response": {
"bodySize": 1096,
"content": {
"mimeType": "application/json",
"size": 1096,
"text": "{\"id\":\"zvr-td5-ppm\",\"title\":\"Test-Create_a_new_timeseries_widget_with_product_analytics_data_source-1758221477 with product_analytics datasource\",\"description\":null,\"author_handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"author_name\":\"CI Account\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/zvr-td5-ppm/test-createanewtimeserieswidgetwithproductanalyticsdatasource-1758221477-with-pr\",\"template_variables\":null,\"widgets\":[{\"definition\":{\"legend_columns\":[\"avg\",\"min\",\"max\",\"value\",\"sum\"],\"legend_layout\":\"auto\",\"requests\":[{\"display_type\":\"line\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"compute\":{\"aggregation\":\"count\"},\"data_source\":\"product_analytics\",\"group_by\":[],\"indexes\":[\"*\"],\"name\":\"query1\",\"search\":{\"query\":\"test_level:test\"}}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"show_legend\":true,\"time\":{},\"title\":\"\",\"type\":\"timeseries\"},\"id\":6058978575853641}],\"notify_list\":null,\"created_at\":\"2025-09-18T18:51:18.107135+00:00\",\"modified_at\":\"2025-09-18T18:51:18.107135+00:00\",\"reflow_type\":\"auto\",\"restricted_roles\":[]}"
},
"cookies": [],
"headers": [
{
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 381,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2025-09-18T18:51:17.959Z",
"time": 209
},
{
"_id": "b2bcdc4b8964a91c4df0a3bfb46ad9f5",
"_order": 0,
"cache": {},
"request": {
"bodySize": 0,
"cookies": [],
"headers": [
{
"_fromType": "array",
"name": "accept",
"value": "application/json"
}
],
"headersSize": 520,
"httpVersion": "HTTP/1.1",
"method": "DELETE",
"queryString": [],
"url": "https://api.datadoghq.com/api/v1/dashboard/zvr-td5-ppm"
},
"response": {
"bodySize": 39,
"content": {
"mimeType": "application/json",
"size": 39,
"text": "{\"deleted_dashboard_id\":\"zvr-td5-ppm\"}\n"
},
"cookies": [],
"headers": [
{
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 687,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2025-09-18T18:51:18.176Z",
"time": 239
}
],
"pages": [],
"version": "1.2"
}
}
67 changes: 67 additions & 0 deletions examples/v1/dashboards/CreateDashboard_607525069.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* Create a new timeseries widget with product_analytics data source
*/

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

const params: v1.DashboardsApiCreateDashboardRequest = {
body: {
title: "Example-Dashboard with product_analytics datasource",
widgets: [
{
definition: {
title: "",
showLegend: true,
legendLayout: "auto",
legendColumns: ["avg", "min", "max", "value", "sum"],
time: {},
type: "timeseries",
requests: [
{
formulas: [
{
formula: "query1",
},
],
queries: [
{
dataSource: "product_analytics",
name: "query1",
search: {
query: "test_level:test",
},
indexes: ["*"],
compute: {
aggregation: "count",
},
groupBy: [],
},
],
responseFormat: "timeseries",
style: {
palette: "dog_classic",
lineType: "solid",
lineWidth: "normal",
},
displayType: "line",
},
],
},
},
],
layoutType: "ordered",
reflowType: "auto",
},
};

apiInstance
.createDashboard(params)
.then((data: v1.Dashboard) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
9 changes: 9 additions & 0 deletions features/v1/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,15 @@ Feature: Dashboards
And the response "widgets[0].definition.time.value" is equal to 8
And the response "widgets[0].definition.time.hide_incomplete_cost_data" is equal to true

@team:DataDog/dashboards-backend
Scenario: Create a new timeseries widget with product_analytics data source
Given new "CreateDashboard" request
And body with value {"title":"{{ unique }} with product_analytics datasource","widgets":[{"definition":{"title":"","show_legend":true,"legend_layout":"auto","legend_columns":["avg","min","max","value","sum"],"time":{},"type":"timeseries","requests":[{"formulas":[{"formula":"query1"}],"queries":[{"data_source":"product_analytics","name":"query1","search":{"query":"test_level:test"},"indexes":["*"],"compute":{"aggregation":"count"},"group_by":[]}],"response_format":"timeseries","style":{"palette":"dog_classic","line_type":"solid","line_width":"normal"},"display_type":"line"}]}}],"layout_type":"ordered","reflow_type":"auto"}
When the request is sent
Then the response status is 200 OK
And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "product_analytics"
And the response "widgets[0].definition.requests[0].queries[0].search.query" is equal to "test_level:test"

@generated @skip @team:DataDog/reporting-and-sharing
Scenario: Create a shared dashboard returns "Bad Request" response
Given new "CreatePublicDashboard" request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type FormulaAndFunctionEventsDataSource =
| typeof CI_TESTS
| typeof CI_PIPELINES
| typeof INCIDENT_ANALYTICS
| typeof PRODUCT_ANALYTICS
| UnparsedObject;
export const LOGS = "logs";
export const SPANS = "spans";
Expand All @@ -34,3 +35,4 @@ export const EVENTS = "events";
export const CI_TESTS = "ci_tests";
export const CI_PIPELINES = "ci_pipelines";
export const INCIDENT_ANALYTICS = "incident_analytics";
export const PRODUCT_ANALYTICS = "product_analytics";
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,7 @@ const enumsMap: { [key: string]: any[] } = {
"ci_tests",
"ci_pipelines",
"incident_analytics",
"product_analytics",
],
FormulaAndFunctionMetricAggregation: [
"avg",
Expand Down