diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index a1335722ca47..dc6c8110eef5 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -2875,6 +2875,7 @@ components: - ci_tests - ci_pipelines - incident_analytics + - product_analytics example: logs type: string x-enum-varnames: @@ -2889,6 +2890,7 @@ components: - CI_TESTS - CI_PIPELINES - INCIDENT_ANALYTICS + - PRODUCT_ANALYTICS FormulaAndFunctionMetricAggregation: description: The aggregation methods available for metrics queries. enum: diff --git a/cassettes/v1/Dashboards_1335235736/Create-a-new-timeseries-widget-with-product_analytics-data-source_3012914237/frozen.json b/cassettes/v1/Dashboards_1335235736/Create-a-new-timeseries-widget-with-product_analytics-data-source_3012914237/frozen.json new file mode 100644 index 000000000000..32d2617c6591 --- /dev/null +++ b/cassettes/v1/Dashboards_1335235736/Create-a-new-timeseries-widget-with-product_analytics-data-source_3012914237/frozen.json @@ -0,0 +1 @@ +"2025-09-18T18:51:17.951Z" diff --git a/cassettes/v1/Dashboards_1335235736/Create-a-new-timeseries-widget-with-product_analytics-data-source_3012914237/recording.har b/cassettes/v1/Dashboards_1335235736/Create-a-new-timeseries-widget-with-product_analytics-data-source_3012914237/recording.har new file mode 100644 index 000000000000..c3a6cfd38452 --- /dev/null +++ b/cassettes/v1/Dashboards_1335235736/Create-a-new-timeseries-widget-with-product_analytics-data-source_3012914237/recording.har @@ -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" + } +} diff --git a/features/v1/dashboards.feature b/features/v1/dashboards.feature index f267082830d0..0d161522e954 100644 --- a/features/v1/dashboards.feature +++ b/features/v1/dashboards.feature @@ -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 diff --git a/services/dashboards/src/v1/models/FormulaAndFunctionEventsDataSource.ts b/services/dashboards/src/v1/models/FormulaAndFunctionEventsDataSource.ts index 28688d33bc6b..e52e7a54da96 100644 --- a/services/dashboards/src/v1/models/FormulaAndFunctionEventsDataSource.ts +++ b/services/dashboards/src/v1/models/FormulaAndFunctionEventsDataSource.ts @@ -15,6 +15,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"; @@ -27,3 +28,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"; diff --git a/services/dashboards/src/v1/models/TypingInfo.ts b/services/dashboards/src/v1/models/TypingInfo.ts index f2000ae6a61f..3bfe1b7e52e2 100644 --- a/services/dashboards/src/v1/models/TypingInfo.ts +++ b/services/dashboards/src/v1/models/TypingInfo.ts @@ -234,6 +234,7 @@ export const TypingInfo: ModelTypingInfo = { "ci_tests", "ci_pipelines", "incident_analytics", + "product_analytics", ], FormulaAndFunctionMetricAggregation: [ "avg", diff --git a/services/notebooks/src/v1/models/FormulaAndFunctionEventsDataSource.ts b/services/notebooks/src/v1/models/FormulaAndFunctionEventsDataSource.ts index 28688d33bc6b..e52e7a54da96 100644 --- a/services/notebooks/src/v1/models/FormulaAndFunctionEventsDataSource.ts +++ b/services/notebooks/src/v1/models/FormulaAndFunctionEventsDataSource.ts @@ -15,6 +15,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"; @@ -27,3 +28,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"; diff --git a/services/notebooks/src/v1/models/TypingInfo.ts b/services/notebooks/src/v1/models/TypingInfo.ts index cc772a18e782..f88f0becc765 100644 --- a/services/notebooks/src/v1/models/TypingInfo.ts +++ b/services/notebooks/src/v1/models/TypingInfo.ts @@ -144,6 +144,7 @@ export const TypingInfo: ModelTypingInfo = { "ci_tests", "ci_pipelines", "incident_analytics", + "product_analytics", ], FormulaAndFunctionMetricAggregation: [ "avg",