Skip to content

Commit 70b4cd8

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 442428b of spec repo
1 parent 2d19d28 commit 70b4cd8

File tree

6 files changed

+153
-1
lines changed

6 files changed

+153
-1
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2875,6 +2875,7 @@ components:
28752875
- ci_tests
28762876
- ci_pipelines
28772877
- incident_analytics
2878+
- product_analytics
28782879
example: logs
28792880
type: string
28802881
x-enum-varnames:
@@ -2889,6 +2890,7 @@ components:
28892890
- CI_TESTS
28902891
- CI_PIPELINES
28912892
- INCIDENT_ANALYTICS
2893+
- PRODUCT_ANALYTICS
28922894
FormulaAndFunctionMetricAggregation:
28932895
description: The aggregation methods available for metrics queries.
28942896
enum:
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
"""
2+
Create a new timeseries widget with product_analytics data source
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
7+
from datadog_api_client.v1.model.dashboard import Dashboard
8+
from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType
9+
from datadog_api_client.v1.model.dashboard_reflow_type import DashboardReflowType
10+
from datadog_api_client.v1.model.formula_and_function_event_aggregation import FormulaAndFunctionEventAggregation
11+
from datadog_api_client.v1.model.formula_and_function_event_query_definition import (
12+
FormulaAndFunctionEventQueryDefinition,
13+
)
14+
from datadog_api_client.v1.model.formula_and_function_event_query_definition_compute import (
15+
FormulaAndFunctionEventQueryDefinitionCompute,
16+
)
17+
from datadog_api_client.v1.model.formula_and_function_event_query_definition_search import (
18+
FormulaAndFunctionEventQueryDefinitionSearch,
19+
)
20+
from datadog_api_client.v1.model.formula_and_function_events_data_source import FormulaAndFunctionEventsDataSource
21+
from datadog_api_client.v1.model.formula_and_function_response_format import FormulaAndFunctionResponseFormat
22+
from datadog_api_client.v1.model.timeseries_widget_definition import TimeseriesWidgetDefinition
23+
from datadog_api_client.v1.model.timeseries_widget_definition_type import TimeseriesWidgetDefinitionType
24+
from datadog_api_client.v1.model.timeseries_widget_legend_column import TimeseriesWidgetLegendColumn
25+
from datadog_api_client.v1.model.timeseries_widget_legend_layout import TimeseriesWidgetLegendLayout
26+
from datadog_api_client.v1.model.timeseries_widget_request import TimeseriesWidgetRequest
27+
from datadog_api_client.v1.model.widget import Widget
28+
from datadog_api_client.v1.model.widget_display_type import WidgetDisplayType
29+
from datadog_api_client.v1.model.widget_formula import WidgetFormula
30+
from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan
31+
from datadog_api_client.v1.model.widget_line_type import WidgetLineType
32+
from datadog_api_client.v1.model.widget_line_width import WidgetLineWidth
33+
from datadog_api_client.v1.model.widget_request_style import WidgetRequestStyle
34+
35+
body = Dashboard(
36+
title="Example-Dashboard with product_analytics datasource",
37+
widgets=[
38+
Widget(
39+
definition=TimeseriesWidgetDefinition(
40+
title="",
41+
show_legend=True,
42+
legend_layout=TimeseriesWidgetLegendLayout.AUTO,
43+
legend_columns=[
44+
TimeseriesWidgetLegendColumn.AVG,
45+
TimeseriesWidgetLegendColumn.MIN,
46+
TimeseriesWidgetLegendColumn.MAX,
47+
TimeseriesWidgetLegendColumn.VALUE,
48+
TimeseriesWidgetLegendColumn.SUM,
49+
],
50+
time=WidgetLegacyLiveSpan(),
51+
type=TimeseriesWidgetDefinitionType.TIMESERIES,
52+
requests=[
53+
TimeseriesWidgetRequest(
54+
formulas=[
55+
WidgetFormula(
56+
formula="query1",
57+
),
58+
],
59+
queries=[
60+
FormulaAndFunctionEventQueryDefinition(
61+
data_source=FormulaAndFunctionEventsDataSource.PRODUCT_ANALYTICS,
62+
name="query1",
63+
search=FormulaAndFunctionEventQueryDefinitionSearch(
64+
query="test_level:test",
65+
),
66+
indexes=[
67+
"*",
68+
],
69+
compute=FormulaAndFunctionEventQueryDefinitionCompute(
70+
aggregation=FormulaAndFunctionEventAggregation.COUNT,
71+
),
72+
group_by=[],
73+
),
74+
],
75+
response_format=FormulaAndFunctionResponseFormat.TIMESERIES,
76+
style=WidgetRequestStyle(
77+
palette="dog_classic",
78+
line_type=WidgetLineType.SOLID,
79+
line_width=WidgetLineWidth.NORMAL,
80+
),
81+
display_type=WidgetDisplayType.LINE,
82+
),
83+
],
84+
),
85+
),
86+
],
87+
layout_type=DashboardLayoutType.ORDERED,
88+
reflow_type=DashboardReflowType.AUTO,
89+
)
90+
91+
configuration = Configuration()
92+
with ApiClient(configuration) as api_client:
93+
api_instance = DashboardsApi(api_client)
94+
response = api_instance.create_dashboard(body=body)
95+
96+
print(response)

src/datadog_api_client/v1/model/formula_and_function_events_data_source.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class FormulaAndFunctionEventsDataSource(ModelSimple):
1616
"""
1717
Data source for event platform-based queries.
1818
19-
:param value: Must be one of ["logs", "spans", "network", "rum", "security_signals", "profiles", "audit", "events", "ci_tests", "ci_pipelines", "incident_analytics"].
19+
:param value: Must be one of ["logs", "spans", "network", "rum", "security_signals", "profiles", "audit", "events", "ci_tests", "ci_pipelines", "incident_analytics", "product_analytics"].
2020
:type value: str
2121
"""
2222

@@ -32,6 +32,7 @@ class FormulaAndFunctionEventsDataSource(ModelSimple):
3232
"ci_tests",
3333
"ci_pipelines",
3434
"incident_analytics",
35+
"product_analytics",
3536
}
3637
LOGS: ClassVar["FormulaAndFunctionEventsDataSource"]
3738
SPANS: ClassVar["FormulaAndFunctionEventsDataSource"]
@@ -44,6 +45,7 @@ class FormulaAndFunctionEventsDataSource(ModelSimple):
4445
CI_TESTS: ClassVar["FormulaAndFunctionEventsDataSource"]
4546
CI_PIPELINES: ClassVar["FormulaAndFunctionEventsDataSource"]
4647
INCIDENT_ANALYTICS: ClassVar["FormulaAndFunctionEventsDataSource"]
48+
PRODUCT_ANALYTICS: ClassVar["FormulaAndFunctionEventsDataSource"]
4749

4850
@cached_property
4951
def openapi_types(_):
@@ -63,3 +65,4 @@ def openapi_types(_):
6365
FormulaAndFunctionEventsDataSource.CI_TESTS = FormulaAndFunctionEventsDataSource("ci_tests")
6466
FormulaAndFunctionEventsDataSource.CI_PIPELINES = FormulaAndFunctionEventsDataSource("ci_pipelines")
6567
FormulaAndFunctionEventsDataSource.INCIDENT_ANALYTICS = FormulaAndFunctionEventsDataSource("incident_analytics")
68+
FormulaAndFunctionEventsDataSource.PRODUCT_ANALYTICS = FormulaAndFunctionEventsDataSource("product_analytics")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-09-18T18:51:17.951Z
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
interactions:
2+
- request:
3+
body: '{"layout_type":"ordered","reflow_type":"auto","title":"Test-Create_a_new_timeseries_widget_with_product_analytics_data_source-1758221477
4+
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"}}]}'
5+
headers:
6+
accept:
7+
- application/json
8+
content-type:
9+
- application/json
10+
method: POST
11+
uri: https://api.datadoghq.com/api/v1/dashboard
12+
response:
13+
body:
14+
string: '{"id":"zvr-td5-ppm","title":"Test-Create_a_new_timeseries_widget_with_product_analytics_data_source-1758221477
15+
with product_analytics datasource","description":null,"author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI
16+
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":[]}'
17+
headers:
18+
content-type:
19+
- application/json
20+
status:
21+
code: 200
22+
message: OK
23+
- request:
24+
body: null
25+
headers:
26+
accept:
27+
- application/json
28+
method: DELETE
29+
uri: https://api.datadoghq.com/api/v1/dashboard/zvr-td5-ppm
30+
response:
31+
body:
32+
string: '{"deleted_dashboard_id":"zvr-td5-ppm"}
33+
34+
'
35+
headers:
36+
content-type:
37+
- application/json
38+
status:
39+
code: 200
40+
message: OK
41+
version: 1

tests/v1/features/dashboards.feature

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,15 @@ Feature: Dashboards
950950
And the response "widgets[0].definition.time.value" is equal to 8
951951
And the response "widgets[0].definition.time.hide_incomplete_cost_data" is equal to true
952952

953+
@team:DataDog/dashboards-backend
954+
Scenario: Create a new timeseries widget with product_analytics data source
955+
Given new "CreateDashboard" request
956+
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"}
957+
When the request is sent
958+
Then the response status is 200 OK
959+
And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "product_analytics"
960+
And the response "widgets[0].definition.requests[0].queries[0].search.query" is equal to "test_level:test"
961+
953962
@generated @skip @team:DataDog/reporting-and-sharing
954963
Scenario: Create a shared dashboard returns "Bad Request" response
955964
Given new "CreatePublicDashboard" request

0 commit comments

Comments
 (0)