Skip to content

Commit 4e5919e

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
and
ci.datadog-api-spec
authored
Updated OpenAPI logs_pattern_query to support Patterns for any attribute (#2272)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent b7de63d commit 4e5919e

File tree

8 files changed

+56
-14
lines changed

8 files changed

+56
-14
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-11-20 20:14:24.816715",
8-
"spec_repo_commit": "ebf27b5e"
7+
"regenerated": "2024-11-20 21:48:33.802103",
8+
"spec_repo_commit": "34905ccb"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-11-20 20:14:24.834527",
13-
"spec_repo_commit": "ebf27b5e"
12+
"regenerated": "2024-11-20 21:48:33.819731",
13+
"spec_repo_commit": "34905ccb"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4654,6 +4654,11 @@ components:
46544654
description: Widget column field.
46554655
example: content
46564656
type: string
4657+
is_clustering_pattern_field_path:
4658+
description: Identifies the clustering pattern field column, usable only
4659+
with logs_pattern_stream.
4660+
example: true
4661+
type: boolean
46574662
width:
46584663
$ref: '#/components/schemas/ListStreamColumnWidth'
46594664
required:
@@ -4733,6 +4738,12 @@ components:
47334738
ListStreamQuery:
47344739
description: Updated list stream widget.
47354740
properties:
4741+
clustering_pattern_field_path:
4742+
default: message
4743+
description: Specifies the field for logs pattern clustering. Usable only
4744+
with logs_pattern_stream.
4745+
example: message
4746+
type: string
47364747
compute:
47374748
description: Compute configuration for the List Stream Widget. Compute can
47384749
be used only with the logs_transaction_stream (from 1 to 5 items) list

examples/v1/dashboards/CreateDashboard_1039800684.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,16 @@
3131
width=ListStreamColumnWidth.AUTO,
3232
field="timestamp",
3333
),
34+
ListStreamColumn(
35+
width=ListStreamColumnWidth.AUTO,
36+
field="message",
37+
is_clustering_pattern_field_path=True,
38+
),
3439
],
3540
query=ListStreamQuery(
3641
data_source=ListStreamSource.LOGS_PATTERN_STREAM,
3742
query_string="",
43+
clustering_pattern_field_path="message",
3844
group_by=[
3945
ListStreamGroupByItems(
4046
facet="service",

src/datadog_api_client/v1/model/list_stream_column.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6-
from typing import TYPE_CHECKING
6+
from typing import Union, TYPE_CHECKING
77

88
from datadog_api_client.model_utils import (
99
ModelNormal,
1010
cached_property,
11+
unset,
12+
UnsetType,
1113
)
1214

1315

@@ -22,24 +24,37 @@ def openapi_types(_):
2224

2325
return {
2426
"field": (str,),
27+
"is_clustering_pattern_field_path": (bool,),
2528
"width": (ListStreamColumnWidth,),
2629
}
2730

2831
attribute_map = {
2932
"field": "field",
33+
"is_clustering_pattern_field_path": "is_clustering_pattern_field_path",
3034
"width": "width",
3135
}
3236

33-
def __init__(self_, field: str, width: ListStreamColumnWidth, **kwargs):
37+
def __init__(
38+
self_,
39+
field: str,
40+
width: ListStreamColumnWidth,
41+
is_clustering_pattern_field_path: Union[bool, UnsetType] = unset,
42+
**kwargs,
43+
):
3444
"""
3545
Widget column.
3646
3747
:param field: Widget column field.
3848
:type field: str
3949
50+
:param is_clustering_pattern_field_path: Identifies the clustering pattern field column, usable only with logs_pattern_stream.
51+
:type is_clustering_pattern_field_path: bool, optional
52+
4053
:param width: Widget column width.
4154
:type width: ListStreamColumnWidth
4255
"""
56+
if is_clustering_pattern_field_path is not unset:
57+
kwargs["is_clustering_pattern_field_path"] = is_clustering_pattern_field_path
4358
super().__init__(kwargs)
4459

4560
self_.field = field

src/datadog_api_client/v1/model/list_stream_query.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def openapi_types(_):
4141
from datadog_api_client.v1.model.widget_field_sort import WidgetFieldSort
4242

4343
return {
44+
"clustering_pattern_field_path": (str,),
4445
"compute": ([ListStreamComputeItems],),
4546
"data_source": (ListStreamSource,),
4647
"event_size": (WidgetEventSize,),
@@ -52,6 +53,7 @@ def openapi_types(_):
5253
}
5354

5455
attribute_map = {
56+
"clustering_pattern_field_path": "clustering_pattern_field_path",
5557
"compute": "compute",
5658
"data_source": "data_source",
5759
"event_size": "event_size",
@@ -66,6 +68,7 @@ def __init__(
6668
self_,
6769
data_source: ListStreamSource,
6870
query_string: str,
71+
clustering_pattern_field_path: Union[str, UnsetType] = unset,
6972
compute: Union[List[ListStreamComputeItems], UnsetType] = unset,
7073
event_size: Union[WidgetEventSize, UnsetType] = unset,
7174
group_by: Union[List[ListStreamGroupByItems], UnsetType] = unset,
@@ -77,6 +80,9 @@ def __init__(
7780
"""
7881
Updated list stream widget.
7982
83+
:param clustering_pattern_field_path: Specifies the field for logs pattern clustering. Usable only with logs_pattern_stream.
84+
:type clustering_pattern_field_path: str, optional
85+
8086
: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.
8187
:type compute: [ListStreamComputeItems], optional
8288
@@ -101,6 +107,8 @@ def __init__(
101107
:param storage: Option for storage location. Feature in Private Beta.
102108
:type storage: str, optional
103109
"""
110+
if clustering_pattern_field_path is not unset:
111+
kwargs["clustering_pattern_field_path"] = clustering_pattern_field_path
104112
if compute is not unset:
105113
kwargs["compute"] = compute
106114
if event_size is not unset:
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-11-15T19:32:46.627Z
1+
2024-11-20T19:43:46.485Z

tests/v1/cassettes/test_scenarios/test_create_a_new_dashboard_with_logs_pattern_stream_list_stream_widget.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
interactions:
22
- request:
3-
body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_logs_pattern_stream_list_stream_widget-1731699166
4-
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"}}]}'
3+
body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_logs_pattern_stream_list_stream_widget-1732131826
4+
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"}}]}'
55
headers:
66
accept:
77
- application/json
@@ -11,8 +11,9 @@ interactions:
1111
uri: https://api.datadoghq.com/api/v1/dashboard
1212
response:
1313
body:
14-
string: '{"id":"hem-inu-je6","title":"Test-Create_a_new_dashboard_with_logs_pattern_stream_list_stream_widget-1731699166
15-
with list_stream widget","description":null,"author_handle":"[email protected]","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":[]}
14+
string: '{"id":"r75-hd7-sd9","title":"Test-Create_a_new_dashboard_with_logs_pattern_stream_list_stream_widget-1732131826
15+
with list_stream widget","description":null,"author_handle":"9919ec9b-ebc7-49ee-8dc8-03626e717cca","author_name":"CI
16+
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":[]}
1617
1718
'
1819
headers:
@@ -27,10 +28,10 @@ interactions:
2728
accept:
2829
- application/json
2930
method: DELETE
30-
uri: https://api.datadoghq.com/api/v1/dashboard/hem-inu-je6
31+
uri: https://api.datadoghq.com/api/v1/dashboard/r75-hd7-sd9
3132
response:
3233
body:
33-
string: '{"deleted_dashboard_id":"hem-inu-je6"}
34+
string: '{"deleted_dashboard_id":"r75-hd7-sd9"}
3435
3536
'
3637
headers:

tests/v1/features/dashboards.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,11 +534,12 @@ Feature: Dashboards
534534
@team:DataDog/dashboards-backend
535535
Scenario: Create a new dashboard with logs_pattern_stream list_stream widget
536536
Given new "CreateDashboard" request
537-
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"}]}}]}
537+
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"}]}}]}
538538
When the request is sent
539539
Then the response status is 200 OK
540540
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "logs_pattern_stream"
541541
And the response "widgets[0].definition.requests[0].query.group_by[0].facet" is equal to "service"
542+
And the response "widgets[0].definition.requests[0].query.clustering_pattern_field_path" is equal to "message"
542543

543544
@team:DataDog/dashboards-backend
544545
Scenario: Create a new dashboard with logs_stream list_stream widget and storage parameter

0 commit comments

Comments
 (0)