Skip to content

Commit bdbdd1e

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add trace_stream to dashboard ListStreamSource (#1622)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent fc8c6f6 commit bdbdd1e

File tree

7 files changed

+113
-5
lines changed

7 files changed

+113
-5
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.5",
7-
"regenerated": "2023-08-23 18:27:39.959682",
8-
"spec_repo_commit": "d78a6960"
7+
"regenerated": "2023-08-23 20:02:20.233538",
8+
"spec_repo_commit": "7e4a4121"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.5",
12-
"regenerated": "2023-08-23 18:27:39.972683",
13-
"spec_repo_commit": "d78a6960"
12+
"regenerated": "2023-08-23 20:02:20.251225",
13+
"spec_repo_commit": "7e4a4121"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4414,6 +4414,7 @@ components:
44144414
- ci_test_stream
44154415
- rum_issue_stream
44164416
- apm_issue_stream
4417+
- trace_stream
44174418
- logs_issue_stream
44184419
- logs_pattern_stream
44194420
- logs_transaction_stream
@@ -4427,6 +4428,7 @@ components:
44274428
- CI_TEST_STREAM
44284429
- RUM_ISSUE_STREAM
44294430
- APM_ISSUE_STREAM
4431+
- TRACE_STREAM
44304432
- LOGS_ISSUE_STREAM
44314433
- LOGS_PATTERN_STREAM
44324434
- LOGS_TRANSACTION_STREAM
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
"""
2+
Create a new dashboard with trace_stream widget
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
7+
from datadog_api_client.v1.model.dashboard import Dashboard
8+
from datadog_api_client.v1.model.dashboard_layout_type import DashboardLayoutType
9+
from datadog_api_client.v1.model.list_stream_column import ListStreamColumn
10+
from datadog_api_client.v1.model.list_stream_column_width import ListStreamColumnWidth
11+
from datadog_api_client.v1.model.list_stream_query import ListStreamQuery
12+
from datadog_api_client.v1.model.list_stream_response_format import ListStreamResponseFormat
13+
from datadog_api_client.v1.model.list_stream_source import ListStreamSource
14+
from datadog_api_client.v1.model.list_stream_widget_definition import ListStreamWidgetDefinition
15+
from datadog_api_client.v1.model.list_stream_widget_definition_type import ListStreamWidgetDefinitionType
16+
from datadog_api_client.v1.model.list_stream_widget_request import ListStreamWidgetRequest
17+
from datadog_api_client.v1.model.widget import Widget
18+
19+
body = Dashboard(
20+
layout_type=DashboardLayoutType.ORDERED,
21+
title="Example-Dashboard with list_stream widget",
22+
widgets=[
23+
Widget(
24+
definition=ListStreamWidgetDefinition(
25+
type=ListStreamWidgetDefinitionType.LIST_STREAM,
26+
requests=[
27+
ListStreamWidgetRequest(
28+
columns=[
29+
ListStreamColumn(
30+
width=ListStreamColumnWidth.AUTO,
31+
field="timestamp",
32+
),
33+
ListStreamColumn(
34+
width=ListStreamColumnWidth.AUTO,
35+
field="service",
36+
),
37+
],
38+
query=ListStreamQuery(
39+
data_source=ListStreamSource.TRACE_STREAM,
40+
query_string="",
41+
),
42+
response_format=ListStreamResponseFormat.EVENT_LIST,
43+
),
44+
],
45+
),
46+
),
47+
],
48+
)
49+
50+
configuration = Configuration()
51+
with ApiClient(configuration) as api_client:
52+
api_instance = DashboardsApi(api_client)
53+
response = api_instance.create_dashboard(body=body)
54+
55+
print(response)

src/datadog_api_client/v1/model/list_stream_source.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ListStreamSource(ModelSimple):
1616
"""
1717
Source from which to query items to display in the stream.
1818
19-
:param value: If omitted defaults to "apm_issue_stream". Must be one of ["logs_stream", "audit_stream", "ci_pipeline_stream", "ci_test_stream", "rum_issue_stream", "apm_issue_stream", "logs_issue_stream", "logs_pattern_stream", "logs_transaction_stream", "event_stream"].
19+
:param value: If omitted defaults to "apm_issue_stream". Must be one of ["logs_stream", "audit_stream", "ci_pipeline_stream", "ci_test_stream", "rum_issue_stream", "apm_issue_stream", "trace_stream", "logs_issue_stream", "logs_pattern_stream", "logs_transaction_stream", "event_stream"].
2020
:type value: str
2121
"""
2222

@@ -27,6 +27,7 @@ class ListStreamSource(ModelSimple):
2727
"ci_test_stream",
2828
"rum_issue_stream",
2929
"apm_issue_stream",
30+
"trace_stream",
3031
"logs_issue_stream",
3132
"logs_pattern_stream",
3233
"logs_transaction_stream",
@@ -38,6 +39,7 @@ class ListStreamSource(ModelSimple):
3839
CI_TEST_STREAM: ClassVar["ListStreamSource"]
3940
RUM_ISSUE_STREAM: ClassVar["ListStreamSource"]
4041
APM_ISSUE_STREAM: ClassVar["ListStreamSource"]
42+
TRACE_STREAM: ClassVar["ListStreamSource"]
4143
LOGS_ISSUE_STREAM: ClassVar["ListStreamSource"]
4244
LOGS_PATTERN_STREAM: ClassVar["ListStreamSource"]
4345
LOGS_TRANSACTION_STREAM: ClassVar["ListStreamSource"]
@@ -56,6 +58,7 @@ def openapi_types(_):
5658
ListStreamSource.CI_TEST_STREAM = ListStreamSource("ci_test_stream")
5759
ListStreamSource.RUM_ISSUE_STREAM = ListStreamSource("rum_issue_stream")
5860
ListStreamSource.APM_ISSUE_STREAM = ListStreamSource("apm_issue_stream")
61+
ListStreamSource.TRACE_STREAM = ListStreamSource("trace_stream")
5962
ListStreamSource.LOGS_ISSUE_STREAM = ListStreamSource("logs_issue_stream")
6063
ListStreamSource.LOGS_PATTERN_STREAM = ListStreamSource("logs_pattern_stream")
6164
ListStreamSource.LOGS_TRANSACTION_STREAM = ListStreamSource("logs_transaction_stream")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2022-04-11T09:33:06.223Z
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
interactions:
2+
- request:
3+
body: '{"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_trace_stream_widget-1649669586
4+
with list_stream widget","widgets":[{"definition":{"requests":[{"columns":[{"field":"timestamp","width":"auto"},{"field":"service","width":"auto"}],"query":{"data_source":"trace_stream","query_string":""},"response_format":"event_list"}],"type":"list_stream"}}]}'
5+
headers:
6+
accept:
7+
- application/json
8+
content-type:
9+
- application/json
10+
method: POST
11+
uri: https://api.datadoghq.com/api/v1/dashboard
12+
response:
13+
body:
14+
string: '{"notify_list":null,"description":null,"restricted_roles":[],"author_name":null,"template_variables":null,"is_read_only":false,"id":"hq5-hih-hbv","title":"Test-Create_a_new_dashboard_with_trace_stream_widget-1649669586
15+
with list_stream widget","url":"/dashboard/hq5-hih-hbv/test-createanewdashboardwithtracestreamwidget-1649669586-with-liststream-widget","created_at":"2022-04-11T09:33:06.331374+00:00","modified_at":"2022-04-11T09:33:06.331374+00:00","author_handle":"[email protected]","widgets":[{"definition":{"requests":[{"query":{"query_string":"","data_source":"trace_stream"},"response_format":"event_list","columns":[{"field":"timestamp","width":"auto"},{"field":"service","width":"auto"}]}],"type":"list_stream"},"id":6190567117163115}],"layout_type":"ordered"}'
16+
headers:
17+
content-type:
18+
- application/json
19+
status:
20+
code: 200
21+
message: OK
22+
- request:
23+
body: null
24+
headers:
25+
accept:
26+
- application/json
27+
method: DELETE
28+
uri: https://api.datadoghq.com/api/v1/dashboard/hq5-hih-hbv
29+
response:
30+
body:
31+
string: '{"deleted_dashboard_id":"hq5-hih-hbv"}'
32+
headers:
33+
content-type:
34+
- application/json
35+
status:
36+
code: 200
37+
message: OK
38+
version: 1

tests/v1/features/dashboards.feature

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,15 @@ Feature: Dashboards
731731
And the response "widgets[0].definition.type" is equal to "trace_service"
732732
And the response "widgets[0].definition.env" is equal to "none"
733733

734+
@team:DataDog/dashboards-backend
735+
Scenario: Create a new dashboard with trace_stream widget
736+
Given new "CreateDashboard" request
737+
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":"service"}],"query":{"data_source":"trace_stream","query_string":""},"response_format":"event_list"}]}}]}
738+
When the request is sent
739+
Then the response status is 200 OK
740+
And the response "widgets[0].definition.type" is equal to "list_stream"
741+
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "trace_stream"
742+
734743
@team:DataDog/dashboards-backend
735744
Scenario: Create a new timeseries widget with ci_pipelines data source
736745
Given new "CreateDashboard" request

0 commit comments

Comments
 (0)