diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 0e64921915..58361804a6 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -2962,10 +2962,7 @@ components: data_source: $ref: '#/components/schemas/FormulaAndFunctionEventsDataSource' group_by: - description: Group by options. - items: - $ref: '#/components/schemas/FormulaAndFunctionEventQueryGroupBy' - type: array + $ref: '#/components/schemas/FormulaAndFunctionEventQueryGroupByConfig' indexes: description: An array of index names to query in the stream. Omit or use `[]` to query all indexes at once. @@ -3037,6 +3034,39 @@ components: required: - facet type: object + FormulaAndFunctionEventQueryGroupByConfig: + description: Group by configuration for a formula and functions events query. + Can be a list of facet objects or a flat object with a list of fields. + oneOf: + - $ref: '#/components/schemas/FormulaAndFunctionEventQueryGroupByList' + - $ref: '#/components/schemas/FormulaAndFunctionEventQueryGroupByFields' + FormulaAndFunctionEventQueryGroupByFields: + description: Flat group by using multiple event facets. + properties: + fields: + description: List of event facets to group by. + example: + - hostname + - service + items: + description: Event facet. + type: string + type: array + limit: + description: Number of groups to return. + example: 10 + format: int64 + type: integer + sort: + $ref: '#/components/schemas/FormulaAndFunctionEventQueryGroupBySort' + required: + - fields + type: object + FormulaAndFunctionEventQueryGroupByList: + description: List of objects used to group by. + items: + $ref: '#/components/schemas/FormulaAndFunctionEventQueryGroupBy' + type: array FormulaAndFunctionEventQueryGroupBySort: description: Options for sorting group by results. properties: diff --git a/docs/datadog_api_client.v1.model.rst b/docs/datadog_api_client.v1.model.rst index b20c86c2ba..016a2aae8f 100644 --- a/docs/datadog_api_client.v1.model.rst +++ b/docs/datadog_api_client.v1.model.rst @@ -928,6 +928,20 @@ datadog\_api\_client.v1.model.formula\_and\_function\_event\_query\_group\_by mo :members: :show-inheritance: +datadog\_api\_client.v1.model.formula\_and\_function\_event\_query\_group\_by\_config module +-------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.formula_and_function_event_query_group_by_config + :members: + :show-inheritance: + +datadog\_api\_client.v1.model.formula\_and\_function\_event\_query\_group\_by\_fields module +-------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v1.model.formula_and_function_event_query_group_by_fields + :members: + :show-inheritance: + datadog\_api\_client.v1.model.formula\_and\_function\_event\_query\_group\_by\_sort module ------------------------------------------------------------------------------------------ diff --git a/examples/v1/dashboards/CreateDashboard_1024858348.py b/examples/v1/dashboards/CreateDashboard_1024858348.py index 8e9895050a..aefb09f82a 100644 --- a/examples/v1/dashboards/CreateDashboard_1024858348.py +++ b/examples/v1/dashboards/CreateDashboard_1024858348.py @@ -55,7 +55,6 @@ compute=FormulaAndFunctionEventQueryDefinitionCompute( aggregation=FormulaAndFunctionEventAggregation.COUNT, ), - group_by=[], ), ], response_format=FormulaAndFunctionResponseFormat.SCALAR, diff --git a/examples/v1/dashboards/CreateDashboard_2064651578.py b/examples/v1/dashboards/CreateDashboard_2064651578.py index 30d4a0e328..8a80841b8a 100644 --- a/examples/v1/dashboards/CreateDashboard_2064651578.py +++ b/examples/v1/dashboards/CreateDashboard_2064651578.py @@ -64,7 +64,6 @@ compute=FormulaAndFunctionEventQueryDefinitionCompute( aggregation=FormulaAndFunctionEventAggregation.COUNT, ), - group_by=[], ), ], response_format=FormulaAndFunctionResponseFormat.SCALAR, diff --git a/examples/v1/dashboards/CreateDashboard_2490110261.py b/examples/v1/dashboards/CreateDashboard_2490110261.py index 7a0ebfd245..282951688a 100644 --- a/examples/v1/dashboards/CreateDashboard_2490110261.py +++ b/examples/v1/dashboards/CreateDashboard_2490110261.py @@ -47,7 +47,6 @@ indexes=[ "*", ], - group_by=[], ), ], ), diff --git a/examples/v1/dashboards/CreateDashboard_3882428227.py b/examples/v1/dashboards/CreateDashboard_3882428227.py index 3c0a8c2d56..16789da22d 100644 --- a/examples/v1/dashboards/CreateDashboard_3882428227.py +++ b/examples/v1/dashboards/CreateDashboard_3882428227.py @@ -65,7 +65,6 @@ indexes=[ "*", ], - group_by=[], ), request_type=WidgetHistogramRequestType.HISTOGRAM, ), diff --git a/examples/v1/dashboards/CreateDashboard_4018282928.py b/examples/v1/dashboards/CreateDashboard_4018282928.py new file mode 100644 index 0000000000..27daf9de30 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_4018282928.py @@ -0,0 +1,77 @@ +""" +Create a new dashboard with formulas and functions events query using flat group by fields +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v1.api.dashboards_api import DashboardsApi +from datadog_api_client.v1.model.dashboard import Dashboard +from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType +from datadog_api_client.v1.model.formula_and_function_event_aggregation import FormulaAndFunctionEventAggregation +from datadog_api_client.v1.model.formula_and_function_event_query_definition import ( + FormulaAndFunctionEventQueryDefinition, +) +from datadog_api_client.v1.model.formula_and_function_event_query_definition_compute import ( + FormulaAndFunctionEventQueryDefinitionCompute, +) +from datadog_api_client.v1.model.formula_and_function_event_query_definition_search import ( + FormulaAndFunctionEventQueryDefinitionSearch, +) +from datadog_api_client.v1.model.formula_and_function_event_query_group_by_fields import ( + FormulaAndFunctionEventQueryGroupByFields, +) +from datadog_api_client.v1.model.formula_and_function_events_data_source import FormulaAndFunctionEventsDataSource +from datadog_api_client.v1.model.formula_and_function_response_format import FormulaAndFunctionResponseFormat +from datadog_api_client.v1.model.timeseries_widget_definition import TimeseriesWidgetDefinition +from datadog_api_client.v1.model.timeseries_widget_definition_type import TimeseriesWidgetDefinitionType +from datadog_api_client.v1.model.timeseries_widget_request import TimeseriesWidgetRequest +from datadog_api_client.v1.model.widget import Widget +from datadog_api_client.v1.model.widget_layout import WidgetLayout + +body = Dashboard( + title="Example-Dashboard with events flat group_by fields", + widgets=[ + Widget( + definition=TimeseriesWidgetDefinition( + type=TimeseriesWidgetDefinitionType.TIMESERIES, + requests=[ + TimeseriesWidgetRequest( + response_format=FormulaAndFunctionResponseFormat.TIMESERIES, + queries=[ + FormulaAndFunctionEventQueryDefinition( + data_source=FormulaAndFunctionEventsDataSource.EVENTS, + name="query1", + search=FormulaAndFunctionEventQueryDefinitionSearch( + query="", + ), + compute=FormulaAndFunctionEventQueryDefinitionCompute( + aggregation=FormulaAndFunctionEventAggregation.COUNT, + ), + group_by=FormulaAndFunctionEventQueryGroupByFields( + fields=[ + "service", + "host", + ], + limit=10, + ), + ), + ], + ), + ], + ), + layout=WidgetLayout( + x=0, + y=0, + width=4, + height=2, + ), + ), + ], + layout_type=DashboardLayoutType.ORDERED, +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = DashboardsApi(api_client) + response = api_instance.create_dashboard(body=body) + + print(response) diff --git a/examples/v1/dashboards/CreateDashboard_578885732.py b/examples/v1/dashboards/CreateDashboard_578885732.py index 3358249f25..d7e07feed2 100644 --- a/examples/v1/dashboards/CreateDashboard_578885732.py +++ b/examples/v1/dashboards/CreateDashboard_578885732.py @@ -64,7 +64,6 @@ compute=FormulaAndFunctionEventQueryDefinitionCompute( aggregation=FormulaAndFunctionEventAggregation.COUNT, ), - group_by=[], ), ], response_format=FormulaAndFunctionResponseFormat.SCALAR, diff --git a/examples/v1/dashboards/CreateDashboard_732700533.py b/examples/v1/dashboards/CreateDashboard_732700533.py new file mode 100644 index 0000000000..3d4872bf04 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_732700533.py @@ -0,0 +1,74 @@ +""" +Create a new dashboard with formulas and functions events query using facet group by +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v1.api.dashboards_api import DashboardsApi +from datadog_api_client.v1.model.dashboard import Dashboard +from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType +from datadog_api_client.v1.model.formula_and_function_event_aggregation import FormulaAndFunctionEventAggregation +from datadog_api_client.v1.model.formula_and_function_event_query_definition import ( + FormulaAndFunctionEventQueryDefinition, +) +from datadog_api_client.v1.model.formula_and_function_event_query_definition_compute import ( + FormulaAndFunctionEventQueryDefinitionCompute, +) +from datadog_api_client.v1.model.formula_and_function_event_query_definition_search import ( + FormulaAndFunctionEventQueryDefinitionSearch, +) +from datadog_api_client.v1.model.formula_and_function_event_query_group_by import FormulaAndFunctionEventQueryGroupBy +from datadog_api_client.v1.model.formula_and_function_events_data_source import FormulaAndFunctionEventsDataSource +from datadog_api_client.v1.model.formula_and_function_response_format import FormulaAndFunctionResponseFormat +from datadog_api_client.v1.model.timeseries_widget_definition import TimeseriesWidgetDefinition +from datadog_api_client.v1.model.timeseries_widget_definition_type import TimeseriesWidgetDefinitionType +from datadog_api_client.v1.model.timeseries_widget_request import TimeseriesWidgetRequest +from datadog_api_client.v1.model.widget import Widget +from datadog_api_client.v1.model.widget_layout import WidgetLayout + +body = Dashboard( + title="Example-Dashboard with events facet group_by", + widgets=[ + Widget( + definition=TimeseriesWidgetDefinition( + type=TimeseriesWidgetDefinitionType.TIMESERIES, + requests=[ + TimeseriesWidgetRequest( + response_format=FormulaAndFunctionResponseFormat.TIMESERIES, + queries=[ + FormulaAndFunctionEventQueryDefinition( + data_source=FormulaAndFunctionEventsDataSource.EVENTS, + name="query1", + search=FormulaAndFunctionEventQueryDefinitionSearch( + query="", + ), + compute=FormulaAndFunctionEventQueryDefinitionCompute( + aggregation=FormulaAndFunctionEventAggregation.COUNT, + ), + group_by=[ + FormulaAndFunctionEventQueryGroupBy( + facet="service", + limit=10, + ), + ], + ), + ], + ), + ], + ), + layout=WidgetLayout( + x=0, + y=0, + width=4, + height=2, + ), + ), + ], + layout_type=DashboardLayoutType.ORDERED, +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = DashboardsApi(api_client) + response = api_instance.create_dashboard(body=body) + + print(response) diff --git a/src/datadog_api_client/v1/model/distribution_widget_histogram_request_query.py b/src/datadog_api_client/v1/model/distribution_widget_histogram_request_query.py index 17a6620a43..3acdb1c6cf 100644 --- a/src/datadog_api_client/v1/model/distribution_widget_histogram_request_query.py +++ b/src/datadog_api_client/v1/model/distribution_widget_histogram_request_query.py @@ -36,8 +36,8 @@ def __init__(self, **kwargs): :param compute: Compute options. :type compute: FormulaAndFunctionEventQueryDefinitionCompute - :param group_by: Group by options. - :type group_by: [FormulaAndFunctionEventQueryGroupBy], optional + :param group_by: Group by configuration for a formula and functions events query. Can be a list of facet objects or a flat object with a list of fields. + :type group_by: FormulaAndFunctionEventQueryGroupByConfig, optional :param indexes: An array of index names to query in the stream. Omit or use `[]` to query all indexes at once. :type indexes: [str], optional diff --git a/src/datadog_api_client/v1/model/formula_and_function_event_query_definition.py b/src/datadog_api_client/v1/model/formula_and_function_event_query_definition.py index ab56c422a8..2afad0d5b7 100644 --- a/src/datadog_api_client/v1/model/formula_and_function_event_query_definition.py +++ b/src/datadog_api_client/v1/model/formula_and_function_event_query_definition.py @@ -18,12 +18,18 @@ FormulaAndFunctionEventQueryDefinitionCompute, ) from datadog_api_client.v1.model.formula_and_function_events_data_source import FormulaAndFunctionEventsDataSource - from datadog_api_client.v1.model.formula_and_function_event_query_group_by import ( - FormulaAndFunctionEventQueryGroupBy, + from datadog_api_client.v1.model.formula_and_function_event_query_group_by_config import ( + FormulaAndFunctionEventQueryGroupByConfig, ) from datadog_api_client.v1.model.formula_and_function_event_query_definition_search import ( FormulaAndFunctionEventQueryDefinitionSearch, ) + from datadog_api_client.v1.model.formula_and_function_event_query_group_by import ( + FormulaAndFunctionEventQueryGroupBy, + ) + from datadog_api_client.v1.model.formula_and_function_event_query_group_by_fields import ( + FormulaAndFunctionEventQueryGroupByFields, + ) class FormulaAndFunctionEventQueryDefinition(ModelNormal): @@ -41,8 +47,8 @@ def openapi_types(_): from datadog_api_client.v1.model.formula_and_function_events_data_source import ( FormulaAndFunctionEventsDataSource, ) - from datadog_api_client.v1.model.formula_and_function_event_query_group_by import ( - FormulaAndFunctionEventQueryGroupBy, + from datadog_api_client.v1.model.formula_and_function_event_query_group_by_config import ( + FormulaAndFunctionEventQueryGroupByConfig, ) from datadog_api_client.v1.model.formula_and_function_event_query_definition_search import ( FormulaAndFunctionEventQueryDefinitionSearch, @@ -52,7 +58,7 @@ def openapi_types(_): "compute": (FormulaAndFunctionEventQueryDefinitionCompute,), "cross_org_uuids": ([str],), "data_source": (FormulaAndFunctionEventsDataSource,), - "group_by": ([FormulaAndFunctionEventQueryGroupBy],), + "group_by": (FormulaAndFunctionEventQueryGroupByConfig,), "indexes": ([str],), "name": (str,), "search": (FormulaAndFunctionEventQueryDefinitionSearch,), @@ -76,7 +82,12 @@ def __init__( data_source: FormulaAndFunctionEventsDataSource, name: str, cross_org_uuids: Union[List[str], UnsetType] = unset, - group_by: Union[List[FormulaAndFunctionEventQueryGroupBy], UnsetType] = unset, + group_by: Union[ + FormulaAndFunctionEventQueryGroupByConfig, + List[FormulaAndFunctionEventQueryGroupBy], + FormulaAndFunctionEventQueryGroupByFields, + UnsetType, + ] = unset, indexes: Union[List[str], UnsetType] = unset, search: Union[FormulaAndFunctionEventQueryDefinitionSearch, UnsetType] = unset, storage: Union[str, UnsetType] = unset, @@ -94,8 +105,8 @@ def __init__( :param data_source: Data source for event platform-based queries. :type data_source: FormulaAndFunctionEventsDataSource - :param group_by: Group by options. - :type group_by: [FormulaAndFunctionEventQueryGroupBy], optional + :param group_by: Group by configuration for a formula and functions events query. Can be a list of facet objects or a flat object with a list of fields. + :type group_by: FormulaAndFunctionEventQueryGroupByConfig, optional :param indexes: An array of index names to query in the stream. Omit or use ``[]`` to query all indexes at once. :type indexes: [str], optional diff --git a/src/datadog_api_client/v1/model/formula_and_function_event_query_group_by_config.py b/src/datadog_api_client/v1/model/formula_and_function_event_query_group_by_config.py new file mode 100644 index 0000000000..0e0b3bbd70 --- /dev/null +++ b/src/datadog_api_client/v1/model/formula_and_function_event_query_group_by_config.py @@ -0,0 +1,50 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelComposed, + cached_property, +) + + +class FormulaAndFunctionEventQueryGroupByConfig(ModelComposed): + def __init__(self, **kwargs): + """ + Group by configuration for a formula and functions events query. Can be a list of facet objects or a flat object with a list of fields. + + :param fields: List of event facets to group by. + :type fields: [str] + + :param limit: Number of groups to return. + :type limit: int, optional + + :param sort: Options for sorting group by results. + :type sort: FormulaAndFunctionEventQueryGroupBySort, optional + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v1.model.formula_and_function_event_query_group_by import ( + FormulaAndFunctionEventQueryGroupBy, + ) + from datadog_api_client.v1.model.formula_and_function_event_query_group_by_fields import ( + FormulaAndFunctionEventQueryGroupByFields, + ) + + return { + "oneOf": [ + [FormulaAndFunctionEventQueryGroupBy], + FormulaAndFunctionEventQueryGroupByFields, + ], + } diff --git a/src/datadog_api_client/v1/model/formula_and_function_event_query_group_by_fields.py b/src/datadog_api_client/v1/model/formula_and_function_event_query_group_by_fields.py new file mode 100644 index 0000000000..a603e636d4 --- /dev/null +++ b/src/datadog_api_client/v1/model/formula_and_function_event_query_group_by_fields.py @@ -0,0 +1,66 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v1.model.formula_and_function_event_query_group_by_sort import ( + FormulaAndFunctionEventQueryGroupBySort, + ) + + +class FormulaAndFunctionEventQueryGroupByFields(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v1.model.formula_and_function_event_query_group_by_sort import ( + FormulaAndFunctionEventQueryGroupBySort, + ) + + return { + "fields": ([str],), + "limit": (int,), + "sort": (FormulaAndFunctionEventQueryGroupBySort,), + } + + attribute_map = { + "fields": "fields", + "limit": "limit", + "sort": "sort", + } + + def __init__( + self_, + fields: List[str], + limit: Union[int, UnsetType] = unset, + sort: Union[FormulaAndFunctionEventQueryGroupBySort, UnsetType] = unset, + **kwargs, + ): + """ + Flat group by using multiple event facets. + + :param fields: List of event facets to group by. + :type fields: [str] + + :param limit: Number of groups to return. + :type limit: int, optional + + :param sort: Options for sorting group by results. + :type sort: FormulaAndFunctionEventQueryGroupBySort, optional + """ + if limit is not unset: + kwargs["limit"] = limit + if sort is not unset: + kwargs["sort"] = sort + super().__init__(kwargs) + + self_.fields = fields diff --git a/src/datadog_api_client/v1/model/formula_and_function_query_definition.py b/src/datadog_api_client/v1/model/formula_and_function_query_definition.py index a8228cc0dc..10a217711f 100644 --- a/src/datadog_api_client/v1/model/formula_and_function_query_definition.py +++ b/src/datadog_api_client/v1/model/formula_and_function_query_definition.py @@ -36,8 +36,8 @@ def __init__(self, **kwargs): :param compute: Compute options. :type compute: FormulaAndFunctionEventQueryDefinitionCompute - :param group_by: Group by options. - :type group_by: [FormulaAndFunctionEventQueryGroupBy], optional + :param group_by: Group by configuration for a formula and functions events query. Can be a list of facet objects or a flat object with a list of fields. + :type group_by: FormulaAndFunctionEventQueryGroupByConfig, optional :param indexes: An array of index names to query in the stream. Omit or use `[]` to query all indexes at once. :type indexes: [str], optional diff --git a/src/datadog_api_client/v1/models/__init__.py b/src/datadog_api_client/v1/models/__init__.py index 1710446bfc..e9cf8028ab 100644 --- a/src/datadog_api_client/v1/models/__init__.py +++ b/src/datadog_api_client/v1/models/__init__.py @@ -154,6 +154,12 @@ FormulaAndFunctionEventQueryDefinitionSearch, ) from datadog_api_client.v1.model.formula_and_function_event_query_group_by import FormulaAndFunctionEventQueryGroupBy +from datadog_api_client.v1.model.formula_and_function_event_query_group_by_config import ( + FormulaAndFunctionEventQueryGroupByConfig, +) +from datadog_api_client.v1.model.formula_and_function_event_query_group_by_fields import ( + FormulaAndFunctionEventQueryGroupByFields, +) from datadog_api_client.v1.model.formula_and_function_event_query_group_by_sort import ( FormulaAndFunctionEventQueryGroupBySort, ) @@ -1283,6 +1289,8 @@ "FormulaAndFunctionEventQueryDefinitionCompute", "FormulaAndFunctionEventQueryDefinitionSearch", "FormulaAndFunctionEventQueryGroupBy", + "FormulaAndFunctionEventQueryGroupByConfig", + "FormulaAndFunctionEventQueryGroupByFields", "FormulaAndFunctionEventQueryGroupBySort", "FormulaAndFunctionEventsDataSource", "FormulaAndFunctionMetricAggregation", diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_distribution_widget_using_a_histogram_request_containing_a_formulas_and_functions_events_query.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_distribution_widget_using_a_histogram_request_containing_a_formulas_and_functions_events_query.frozen index c35a420f43..0d11db9caa 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_distribution_widget_using_a_histogram_request_containing_a_formulas_and_functions_events_query.frozen +++ b/tests/v1/cassettes/test_scenarios/test_create_a_distribution_widget_using_a_histogram_request_containing_a_formulas_and_functions_events_query.frozen @@ -1 +1 @@ -2024-11-15T19:32:27.384Z \ No newline at end of file +2026-02-20T20:18:17.986Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_distribution_widget_using_a_histogram_request_containing_a_formulas_and_functions_events_query.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_distribution_widget_using_a_histogram_request_containing_a_formulas_and_functions_events_query.yaml index 52aa28d533..84152f3b40 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_distribution_widget_using_a_histogram_request_containing_a_formulas_and_functions_events_query.yaml +++ b/tests/v1/cassettes/test_scenarios/test_create_a_distribution_widget_using_a_histogram_request_containing_a_formulas_and_functions_events_query.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"description":"Test-Create_a_distribution_widget_using_a_histogram_request_containing_a_formulas_and_functions_events_qu-1731699147","layout_type":"ordered","title":"Test-Create_a_distribution_widget_using_a_histogram_request_containing_a_formulas_and_functions_events_qu-1731699147","widgets":[{"definition":{"requests":[{"query":{"compute":{"aggregation":"min","metric":"@duration"},"data_source":"events","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""}},"request_type":"histogram"}],"show_legend":false,"title":"Events + body: '{"description":"Test-Create_a_distribution_widget_using_a_histogram_request_containing_a_formulas_and_functions_events_qu-1771618697","layout_type":"ordered","title":"Test-Create_a_distribution_widget_using_a_histogram_request_containing_a_formulas_and_functions_events_qu-1771618697","widgets":[{"definition":{"requests":[{"query":{"compute":{"aggregation":"min","metric":"@duration"},"data_source":"events","indexes":["*"],"name":"query1","search":{"query":""}},"request_type":"histogram"}],"show_legend":false,"title":"Events Platform - Request latency HOP","title_align":"left","title_size":"16","type":"distribution","xaxis":{"include_zero":true,"max":"auto","min":"auto","scale":"linear"},"yaxis":{"include_zero":true,"max":"auto","min":"auto","scale":"linear"}},"layout":{"height":2,"width":4,"x":0,"y":0}}]}' headers: accept: @@ -11,10 +11,8 @@ interactions: uri: https://api.datadoghq.com/api/v1/dashboard response: body: - string: '{"id":"p6k-cxc-g8m","title":"Test-Create_a_distribution_widget_using_a_histogram_request_containing_a_formulas_and_functions_events_qu-1731699147","description":"Test-Create_a_distribution_widget_using_a_histogram_request_containing_a_formulas_and_functions_events_qu-1731699147","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/p6k-cxc-g8m/test-createadistributionwidgetusingahistogramrequestcontainingaformulasandfuncti","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"query":{"compute":{"aggregation":"min","metric":"@duration"},"data_source":"events","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""}},"request_type":"histogram"}],"show_legend":false,"title":"Events - Platform - Request latency HOP","title_align":"left","title_size":"16","type":"distribution","xaxis":{"include_zero":true,"max":"auto","min":"auto","scale":"linear"},"yaxis":{"include_zero":true,"max":"auto","min":"auto","scale":"linear"}},"layout":{"height":2,"width":4,"x":0,"y":0},"id":8624507873468872}],"notify_list":null,"created_at":"2024-11-15T19:32:27.570354+00:00","modified_at":"2024-11-15T19:32:27.570354+00:00","restricted_roles":[]} - - ' + string: '{"id":"eej-xeq-pgm","title":"Test-Create_a_distribution_widget_using_a_histogram_request_containing_a_formulas_and_functions_events_qu-1771618697","description":"Test-Create_a_distribution_widget_using_a_histogram_request_containing_a_formulas_and_functions_events_qu-1771618697","author_handle":"frog@datadoghq.com","author_name":"frog","layout_type":"ordered","url":"/dashboard/eej-xeq-pgm/test-createadistributionwidgetusingahistogramrequestcontainingaformulasandfuncti","template_variables":null,"widgets":[{"definition":{"requests":[{"query":{"compute":{"aggregation":"min","metric":"@duration"},"data_source":"events","indexes":["*"],"name":"query1","search":{"query":""}},"request_type":"histogram"}],"show_legend":false,"title":"Events + Platform - Request latency HOP","title_align":"left","title_size":"16","type":"distribution","xaxis":{"include_zero":true,"max":"auto","min":"auto","scale":"linear"},"yaxis":{"include_zero":true,"max":"auto","min":"auto","scale":"linear"}},"layout":{"height":2,"width":4,"x":0,"y":0},"id":1352561672261497}],"notify_list":null,"created_at":"2026-02-20T20:18:18.338500+00:00","modified_at":"2026-02-20T20:18:18.338500+00:00","restricted_roles":[]}' headers: content-type: - application/json @@ -27,12 +25,10 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/dashboard/p6k-cxc-g8m + uri: https://api.datadoghq.com/api/v1/dashboard/eej-xeq-pgm response: body: - string: '{"deleted_dashboard_id":"p6k-cxc-g8m"} - - ' + string: '{"deleted_dashboard_id":"eej-xeq-pgm"}' headers: content-type: - application/json diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_formulas_and_functions_change_widget.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_formulas_and_functions_change_widget.frozen index 15ab4cd26e..f7b6f6e2e0 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_formulas_and_functions_change_widget.frozen +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_formulas_and_functions_change_widget.frozen @@ -1 +1 @@ -2024-11-15T19:32:30.413Z \ No newline at end of file +2026-02-20T20:18:52.065Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_formulas_and_functions_change_widget.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_formulas_and_functions_change_widget.yaml index 27e956d21c..9f2d95b4e9 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_formulas_and_functions_change_widget.yaml +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_formulas_and_functions_change_widget.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_a_formulas_and_functions_change_widget-1731699150","widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"hour_before","formulas":[{"formula":"hour_before(query1)"},{"formula":"query1"}],"increase_good":true,"order_by":"change","order_dir":"desc","queries":[{"compute":{"aggregation":"count"},"data_source":"logs","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"time":{},"title":"","title_align":"left","title_size":"16","type":"change"},"layout":{"height":4,"width":4,"x":0,"y":0}}]}' + body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_a_formulas_and_functions_change_widget-1771618732","widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"hour_before","formulas":[{"formula":"hour_before(query1)"},{"formula":"query1"}],"increase_good":true,"order_by":"change","order_dir":"desc","queries":[{"compute":{"aggregation":"count"},"data_source":"logs","indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"time":{},"title":"","title_align":"left","title_size":"16","type":"change"},"layout":{"height":4,"width":4,"x":0,"y":0}}]}' headers: accept: - application/json @@ -10,9 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v1/dashboard response: body: - string: '{"id":"pwu-pqa-fin","title":"Test-Create_a_new_dashboard_with_a_formulas_and_functions_change_widget-1731699150","description":null,"author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/pwu-pqa-fin/test-createanewdashboardwithaformulasandfunctionschangewidget-1731699150","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"hour_before","formulas":[{"formula":"hour_before(query1)"},{"formula":"query1"}],"increase_good":true,"order_by":"change","order_dir":"desc","queries":[{"compute":{"aggregation":"count"},"data_source":"logs","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"time":{},"title":"","title_align":"left","title_size":"16","type":"change"},"layout":{"height":4,"width":4,"x":0,"y":0},"id":4495141746383449}],"notify_list":null,"created_at":"2024-11-15T19:32:30.566816+00:00","modified_at":"2024-11-15T19:32:30.566816+00:00","restricted_roles":[]} - - ' + string: '{"id":"g3s-8ap-8bk","title":"Test-Create_a_new_dashboard_with_a_formulas_and_functions_change_widget-1771618732","description":null,"author_handle":"frog@datadoghq.com","author_name":"frog","layout_type":"ordered","url":"/dashboard/g3s-8ap-8bk/test-createanewdashboardwithaformulasandfunctionschangewidget-1771618732","template_variables":null,"widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"hour_before","formulas":[{"formula":"hour_before(query1)"},{"formula":"query1"}],"increase_good":true,"order_by":"change","order_dir":"desc","queries":[{"compute":{"aggregation":"count"},"data_source":"logs","indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"time":{},"title":"","title_align":"left","title_size":"16","type":"change"},"layout":{"height":4,"width":4,"x":0,"y":0},"id":2055922494151922}],"notify_list":null,"created_at":"2026-02-20T20:18:52.216652+00:00","modified_at":"2026-02-20T20:18:52.216652+00:00","restricted_roles":[]}' headers: content-type: - application/json @@ -25,12 +23,10 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/dashboard/pwu-pqa-fin + uri: https://api.datadoghq.com/api/v1/dashboard/g3s-8ap-8bk response: body: - string: '{"deleted_dashboard_id":"pwu-pqa-fin"} - - ' + string: '{"deleted_dashboard_id":"g3s-8ap-8bk"}' headers: content-type: - application/json diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_formulas_and_functions_treemap_widget.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_formulas_and_functions_treemap_widget.frozen index 2186983177..c5933fb246 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_formulas_and_functions_treemap_widget.frozen +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_formulas_and_functions_treemap_widget.frozen @@ -1 +1 @@ -2024-11-15T19:32:30.862Z \ No newline at end of file +2026-02-20T20:19:05.857Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_formulas_and_functions_treemap_widget.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_formulas_and_functions_treemap_widget.yaml index 00f2091277..9a2bca03fa 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_formulas_and_functions_treemap_widget.yaml +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_a_formulas_and_functions_treemap_widget.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_a_formulas_and_functions_treemap_widget-1731699150","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"hour_before(query1)"},{"formula":"query1"}],"queries":[{"compute":{"aggregation":"count"},"data_source":"logs","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"title":"","type":"treemap"},"layout":{"height":4,"width":4,"x":0,"y":0}}]}' + body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_a_formulas_and_functions_treemap_widget-1771618745","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"hour_before(query1)"},{"formula":"query1"}],"queries":[{"compute":{"aggregation":"count"},"data_source":"logs","indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"title":"","type":"treemap"},"layout":{"height":4,"width":4,"x":0,"y":0}}]}' headers: accept: - application/json @@ -10,9 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v1/dashboard response: body: - string: '{"id":"sa5-czr-uat","title":"Test-Create_a_new_dashboard_with_a_formulas_and_functions_treemap_widget-1731699150","description":null,"author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/sa5-czr-uat/test-createanewdashboardwithaformulasandfunctionstreemapwidget-1731699150","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"formulas":[{"formula":"hour_before(query1)"},{"formula":"query1"}],"queries":[{"compute":{"aggregation":"count"},"data_source":"logs","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"title":"","type":"treemap"},"layout":{"height":4,"width":4,"x":0,"y":0},"id":2892895408255139}],"notify_list":null,"created_at":"2024-11-15T19:32:31.032272+00:00","modified_at":"2024-11-15T19:32:31.032272+00:00","restricted_roles":[]} - - ' + string: '{"id":"njk-kz4-p8c","title":"Test-Create_a_new_dashboard_with_a_formulas_and_functions_treemap_widget-1771618745","description":null,"author_handle":"frog@datadoghq.com","author_name":"frog","layout_type":"ordered","url":"/dashboard/njk-kz4-p8c/test-createanewdashboardwithaformulasandfunctionstreemapwidget-1771618745","template_variables":null,"widgets":[{"definition":{"requests":[{"formulas":[{"formula":"hour_before(query1)"},{"formula":"query1"}],"queries":[{"compute":{"aggregation":"count"},"data_source":"logs","indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"title":"","type":"treemap"},"layout":{"height":4,"width":4,"x":0,"y":0},"id":2582394402168111}],"notify_list":null,"created_at":"2026-02-20T20:19:06.014225+00:00","modified_at":"2026-02-20T20:19:06.014225+00:00","restricted_roles":[]}' headers: content-type: - application/json @@ -25,12 +23,10 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/dashboard/sa5-czr-uat + uri: https://api.datadoghq.com/api/v1/dashboard/njk-kz4-p8c response: body: - string: '{"deleted_dashboard_id":"sa5-czr-uat"} - - ' + string: '{"deleted_dashboard_id":"njk-kz4-p8c"}' headers: content-type: - application/json diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_an_audit_logs_query.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_an_audit_logs_query.frozen index f17762337a..169baa748a 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_an_audit_logs_query.frozen +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_an_audit_logs_query.frozen @@ -1 +1 @@ -2024-11-15T19:32:36.010Z \ No newline at end of file +2026-02-20T20:19:21.239Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_an_audit_logs_query.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_an_audit_logs_query.yaml index 43108cd020..1e27b67b0d 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_an_audit_logs_query.yaml +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_an_audit_logs_query.yaml @@ -1,7 +1,7 @@ interactions: - request: - body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_an_audit_logs_query-1731699156 - with Audit Logs Query","widgets":[{"definition":{"requests":[{"queries":[{"compute":{"aggregation":"count"},"data_source":"audit","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"timeseries"}],"type":"timeseries"},"layout":{"height":2,"width":4,"x":2,"y":0}}]}' + body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_an_audit_logs_query-1771618761 + with Audit Logs Query","widgets":[{"definition":{"requests":[{"queries":[{"compute":{"aggregation":"count"},"data_source":"audit","indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"timeseries"}],"type":"timeseries"},"layout":{"height":2,"width":4,"x":2,"y":0}}]}' headers: accept: - application/json @@ -11,10 +11,8 @@ interactions: uri: https://api.datadoghq.com/api/v1/dashboard response: body: - string: '{"id":"gu5-cq8-akb","title":"Test-Create_a_new_dashboard_with_an_audit_logs_query-1731699156 - with Audit Logs Query","description":null,"author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/gu5-cq8-akb/test-createanewdashboardwithanauditlogsquery-1731699156-with-audit-logs-query","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"queries":[{"compute":{"aggregation":"count"},"data_source":"audit","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"timeseries"}],"type":"timeseries"},"layout":{"height":2,"width":4,"x":2,"y":0},"id":1074067237256022}],"notify_list":null,"created_at":"2024-11-15T19:32:36.200033+00:00","modified_at":"2024-11-15T19:32:36.200033+00:00","restricted_roles":[]} - - ' + string: '{"id":"yid-eiq-hpr","title":"Test-Create_a_new_dashboard_with_an_audit_logs_query-1771618761 + with Audit Logs Query","description":null,"author_handle":"frog@datadoghq.com","author_name":"frog","layout_type":"ordered","url":"/dashboard/yid-eiq-hpr/test-createanewdashboardwithanauditlogsquery-1771618761-with-audit-logs-query","template_variables":null,"widgets":[{"definition":{"requests":[{"queries":[{"compute":{"aggregation":"count"},"data_source":"audit","indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"timeseries"}],"type":"timeseries"},"layout":{"height":2,"width":4,"x":2,"y":0},"id":296735922843810}],"notify_list":null,"created_at":"2026-02-20T20:19:21.362795+00:00","modified_at":"2026-02-20T20:19:21.362795+00:00","restricted_roles":[]}' headers: content-type: - application/json @@ -27,12 +25,10 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/dashboard/gu5-cq8-akb + uri: https://api.datadoghq.com/api/v1/dashboard/yid-eiq-hpr response: body: - string: '{"deleted_dashboard_id":"gu5-cq8-akb"} - - ' + string: '{"deleted_dashboard_id":"yid-eiq-hpr"}' headers: content-type: - application/json diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_formulas_and_functions_events_query_using_facet_group_by.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_formulas_and_functions_events_query_using_facet_group_by.frozen new file mode 100644 index 0000000000..db9deacddd --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_formulas_and_functions_events_query_using_facet_group_by.frozen @@ -0,0 +1 @@ +2026-02-20T18:30:56.541Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_formulas_and_functions_events_query_using_facet_group_by.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_formulas_and_functions_events_query_using_facet_group_by.yaml new file mode 100644 index 0000000000..20c296b384 --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_formulas_and_functions_events_query_using_facet_group_by.yaml @@ -0,0 +1,38 @@ +interactions: +- request: + body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_formulas_and_functions_events_query_using_facet_group_by-1771612256 + with events facet group_by","widgets":[{"definition":{"requests":[{"queries":[{"compute":{"aggregation":"count"},"data_source":"events","group_by":[{"facet":"service","limit":10}],"name":"query1","search":{"query":""}}],"response_format":"timeseries"}],"type":"timeseries"},"layout":{"height":2,"width":4,"x":0,"y":0}}]}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + string: '{"id":"cuw-94b-6q6","title":"Test-Create_a_new_dashboard_with_formulas_and_functions_events_query_using_facet_group_by-1771612256 + with events facet group_by","description":null,"author_handle":"frog@datadoghq.com","author_name":"frog","layout_type":"ordered","url":"/dashboard/cuw-94b-6q6/test-createanewdashboardwithformulasandfunctionseventsqueryusingfacetgroupby-177","template_variables":null,"widgets":[{"definition":{"requests":[{"queries":[{"compute":{"aggregation":"count"},"data_source":"events","group_by":[{"facet":"service","limit":10}],"name":"query1","search":{"query":""}}],"response_format":"timeseries"}],"type":"timeseries"},"layout":{"height":2,"width":4,"x":0,"y":0},"id":5025516440057016}],"notify_list":null,"created_at":"2026-02-20T18:30:56.681735+00:00","modified_at":"2026-02-20T18:30:56.681735+00:00","restricted_roles":[]}' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/cuw-94b-6q6 + response: + body: + string: '{"deleted_dashboard_id":"cuw-94b-6q6"}' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_formulas_and_functions_events_query_using_flat_group_by_fields.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_formulas_and_functions_events_query_using_flat_group_by_fields.frozen new file mode 100644 index 0000000000..5c19a59aa1 --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_formulas_and_functions_events_query_using_flat_group_by_fields.frozen @@ -0,0 +1 @@ +2026-02-20T18:31:11.583Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_formulas_and_functions_events_query_using_flat_group_by_fields.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_formulas_and_functions_events_query_using_flat_group_by_fields.yaml new file mode 100644 index 0000000000..0df971586d --- /dev/null +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_formulas_and_functions_events_query_using_flat_group_by_fields.yaml @@ -0,0 +1,38 @@ +interactions: +- request: + body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_formulas_and_functions_events_query_using_flat_group_by_fields-1771612271 + with events flat group_by fields","widgets":[{"definition":{"requests":[{"queries":[{"compute":{"aggregation":"count"},"data_source":"events","group_by":{"fields":["service","host"],"limit":10},"name":"query1","search":{"query":""}}],"response_format":"timeseries"}],"type":"timeseries"},"layout":{"height":2,"width":4,"x":0,"y":0}}]}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + string: '{"id":"55h-xu8-bf3","title":"Test-Create_a_new_dashboard_with_formulas_and_functions_events_query_using_flat_group_by_fields-1771612271 + with events flat group_by fields","description":null,"author_handle":"frog@datadoghq.com","author_name":"frog","layout_type":"ordered","url":"/dashboard/55h-xu8-bf3/test-createanewdashboardwithformulasandfunctionseventsqueryusingflatgroupbyfield","template_variables":null,"widgets":[{"definition":{"requests":[{"queries":[{"compute":{"aggregation":"count"},"data_source":"events","group_by":{"fields":["service","host"],"limit":10},"name":"query1","search":{"query":""}}],"response_format":"timeseries"}],"type":"timeseries"},"layout":{"height":2,"width":4,"x":0,"y":0},"id":5327054421054936}],"notify_list":null,"created_at":"2026-02-20T18:31:11.718905+00:00","modified_at":"2026-02-20T18:31:11.718905+00:00","restricted_roles":[]}' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/55h-xu8-bf3 + response: + body: + string: '{"deleted_dashboard_id":"55h-xu8-bf3"}' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_invalid_team_tags_returns_bad_request_response.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_invalid_team_tags_returns_bad_request_response.frozen index 6a7b25ee77..85d85e17d8 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_invalid_team_tags_returns_bad_request_response.frozen +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_invalid_team_tags_returns_bad_request_response.frozen @@ -1 +1 @@ -2024-11-15T19:32:44.075Z \ No newline at end of file +2026-02-20T20:19:34.503Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_invalid_team_tags_returns_bad_request_response.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_invalid_team_tags_returns_bad_request_response.yaml index b877255587..75d2330297 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_invalid_team_tags_returns_bad_request_response.yaml +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_invalid_team_tags_returns_bad_request_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"layout_type":"ordered","tags":["tm:foobar"],"title":"Test-Create_a_new_dashboard_with_invalid_team_tags_returns_Bad_Request_response-1731699164","widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"hour_before","formulas":[{"formula":"hour_before(query1)"},{"formula":"query1"}],"increase_good":true,"order_by":"change","order_dir":"desc","queries":[{"compute":{"aggregation":"count"},"data_source":"logs","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"time":{},"title":"","title_align":"left","title_size":"16","type":"change"},"layout":{"height":4,"width":4,"x":0,"y":0}}]}' + body: '{"layout_type":"ordered","tags":["tm:foobar"],"title":"Test-Create_a_new_dashboard_with_invalid_team_tags_returns_Bad_Request_response-1771618774","widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"hour_before","formulas":[{"formula":"hour_before(query1)"},{"formula":"query1"}],"increase_good":true,"order_by":"change","order_dir":"desc","queries":[{"compute":{"aggregation":"count"},"data_source":"logs","indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"time":{},"title":"","title_align":"left","title_size":"16","type":"change"},"layout":{"height":4,"width":4,"x":0,"y":0}}]}' headers: accept: - application/json diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_team_tags_returns_ok_response.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_team_tags_returns_ok_response.frozen index a85903d2bb..2ae382bcb1 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_team_tags_returns_ok_response.frozen +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_team_tags_returns_ok_response.frozen @@ -1 +1 @@ -2024-11-15T19:32:57.038Z \ No newline at end of file +2026-02-20T20:19:48.408Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_team_tags_returns_ok_response.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_team_tags_returns_ok_response.yaml index 5bb030b9e7..5b71789d7a 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_team_tags_returns_ok_response.yaml +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_team_tags_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"layout_type":"ordered","tags":["team:foobar"],"title":"Test-Create_a_new_dashboard_with_team_tags_returns_OK_response-1731699177","widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"hour_before","formulas":[{"formula":"hour_before(query1)"},{"formula":"query1"}],"increase_good":true,"order_by":"change","order_dir":"desc","queries":[{"compute":{"aggregation":"count"},"data_source":"logs","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"time":{},"title":"","title_align":"left","title_size":"16","type":"change"},"layout":{"height":4,"width":4,"x":0,"y":0}}]}' + body: '{"layout_type":"ordered","tags":["team:foobar"],"title":"Test-Create_a_new_dashboard_with_team_tags_returns_OK_response-1771618788","widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"hour_before","formulas":[{"formula":"hour_before(query1)"},{"formula":"query1"}],"increase_good":true,"order_by":"change","order_dir":"desc","queries":[{"compute":{"aggregation":"count"},"data_source":"logs","indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"time":{},"title":"","title_align":"left","title_size":"16","type":"change"},"layout":{"height":4,"width":4,"x":0,"y":0}}]}' headers: accept: - application/json @@ -10,9 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v1/dashboard response: body: - string: '{"id":"zb6-66m-ntf","title":"Test-Create_a_new_dashboard_with_team_tags_returns_OK_response-1731699177","description":null,"author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/zb6-66m-ntf/test-createanewdashboardwithteamtagsreturnsokresponse-1731699177","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"hour_before","formulas":[{"formula":"hour_before(query1)"},{"formula":"query1"}],"increase_good":true,"order_by":"change","order_dir":"desc","queries":[{"compute":{"aggregation":"count"},"data_source":"logs","group_by":[],"indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"time":{},"title":"","title_align":"left","title_size":"16","type":"change"},"layout":{"height":4,"width":4,"x":0,"y":0},"id":5234430955769094}],"notify_list":null,"created_at":"2024-11-15T19:32:57.190291+00:00","modified_at":"2024-11-15T19:32:57.190291+00:00","tags":["team:foobar"],"restricted_roles":[]} - - ' + string: '{"id":"tfh-8hh-gha","title":"Test-Create_a_new_dashboard_with_team_tags_returns_OK_response-1771618788","description":null,"author_handle":"frog@datadoghq.com","author_name":"frog","layout_type":"ordered","url":"/dashboard/tfh-8hh-gha/test-createanewdashboardwithteamtagsreturnsokresponse-1771618788","template_variables":null,"widgets":[{"definition":{"requests":[{"change_type":"absolute","compare_to":"hour_before","formulas":[{"formula":"hour_before(query1)"},{"formula":"query1"}],"increase_good":true,"order_by":"change","order_dir":"desc","queries":[{"compute":{"aggregation":"count"},"data_source":"logs","indexes":["*"],"name":"query1","search":{"query":""}}],"response_format":"scalar"}],"time":{},"title":"","title_align":"left","title_size":"16","type":"change"},"layout":{"height":4,"width":4,"x":0,"y":0},"id":5768564568855112}],"notify_list":null,"created_at":"2026-02-20T20:19:48.549863+00:00","modified_at":"2026-02-20T20:19:48.549863+00:00","tags":["team:foobar"],"restricted_roles":[]}' headers: content-type: - application/json @@ -25,12 +23,10 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/dashboard/zb6-66m-ntf + uri: https://api.datadoghq.com/api/v1/dashboard/tfh-8hh-gha response: body: - string: '{"deleted_dashboard_id":"zb6-66m-ntf"} - - ' + string: '{"deleted_dashboard_id":"tfh-8hh-gha"}' headers: content-type: - application/json diff --git a/tests/v1/features/dashboards.feature b/tests/v1/features/dashboards.feature index 349f7de6f9..fffbf4a78e 100644 --- a/tests/v1/features/dashboards.feature +++ b/tests/v1/features/dashboards.feature @@ -38,7 +38,7 @@ Feature: Dashboards @team:DataDog/dashboards-backend Scenario: Create a distribution widget using a histogram request containing a formulas and functions events query Given new "CreateDashboard" request - And body with value { "title": "{{ unique }}", "description": "{{ unique }}", "widgets": [ { "definition": { "title": "Events Platform - Request latency HOP", "title_size": "16", "title_align": "left", "show_legend": false, "type": "distribution", "xaxis": { "max": "auto", "include_zero": true, "scale": "linear", "min": "auto" }, "yaxis": { "max": "auto", "include_zero": true, "scale": "linear", "min": "auto" }, "requests": [ { "query": { "search": { "query": "" }, "data_source": "events", "compute": { "metric": "@duration", "aggregation": "min" }, "name": "query1", "indexes": [ "*" ], "group_by": [] }, "request_type": "histogram" } ] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 2 } } ], "layout_type": "ordered" } + And body with value { "title": "{{ unique }}", "description": "{{ unique }}", "widgets": [ { "definition": { "title": "Events Platform - Request latency HOP", "title_size": "16", "title_align": "left", "show_legend": false, "type": "distribution", "xaxis": { "max": "auto", "include_zero": true, "scale": "linear", "min": "auto" }, "yaxis": { "max": "auto", "include_zero": true, "scale": "linear", "min": "auto" }, "requests": [ { "query": { "search": { "query": "" }, "data_source": "events", "compute": { "metric": "@duration", "aggregation": "min" }, "name": "query1", "indexes": [ "*" ] }, "request_type": "histogram" } ] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 2 } } ], "layout_type": "ordered" } When the request is sent Then the response status is 200 OK And the response "widgets[0].definition.requests[0].request_type" is equal to "histogram" @@ -48,7 +48,6 @@ Feature: Dashboards And the response "widgets[0].definition.requests[0].query.compute.aggregation" is equal to "min" And the response "widgets[0].definition.requests[0].query.name" is equal to "query1" And the response "widgets[0].definition.requests[0].query.indexes" is equal to ["*"] - And the response "widgets[0].definition.requests[0].query.group_by" is equal to [] @team:DataDog/dashboards-backend Scenario: Create a distribution widget using a histogram request containing a formulas and functions metrics query @@ -144,7 +143,7 @@ Feature: Dashboards @team:DataDog/dashboards-backend Scenario: Create a new dashboard with a formulas and functions change widget Given new "CreateDashboard" request - And body with value { "title": "{{ unique }}", "widgets": [ { "definition": { "title": "", "title_size": "16", "title_align": "left", "time": {}, "type": "change", "requests": [ { "formulas": [ { "formula": "hour_before(query1)" }, { "formula": "query1" } ], "queries": [ { "data_source": "logs", "name": "query1", "search": { "query": "" }, "indexes": [ "*" ], "compute": { "aggregation": "count" }, "group_by": [] } ], "response_format": "scalar", "compare_to": "hour_before", "increase_good": true, "order_by": "change", "change_type": "absolute", "order_dir": "desc" } ] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 4 } } ], "layout_type": "ordered" } + And body with value { "title": "{{ unique }}", "widgets": [ { "definition": { "title": "", "title_size": "16", "title_align": "left", "time": {}, "type": "change", "requests": [ { "formulas": [ { "formula": "hour_before(query1)" }, { "formula": "query1" } ], "queries": [ { "data_source": "logs", "name": "query1", "search": { "query": "" }, "indexes": [ "*" ], "compute": { "aggregation": "count" } } ], "response_format": "scalar", "compare_to": "hour_before", "increase_good": true, "order_by": "change", "change_type": "absolute", "order_dir": "desc" } ] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 4 } } ], "layout_type": "ordered" } When the request is sent Then the response status is 200 OK And the response "widgets[0].definition.requests[0].response_format" is equal to "scalar" @@ -162,7 +161,7 @@ Feature: Dashboards @team:DataDog/dashboards-backend Scenario: Create a new dashboard with a formulas and functions treemap widget Given new "CreateDashboard" request - And body with value { "title": "{{ unique }}", "widgets": [ { "definition": { "title": "", "type": "treemap", "requests": [ { "formulas": [ { "formula": "hour_before(query1)" }, { "formula": "query1" } ], "queries": [ { "data_source": "logs", "name": "query1", "search": { "query": "" }, "indexes": [ "*" ], "compute": { "aggregation": "count" }, "group_by": [] } ], "response_format": "scalar" } ] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 4 } } ], "layout_type": "ordered" } + And body with value { "title": "{{ unique }}", "widgets": [ { "definition": { "title": "", "type": "treemap", "requests": [ { "formulas": [ { "formula": "hour_before(query1)" }, { "formula": "query1" } ], "queries": [ { "data_source": "logs", "name": "query1", "search": { "query": "" }, "indexes": [ "*" ], "compute": { "aggregation": "count" } } ], "response_format": "scalar" } ] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 4 } } ], "layout_type": "ordered" } When the request is sent Then the response status is 200 OK And the response "widgets[0].definition.requests[0].response_format" is equal to "scalar" @@ -296,7 +295,7 @@ Feature: Dashboards @team:DataDog/dashboards-backend Scenario: Create a new dashboard with an audit logs query Given new "CreateDashboard" request - And body with value {"layout_type": "ordered", "title": "{{ unique }} with Audit Logs Query", "widgets": [{"definition": {"type": "timeseries","requests": [{"response_format": "timeseries","queries": [{"search": {"query": ""},"data_source": "audit","compute": {"aggregation": "count"},"name": "query1","indexes": ["*"],"group_by": []}]}]},"layout": {"x": 2,"y": 0,"width": 4,"height": 2}}]} + And body with value {"layout_type": "ordered", "title": "{{ unique }} with Audit Logs Query", "widgets": [{"definition": {"type": "timeseries","requests": [{"response_format": "timeseries","queries": [{"search": {"query": ""},"data_source": "audit","compute": {"aggregation": "count"},"name": "query1","indexes": ["*"]}]}]},"layout": {"x": 2,"y": 0,"width": 4,"height": 2}}]} When the request is sent Then the response status is 200 OK And the response "title" is equal to "{{ unique }} with Audit Logs Query" @@ -466,6 +465,27 @@ Feature: Dashboards And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "metrics" And the response "widgets[0].definition.requests[0].style.palette" is equal to "dog_classic" + @team:DataDog/dashboards-backend + Scenario: Create a new dashboard with formulas and functions events query using facet group by + Given new "CreateDashboard" request + And body with value {"title": "{{ unique }} with events facet group_by", "widgets": [{"definition": {"type": "timeseries", "requests": [{"response_format": "timeseries", "queries": [{"data_source": "events", "name": "query1", "search": {"query": ""}, "compute": {"aggregation": "count"}, "group_by": [{"facet": "service", "limit": 10}]}]}]}, "layout": {"x": 0, "y": 0, "width": 4, "height": 2}}], "layout_type": "ordered"} + 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 "events" + And the response "widgets[0].definition.requests[0].queries[0].group_by[0].facet" is equal to "service" + And the response "widgets[0].definition.requests[0].queries[0].group_by[0].limit" is equal to 10 + + @team:DataDog/dashboards-backend + Scenario: Create a new dashboard with formulas and functions events query using flat group by fields + Given new "CreateDashboard" request + And body with value {"title": "{{ unique }} with events flat group_by fields", "widgets": [{"definition": {"type": "timeseries", "requests": [{"response_format": "timeseries", "queries": [{"data_source": "events", "name": "query1", "search": {"query": ""}, "compute": {"aggregation": "count"}, "group_by": {"fields": ["service", "host"], "limit": 10}}]}]}, "layout": {"x": 0, "y": 0, "width": 4, "height": 2}}], "layout_type": "ordered"} + 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 "events" + And the response "widgets[0].definition.requests[0].queries[0].group_by.fields[0]" is equal to "service" + And the response "widgets[0].definition.requests[0].queries[0].group_by.fields[1]" is equal to "host" + And the response "widgets[0].definition.requests[0].queries[0].group_by.limit" is equal to 10 + @team:DataDog/dashboards-backend Scenario: Create a new dashboard with formulas and functions scatterplot widget Given new "CreateDashboard" request @@ -568,7 +588,7 @@ Feature: Dashboards @team:DataDog/dashboards-backend Scenario: Create a new dashboard with invalid team tags returns "Bad Request" response Given new "CreateDashboard" request - And body with value { "title": "{{ unique }}", "widgets": [ { "definition": { "title": "", "title_size": "16", "title_align": "left", "time": {}, "type": "change", "requests": [ { "formulas": [ { "formula": "hour_before(query1)" }, { "formula": "query1" } ], "queries": [ { "data_source": "logs", "name": "query1", "search": { "query": "" }, "indexes": [ "*" ], "compute": { "aggregation": "count" }, "group_by": [] } ], "response_format": "scalar", "compare_to": "hour_before", "increase_good": true, "order_by": "change", "change_type": "absolute", "order_dir": "desc" } ] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 4 } } ], "tags": ["tm:foobar"], "layout_type": "ordered" } + And body with value { "title": "{{ unique }}", "widgets": [ { "definition": { "title": "", "title_size": "16", "title_align": "left", "time": {}, "type": "change", "requests": [ { "formulas": [ { "formula": "hour_before(query1)" }, { "formula": "query1" } ], "queries": [ { "data_source": "logs", "name": "query1", "search": { "query": "" }, "indexes": [ "*" ], "compute": { "aggregation": "count" } } ], "response_format": "scalar", "compare_to": "hour_before", "increase_good": true, "order_by": "change", "change_type": "absolute", "order_dir": "desc" } ] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 4 } } ], "tags": ["tm:foobar"], "layout_type": "ordered" } When the request is sent Then the response status is 400 Bad Request @@ -867,7 +887,7 @@ Feature: Dashboards @team:DataDog/dashboards-backend Scenario: Create a new dashboard with team tags returns "OK" response Given new "CreateDashboard" request - And body with value { "title": "{{ unique }}", "widgets": [ { "definition": { "title": "", "title_size": "16", "title_align": "left", "time": {}, "type": "change", "requests": [ { "formulas": [ { "formula": "hour_before(query1)" }, { "formula": "query1" } ], "queries": [ { "data_source": "logs", "name": "query1", "search": { "query": "" }, "indexes": [ "*" ], "compute": { "aggregation": "count" }, "group_by": [] } ], "response_format": "scalar", "compare_to": "hour_before", "increase_good": true, "order_by": "change", "change_type": "absolute", "order_dir": "desc" } ] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 4 } } ], "tags": ["team:foobar"], "layout_type": "ordered" } + And body with value { "title": "{{ unique }}", "widgets": [ { "definition": { "title": "", "title_size": "16", "title_align": "left", "time": {}, "type": "change", "requests": [ { "formulas": [ { "formula": "hour_before(query1)" }, { "formula": "query1" } ], "queries": [ { "data_source": "logs", "name": "query1", "search": { "query": "" }, "indexes": [ "*" ], "compute": { "aggregation": "count" } } ], "response_format": "scalar", "compare_to": "hour_before", "increase_good": true, "order_by": "change", "change_type": "absolute", "order_dir": "desc" } ] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 4 } } ], "tags": ["team:foobar"], "layout_type": "ordered" } When the request is sent Then the response status is 200 OK And the response "title" is equal to "{{ unique }}"