diff --git a/.apigentools-info b/.apigentools-info index f211597722..9a1b9e2de2 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-11-20 20:14:24.816715", - "spec_repo_commit": "ebf27b5e" + "regenerated": "2024-11-20 21:48:33.802103", + "spec_repo_commit": "34905ccb" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-11-20 20:14:24.834527", - "spec_repo_commit": "ebf27b5e" + "regenerated": "2024-11-20 21:48:33.819731", + "spec_repo_commit": "34905ccb" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 4dc36090de..9f928e0266 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -4654,6 +4654,11 @@ components: description: Widget column field. example: content type: string + is_clustering_pattern_field_path: + description: Identifies the clustering pattern field column, usable only + with logs_pattern_stream. + example: true + type: boolean width: $ref: '#/components/schemas/ListStreamColumnWidth' required: @@ -4733,6 +4738,12 @@ components: ListStreamQuery: description: Updated list stream widget. properties: + clustering_pattern_field_path: + default: message + description: Specifies the field for logs pattern clustering. Usable only + with logs_pattern_stream. + example: message + type: string compute: description: Compute configuration for the List Stream Widget. Compute can be used only with the logs_transaction_stream (from 1 to 5 items) list diff --git a/examples/v1/dashboards/CreateDashboard_1039800684.py b/examples/v1/dashboards/CreateDashboard_1039800684.py index 5978bab1ad..d5ee3c0c60 100644 --- a/examples/v1/dashboards/CreateDashboard_1039800684.py +++ b/examples/v1/dashboards/CreateDashboard_1039800684.py @@ -31,10 +31,16 @@ width=ListStreamColumnWidth.AUTO, field="timestamp", ), + ListStreamColumn( + width=ListStreamColumnWidth.AUTO, + field="message", + is_clustering_pattern_field_path=True, + ), ], query=ListStreamQuery( data_source=ListStreamSource.LOGS_PATTERN_STREAM, query_string="", + clustering_pattern_field_path="message", group_by=[ ListStreamGroupByItems( facet="service", diff --git a/src/datadog_api_client/v1/model/list_stream_column.py b/src/datadog_api_client/v1/model/list_stream_column.py index 13c02d3ae4..f4ab1db95a 100644 --- a/src/datadog_api_client/v1/model/list_stream_column.py +++ b/src/datadog_api_client/v1/model/list_stream_column.py @@ -3,11 +3,13 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import TYPE_CHECKING +from typing import Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, cached_property, + unset, + UnsetType, ) @@ -22,24 +24,37 @@ def openapi_types(_): return { "field": (str,), + "is_clustering_pattern_field_path": (bool,), "width": (ListStreamColumnWidth,), } attribute_map = { "field": "field", + "is_clustering_pattern_field_path": "is_clustering_pattern_field_path", "width": "width", } - def __init__(self_, field: str, width: ListStreamColumnWidth, **kwargs): + def __init__( + self_, + field: str, + width: ListStreamColumnWidth, + is_clustering_pattern_field_path: Union[bool, UnsetType] = unset, + **kwargs, + ): """ Widget column. :param field: Widget column field. :type field: str + :param is_clustering_pattern_field_path: Identifies the clustering pattern field column, usable only with logs_pattern_stream. + :type is_clustering_pattern_field_path: bool, optional + :param width: Widget column width. :type width: ListStreamColumnWidth """ + if is_clustering_pattern_field_path is not unset: + kwargs["is_clustering_pattern_field_path"] = is_clustering_pattern_field_path super().__init__(kwargs) self_.field = field diff --git a/src/datadog_api_client/v1/model/list_stream_query.py b/src/datadog_api_client/v1/model/list_stream_query.py index 2b73f3d633..1d9d716ed3 100644 --- a/src/datadog_api_client/v1/model/list_stream_query.py +++ b/src/datadog_api_client/v1/model/list_stream_query.py @@ -41,6 +41,7 @@ def openapi_types(_): from datadog_api_client.v1.model.widget_field_sort import WidgetFieldSort return { + "clustering_pattern_field_path": (str,), "compute": ([ListStreamComputeItems],), "data_source": (ListStreamSource,), "event_size": (WidgetEventSize,), @@ -52,6 +53,7 @@ def openapi_types(_): } attribute_map = { + "clustering_pattern_field_path": "clustering_pattern_field_path", "compute": "compute", "data_source": "data_source", "event_size": "event_size", @@ -66,6 +68,7 @@ def __init__( self_, data_source: ListStreamSource, query_string: str, + clustering_pattern_field_path: Union[str, UnsetType] = unset, compute: Union[List[ListStreamComputeItems], UnsetType] = unset, event_size: Union[WidgetEventSize, UnsetType] = unset, group_by: Union[List[ListStreamGroupByItems], UnsetType] = unset, @@ -77,6 +80,9 @@ def __init__( """ Updated list stream widget. + :param clustering_pattern_field_path: Specifies the field for logs pattern clustering. Usable only with logs_pattern_stream. + :type clustering_pattern_field_path: str, optional + :param compute: Compute configuration for the List Stream Widget. Compute can be used only with the logs_transaction_stream (from 1 to 5 items) list stream source. :type compute: [ListStreamComputeItems], optional @@ -101,6 +107,8 @@ def __init__( :param storage: Option for storage location. Feature in Private Beta. :type storage: str, optional """ + if clustering_pattern_field_path is not unset: + kwargs["clustering_pattern_field_path"] = clustering_pattern_field_path if compute is not unset: kwargs["compute"] = compute if event_size is not unset: diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_logs_pattern_stream_list_stream_widget.frozen b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_logs_pattern_stream_list_stream_widget.frozen index d64ee9657a..f275079fee 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_logs_pattern_stream_list_stream_widget.frozen +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_logs_pattern_stream_list_stream_widget.frozen @@ -1 +1 @@ -2024-11-15T19:32:46.627Z \ No newline at end of file +2024-11-20T19:43:46.485Z \ No newline at end of file diff --git a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_logs_pattern_stream_list_stream_widget.yaml b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_logs_pattern_stream_list_stream_widget.yaml index cc213ac888..edff73eb03 100644 --- a/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_logs_pattern_stream_list_stream_widget.yaml +++ b/tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_logs_pattern_stream_list_stream_widget.yaml @@ -1,7 +1,7 @@ interactions: - request: - body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_logs_pattern_stream_list_stream_widget-1731699166 - with list_stream widget","widgets":[{"definition":{"requests":[{"columns":[{"field":"timestamp","width":"auto"}],"query":{"data_source":"logs_pattern_stream","group_by":[{"facet":"service"}],"query_string":""},"response_format":"event_list"}],"type":"list_stream"}}]}' + body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_logs_pattern_stream_list_stream_widget-1732131826 + with list_stream widget","widgets":[{"definition":{"requests":[{"columns":[{"field":"timestamp","width":"auto"},{"field":"message","is_clustering_pattern_field_path":true,"width":"auto"}],"query":{"clustering_pattern_field_path":"message","data_source":"logs_pattern_stream","group_by":[{"facet":"service"}],"query_string":""},"response_format":"event_list"}],"type":"list_stream"}}]}' headers: accept: - application/json @@ -11,8 +11,9 @@ interactions: uri: https://api.datadoghq.com/api/v1/dashboard response: body: - string: '{"id":"hem-inu-je6","title":"Test-Create_a_new_dashboard_with_logs_pattern_stream_list_stream_widget-1731699166 - with list_stream widget","description":null,"author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/hem-inu-je6/test-createanewdashboardwithlogspatternstreamliststreamwidget-1731699166-with-li","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"columns":[{"field":"timestamp","width":"auto"}],"query":{"data_source":"logs_pattern_stream","group_by":[{"facet":"service"}],"query_string":""},"response_format":"event_list"}],"type":"list_stream"},"id":4012469646916199}],"notify_list":null,"created_at":"2024-11-15T19:32:46.772627+00:00","modified_at":"2024-11-15T19:32:46.772627+00:00","restricted_roles":[]} + string: '{"id":"r75-hd7-sd9","title":"Test-Create_a_new_dashboard_with_logs_pattern_stream_list_stream_widget-1732131826 + with list_stream widget","description":null,"author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI + Account","layout_type":"ordered","url":"/dashboard/r75-hd7-sd9/test-createanewdashboardwithlogspatternstreamliststreamwidget-1732131826-with-li","is_read_only":false,"template_variables":null,"widgets":[{"definition":{"requests":[{"columns":[{"field":"timestamp","width":"auto"},{"field":"message","is_clustering_pattern_field_path":true,"width":"auto"}],"query":{"clustering_pattern_field_path":"message","data_source":"logs_pattern_stream","group_by":[{"facet":"service"}],"query_string":""},"response_format":"event_list"}],"type":"list_stream"},"id":6154246442450384}],"notify_list":null,"created_at":"2024-11-20T19:43:46.871965+00:00","modified_at":"2024-11-20T19:43:46.871965+00:00","restricted_roles":[]} ' headers: @@ -27,10 +28,10 @@ interactions: accept: - application/json method: DELETE - uri: https://api.datadoghq.com/api/v1/dashboard/hem-inu-je6 + uri: https://api.datadoghq.com/api/v1/dashboard/r75-hd7-sd9 response: body: - string: '{"deleted_dashboard_id":"hem-inu-je6"} + string: '{"deleted_dashboard_id":"r75-hd7-sd9"} ' headers: diff --git a/tests/v1/features/dashboards.feature b/tests/v1/features/dashboards.feature index 8d1a1bb8ac..208a4dd396 100644 --- a/tests/v1/features/dashboards.feature +++ b/tests/v1/features/dashboards.feature @@ -534,11 +534,12 @@ Feature: Dashboards @team:DataDog/dashboards-backend Scenario: Create a new dashboard with logs_pattern_stream list_stream widget Given new "CreateDashboard" request - And body with value {"layout_type": "ordered", "title": "{{ unique }} with list_stream widget","widgets": [{"definition": {"type": "list_stream","requests": [{"columns":[{"width":"auto","field":"timestamp"}],"query":{"data_source":"logs_pattern_stream","query_string":"","group_by":[{"facet":"service"}]},"response_format":"event_list"}]}}]} + And body with value {"layout_type": "ordered", "title": "{{ unique }} with list_stream widget","widgets": [{"definition": {"type": "list_stream","requests": [{"columns":[{"width":"auto","field":"timestamp"},{"width":"auto","field":"message", "is_clustering_pattern_field_path": true}],"query":{"data_source":"logs_pattern_stream","query_string":"","clustering_pattern_field_path":"message","group_by":[{"facet":"service"}]}, "response_format":"event_list"}]}}]} When the request is sent Then the response status is 200 OK And the response "widgets[0].definition.requests[0].query.data_source" is equal to "logs_pattern_stream" And the response "widgets[0].definition.requests[0].query.group_by[0].facet" is equal to "service" + And the response "widgets[0].definition.requests[0].query.clustering_pattern_field_path" is equal to "message" @team:DataDog/dashboards-backend Scenario: Create a new dashboard with logs_stream list_stream widget and storage parameter