Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add event_stream fields to dashboard list stream widget #1329

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.4",
"regenerated": "2023-02-08 15:58:24.646504",
"spec_repo_commit": "7c0c43cc"
"regenerated": "2023-02-08 16:22:55.326401",
"spec_repo_commit": "c826f5c2"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2023-02-08 15:58:24.657649",
"spec_repo_commit": "7c0c43cc"
"regenerated": "2023-02-08 16:22:55.343166",
"spec_repo_commit": "c826f5c2"
}
}
}
4 changes: 4 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4078,6 +4078,8 @@ components:
type: array
data_source:
$ref: '#/components/schemas/ListStreamSource'
event_size:
$ref: '#/components/schemas/WidgetEventSize'
group_by:
description: Group by configuration for the List Stream Widget. Group by
can be used only with logs_pattern_stream (up to 3 items) or logs_transaction_stream
Expand Down Expand Up @@ -4122,6 +4124,7 @@ components:
- apm_issue_stream
- logs_pattern_stream
- logs_transaction_stream
- event_stream
example: apm_issue_stream
type: string
x-enum-varnames:
Expand All @@ -4131,6 +4134,7 @@ components:
- APM_ISSUE_STREAM
- LOGS_PATTERN_STREAM
- LOGS_TRANSACTION_STREAM
- EVENT_STREAM
ListStreamWidgetDefinition:
description: 'The list stream visualization displays a table of recent events
in your application that
Expand Down
53 changes: 53 additions & 0 deletions examples/v1/dashboards/CreateDashboard_2432046716.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
"""
Create a new dashboard with event_stream list_stream widget
"""

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.list_stream_column import ListStreamColumn
from datadog_api_client.v1.model.list_stream_column_width import ListStreamColumnWidth
from datadog_api_client.v1.model.list_stream_query import ListStreamQuery
from datadog_api_client.v1.model.list_stream_response_format import ListStreamResponseFormat
from datadog_api_client.v1.model.list_stream_source import ListStreamSource
from datadog_api_client.v1.model.list_stream_widget_definition import ListStreamWidgetDefinition
from datadog_api_client.v1.model.list_stream_widget_definition_type import ListStreamWidgetDefinitionType
from datadog_api_client.v1.model.list_stream_widget_request import ListStreamWidgetRequest
from datadog_api_client.v1.model.widget import Widget
from datadog_api_client.v1.model.widget_event_size import WidgetEventSize

body = Dashboard(
layout_type=DashboardLayoutType.ORDERED,
title="Example-Create_a_new_dashboard_with_event_stream_list_stream_widget with list_stream widget",
widgets=[
Widget(
definition=ListStreamWidgetDefinition(
type=ListStreamWidgetDefinitionType.LIST_STREAM,
requests=[
ListStreamWidgetRequest(
columns=[
ListStreamColumn(
width=ListStreamColumnWidth.AUTO,
field="timestamp",
),
],
query=ListStreamQuery(
data_source=ListStreamSource.EVENT_STREAM,
query_string="",
event_size=WidgetEventSize.LARGE,
),
response_format=ListStreamResponseFormat.EVENT_LIST,
),
],
),
),
],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = DashboardsApi(api_client)
response = api_instance.create_dashboard(body=body)

print(response)
10 changes: 10 additions & 0 deletions src/datadog_api_client/v1/model/list_stream_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
if TYPE_CHECKING:
from datadog_api_client.v1.model.list_stream_compute_items import ListStreamComputeItems
from datadog_api_client.v1.model.list_stream_source import ListStreamSource
from datadog_api_client.v1.model.widget_event_size import WidgetEventSize
from datadog_api_client.v1.model.list_stream_group_by_items import ListStreamGroupByItems


Expand All @@ -34,11 +35,13 @@ class ListStreamQuery(ModelNormal):
def openapi_types(_):
from datadog_api_client.v1.model.list_stream_compute_items import ListStreamComputeItems
from datadog_api_client.v1.model.list_stream_source import ListStreamSource
from datadog_api_client.v1.model.widget_event_size import WidgetEventSize
from datadog_api_client.v1.model.list_stream_group_by_items import ListStreamGroupByItems

return {
"compute": ([ListStreamComputeItems],),
"data_source": (ListStreamSource,),
"event_size": (WidgetEventSize,),
"group_by": ([ListStreamGroupByItems],),
"indexes": ([str],),
"query_string": (str,),
Expand All @@ -48,6 +51,7 @@ def openapi_types(_):
attribute_map = {
"compute": "compute",
"data_source": "data_source",
"event_size": "event_size",
"group_by": "group_by",
"indexes": "indexes",
"query_string": "query_string",
Expand All @@ -59,6 +63,7 @@ def __init__(
data_source: ListStreamSource,
query_string: str,
compute: Union[List[ListStreamComputeItems], UnsetType] = unset,
event_size: Union[WidgetEventSize, UnsetType] = unset,
group_by: Union[List[ListStreamGroupByItems], UnsetType] = unset,
indexes: Union[List[str], UnsetType] = unset,
storage: Union[str, UnsetType] = unset,
Expand All @@ -73,6 +78,9 @@ def __init__(
:param data_source: Source from which to query items to display in the stream.
:type data_source: ListStreamSource
:param event_size: Size to use to display an event.
:type event_size: WidgetEventSize, optional
:param group_by: Group by configuration for the List Stream Widget. Group by can be used only with logs_pattern_stream (up to 3 items) or logs_transaction_stream (one group by item is required) list stream source.
:type group_by: [ListStreamGroupByItems], optional
Expand All @@ -87,6 +95,8 @@ def __init__(
"""
if compute is not unset:
kwargs["compute"] = compute
if event_size is not unset:
kwargs["event_size"] = event_size
if group_by is not unset:
kwargs["group_by"] = group_by
if indexes is not unset:
Expand Down
5 changes: 4 additions & 1 deletion src/datadog_api_client/v1/model/list_stream_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ListStreamSource(ModelSimple):
"""
Source from which to query items to display in the stream.
:param value: If omitted defaults to "apm_issue_stream". Must be one of ["logs_stream", "audit_stream", "rum_issue_stream", "apm_issue_stream", "logs_pattern_stream", "logs_transaction_stream"].
:param value: If omitted defaults to "apm_issue_stream". Must be one of ["logs_stream", "audit_stream", "rum_issue_stream", "apm_issue_stream", "logs_pattern_stream", "logs_transaction_stream", "event_stream"].
:type value: str
"""

Expand All @@ -27,13 +27,15 @@ class ListStreamSource(ModelSimple):
"apm_issue_stream",
"logs_pattern_stream",
"logs_transaction_stream",
"event_stream",
}
LOGS_STREAM: ClassVar["ListStreamSource"]
AUDIT_STREAM: ClassVar["ListStreamSource"]
RUM_ISSUE_STREAM: ClassVar["ListStreamSource"]
APM_ISSUE_STREAM: ClassVar["ListStreamSource"]
LOGS_PATTERN_STREAM: ClassVar["ListStreamSource"]
LOGS_TRANSACTION_STREAM: ClassVar["ListStreamSource"]
EVENT_STREAM: ClassVar["ListStreamSource"]

@cached_property
def openapi_types(_):
Expand All @@ -48,3 +50,4 @@ def openapi_types(_):
ListStreamSource.APM_ISSUE_STREAM = ListStreamSource("apm_issue_stream")
ListStreamSource.LOGS_PATTERN_STREAM = ListStreamSource("logs_pattern_stream")
ListStreamSource.LOGS_TRANSACTION_STREAM = ListStreamSource("logs_transaction_stream")
ListStreamSource.EVENT_STREAM = ListStreamSource("event_stream")
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-02-08T16:18:06.266Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
interactions:
- request:
body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_event_stream_list_stream_widget-1675873086
with list_stream widget","widgets":[{"definition":{"requests":[{"columns":[{"field":"timestamp","width":"auto"}],"query":{"data_source":"event_stream","event_size":"l","query_string":""},"response_format":"event_list"}],"type":"list_stream"}}]}'
headers:
accept:
- application/json
content-type:
- application/json
method: POST
uri: https://api.datadoghq.com/api/v1/dashboard
response:
body:
string: '{"notify_list":null,"description":null,"restricted_roles":[],"author_name":null,"template_variables":null,"is_read_only":false,"id":"zmh-rud-g4b","title":"Test-Create_a_new_dashboard_with_event_stream_list_stream_widget-1675873086
with list_stream widget","url":"/dashboard/zmh-rud-g4b/test-createanewdashboardwitheventstreamliststreamwidget-1675873086-with-liststre","created_at":"2023-02-08T16:18:06.512655+00:00","modified_at":"2023-02-08T16:18:06.512655+00:00","author_handle":"frog@datadoghq.com","widgets":[{"definition":{"requests":[{"query":{"query_string":"","data_source":"event_stream","event_size":"l"},"response_format":"event_list","columns":[{"field":"timestamp","width":"auto"}]}],"type":"list_stream"},"id":3303593204363469}],"layout_type":"ordered"}
'
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/zmh-rud-g4b
response:
body:
string: '{"deleted_dashboard_id":"zmh-rud-g4b"}
'
headers:
content-type:
- application/json
status:
code: 200
message: OK
version: 1
11 changes: 11 additions & 0 deletions tests/v1/features/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,17 @@ Feature: Dashboards
And the response "widgets[0].definition.requests[0].apm_stats_query.service" is equal to "cassandra"
And the response "widgets[0].definition.requests[0].apm_stats_query.name" is equal to "cassandra.query"

@team:DataDog/dashboards
Scenario: Create a new dashboard with event_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": "event_stream","query_string": "","event_size": "l"},"response_format": "event_list"}]}}]}
When the request is sent
Then the response status is 200 OK
And the response "widgets[0].definition.type" is equal to "list_stream"
And the response "widgets[0].definition.requests[0].response_format" is equal to "event_list"
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "event_stream"
And the response "widgets[0].definition.requests[0].query.event_size" is equal to "l"

@team:DataDog/dashboards
Scenario: Create a new dashboard with event_stream widget
Given new "CreateDashboard" request
Expand Down