Skip to content

Commit cfdc301

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add event_stream fields to dashboard list stream widget (#1011)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent b0a1a3d commit cfdc301

File tree

9 files changed

+190
-4
lines changed

9 files changed

+190
-4
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.4",
7-
"regenerated": "2023-02-08 15:58:27.051159",
8-
"spec_repo_commit": "7c0c43cc"
7+
"regenerated": "2023-02-08 16:22:59.782448",
8+
"spec_repo_commit": "c826f5c2"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2023-02-08 15:58:27.063520",
13-
"spec_repo_commit": "7c0c43cc"
12+
"regenerated": "2023-02-08 16:22:59.797784",
13+
"spec_repo_commit": "c826f5c2"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4078,6 +4078,8 @@ components:
40784078
type: array
40794079
data_source:
40804080
$ref: '#/components/schemas/ListStreamSource'
4081+
event_size:
4082+
$ref: '#/components/schemas/WidgetEventSize'
40814083
group_by:
40824084
description: Group by configuration for the List Stream Widget. Group by
40834085
can be used only with logs_pattern_stream (up to 3 items) or logs_transaction_stream
@@ -4122,6 +4124,7 @@ components:
41224124
- apm_issue_stream
41234125
- logs_pattern_stream
41244126
- logs_transaction_stream
4127+
- event_stream
41254128
example: apm_issue_stream
41264129
type: string
41274130
x-enum-varnames:
@@ -4131,6 +4134,7 @@ components:
41314134
- APM_ISSUE_STREAM
41324135
- LOGS_PATTERN_STREAM
41334136
- LOGS_TRANSACTION_STREAM
4137+
- EVENT_STREAM
41344138
ListStreamWidgetDefinition:
41354139
description: 'The list stream visualization displays a table of recent events
41364140
in your application that
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2023-02-08T16:18:06.266Z"
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"log": {
3+
"_recordingName": "Dashboards/Create a new dashboard with event_stream list_stream widget",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "e13a56fb8e7ecc8fcccd1dc11cfaf098",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 354,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "content-type",
26+
"value": "application/json"
27+
}
28+
],
29+
"headersSize": 559,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"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\"}}]}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v1/dashboard"
39+
},
40+
"response": {
41+
"bodySize": 768,
42+
"content": {
43+
"mimeType": "application/json",
44+
"size": 768,
45+
"text": "{\"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\":\"[email protected]\",\"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\"}\n"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/json"
52+
}
53+
],
54+
"headersSize": 490,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 200,
58+
"statusText": "OK"
59+
},
60+
"startedDateTime": "2023-02-08T16:18:06.275Z",
61+
"time": 272
62+
},
63+
{
64+
"_id": "ee1b2016b8d93d3f4959f703304bf7c6",
65+
"_order": 0,
66+
"cache": {},
67+
"request": {
68+
"bodySize": 0,
69+
"cookies": [],
70+
"headers": [
71+
{
72+
"_fromType": "array",
73+
"name": "accept",
74+
"value": "application/json"
75+
}
76+
],
77+
"headersSize": 520,
78+
"httpVersion": "HTTP/1.1",
79+
"method": "DELETE",
80+
"queryString": [],
81+
"url": "https://api.datadoghq.com/api/v1/dashboard/zmh-rud-g4b"
82+
},
83+
"response": {
84+
"bodySize": 39,
85+
"content": {
86+
"mimeType": "application/json",
87+
"size": 39,
88+
"text": "{\"deleted_dashboard_id\":\"zmh-rud-g4b\"}\n"
89+
},
90+
"cookies": [],
91+
"headers": [
92+
{
93+
"name": "content-type",
94+
"value": "application/json"
95+
}
96+
],
97+
"headersSize": 489,
98+
"httpVersion": "HTTP/1.1",
99+
"redirectURL": "",
100+
"status": 200,
101+
"statusText": "OK"
102+
},
103+
"startedDateTime": "2023-02-08T16:18:06.574Z",
104+
"time": 215
105+
}
106+
],
107+
"pages": [],
108+
"version": "1.2"
109+
}
110+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* Create a new dashboard with event_stream list_stream widget
3+
*/
4+
5+
import { client, v1 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v1.DashboardsApi(configuration);
9+
10+
const params: v1.DashboardsApiCreateDashboardRequest = {
11+
body: {
12+
layoutType: "ordered",
13+
title:
14+
"Example-Create_a_new_dashboard_with_event_stream_list_stream_widget with list_stream widget",
15+
widgets: [
16+
{
17+
definition: {
18+
type: "list_stream",
19+
requests: [
20+
{
21+
columns: [
22+
{
23+
width: "auto",
24+
field: "timestamp",
25+
},
26+
],
27+
query: {
28+
dataSource: "event_stream",
29+
queryString: "",
30+
eventSize: "l",
31+
},
32+
responseFormat: "event_list",
33+
},
34+
],
35+
},
36+
},
37+
],
38+
},
39+
};
40+
41+
apiInstance
42+
.createDashboard(params)
43+
.then((data: v1.Dashboard) => {
44+
console.log(
45+
"API called successfully. Returned data: " + JSON.stringify(data)
46+
);
47+
})
48+
.catch((error: any) => console.error(error));

features/v1/dashboards.feature

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,17 @@ Feature: Dashboards
204204
And the response "widgets[0].definition.requests[0].apm_stats_query.service" is equal to "cassandra"
205205
And the response "widgets[0].definition.requests[0].apm_stats_query.name" is equal to "cassandra.query"
206206

207+
@team:DataDog/dashboards
208+
Scenario: Create a new dashboard with event_stream list_stream widget
209+
Given new "CreateDashboard" request
210+
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"}]}}]}
211+
When the request is sent
212+
Then the response status is 200 OK
213+
And the response "widgets[0].definition.type" is equal to "list_stream"
214+
And the response "widgets[0].definition.requests[0].response_format" is equal to "event_list"
215+
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "event_stream"
216+
And the response "widgets[0].definition.requests[0].query.event_size" is equal to "l"
217+
207218
@team:DataDog/dashboards
208219
Scenario: Create a new dashboard with event_stream widget
209220
Given new "CreateDashboard" request

packages/datadog-api-client-v1/models/ListStreamQuery.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import { ListStreamComputeItems } from "./ListStreamComputeItems";
77
import { ListStreamGroupByItems } from "./ListStreamGroupByItems";
88
import { ListStreamSource } from "./ListStreamSource";
9+
import { WidgetEventSize } from "./WidgetEventSize";
910

1011
import { AttributeTypeMap } from "../../datadog-api-client-common/util";
1112

@@ -21,6 +22,10 @@ export class ListStreamQuery {
2122
* Source from which to query items to display in the stream.
2223
*/
2324
"dataSource": ListStreamSource;
25+
/**
26+
* Size to use to display an event.
27+
*/
28+
"eventSize"?: WidgetEventSize;
2429
/**
2530
* 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.
2631
*/
@@ -56,6 +61,10 @@ export class ListStreamQuery {
5661
type: "ListStreamSource",
5762
required: true,
5863
},
64+
eventSize: {
65+
baseName: "event_size",
66+
type: "WidgetEventSize",
67+
},
5968
groupBy: {
6069
baseName: "group_by",
6170
type: "Array<ListStreamGroupByItems>",

packages/datadog-api-client-v1/models/ListStreamSource.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ export type ListStreamSource =
1717
| typeof APM_ISSUE_STREAM
1818
| typeof LOGS_PATTERN_STREAM
1919
| typeof LOGS_TRANSACTION_STREAM
20+
| typeof EVENT_STREAM
2021
| UnparsedObject;
2122
export const LOGS_STREAM = "logs_stream";
2223
export const AUDIT_STREAM = "audit_stream";
2324
export const RUM_ISSUE_STREAM = "rum_issue_stream";
2425
export const APM_ISSUE_STREAM = "apm_issue_stream";
2526
export const LOGS_PATTERN_STREAM = "logs_pattern_stream";
2627
export const LOGS_TRANSACTION_STREAM = "logs_transaction_stream";
28+
export const EVENT_STREAM = "event_stream";

packages/datadog-api-client-v1/models/ObjectSerializer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ const enumsMap: { [key: string]: any[] } = {
744744
"apm_issue_stream",
745745
"logs_pattern_stream",
746746
"logs_transaction_stream",
747+
"event_stream",
747748
],
748749
ListStreamWidgetDefinitionType: ["list_stream"],
749750
LogStreamWidgetDefinitionType: ["log_stream"],

0 commit comments

Comments
 (0)