Skip to content

Commit 6752907

Browse files
ms1111wendigo
authored andcommitted
Filter queries by trace token in the web UI
1 parent 6f334b1 commit 6752907

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

core/trino-main/src/main/java/io/trino/server/ui/TrimmedBasicQueryInfo.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public class TrimmedBasicQueryInfo
5555
private final Optional<QueryType> queryType;
5656
private final RetryPolicy retryPolicy;
5757
private final Optional<Set<String>> clientTags;
58+
private final Optional<String> traceToken;
5859

5960
public TrimmedBasicQueryInfo(BasicQueryInfo queryInfo)
6061
{
@@ -82,6 +83,7 @@ public TrimmedBasicQueryInfo(BasicQueryInfo queryInfo)
8283
this.queryType = requireNonNull(queryInfo.getQueryType(), "queryType is null");
8384
this.retryPolicy = requireNonNull(queryInfo.getRetryPolicy(), "retryPolicy is null");
8485
this.clientTags = Optional.ofNullable(queryInfo.getSession().getClientTags());
86+
this.traceToken = requireNonNull(queryInfo.getSession().getTraceToken(), "traceToken is null");
8587
}
8688

8789
@JsonProperty
@@ -192,6 +194,12 @@ public Optional<Set<String>> getClientTags()
192194
return clientTags;
193195
}
194196

197+
@JsonProperty
198+
public Optional<String> getTraceToken()
199+
{
200+
return traceToken;
201+
}
202+
195203
@Override
196204
public String toString()
197205
{

core/trino-web-ui/src/main/resources/webapp-preview/src/api/webapp/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ export interface QueryInfo extends QueryInfoBase {
175175
sessionSource: string
176176
sessionUser: string
177177
queryDataEncoding: string
178+
traceToken: string
178179
}
179180

180181
export interface Session {

core/trino-web-ui/src/main/resources/webapp-preview/src/components/QueryList.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ export const QueryList = () => {
171171
query.resourceGroupId?.join('.'),
172172
query.errorCode?.name,
173173
...(query.clientTags || []),
174+
query.traceToken,
174175
].some((value) => value?.toLowerCase().includes(term))
175176
})
176177
}

core/trino-web-ui/src/main/resources/webapp-preview/src/constant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const Texts = {
6868
Filter: {
6969
Search: 'Search',
7070
SearchPlaceholder:
71-
'User, source, query ID, query state, resource group, error name, query text or client tags',
71+
'User, source, query ID, state, resource group, error name, query text, client tags or trace token',
7272
State: 'State',
7373
Type: {
7474
RUNNING: 'Running',

core/trino-web-ui/src/main/resources/webapp/src/components/QueryList.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,10 @@ export class QueryList extends React.Component {
477477
) {
478478
return true
479479
}
480+
481+
if (query.traceToken && query.traceToken.toLowerCase().indexOf(term) !== -1) {
482+
return true
483+
}
480484
}, this)
481485
}
482486
}
@@ -817,7 +821,7 @@ export class QueryList extends React.Component {
817821
<input
818822
type="text"
819823
className="form-control form-control-small search-bar"
820-
placeholder="User, source, query ID, query state, resource group, error name, query text or client tags"
824+
placeholder="User, source, query ID, state, resource group, error name, query text, client tags or trace token"
821825
onChange={this.handleSearchStringChange}
822826
value={this.state.searchString}
823827
/>

0 commit comments

Comments
 (0)