Skip to content

Commit e32508c

Browse files
authored
add periodic statistics (#15884)
1 parent 7ab3c04 commit e32508c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ydb/core/viewer/viewer_query.h

+11
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class TJsonQuery : public TViewerPipeClient {
2929
int LimitRows = 10000;
3030
int TotalRows = 0;
3131
bool CollectDiagnostics = true;
32+
TDuration StatsPeriod;
3233
TDuration KeepAlive = TDuration::MilliSeconds(10000);
3334
TInstant LastSendTime;
3435
static constexpr TDuration WakeupPeriod = TDuration::Seconds(1);
@@ -116,6 +117,9 @@ class TJsonQuery : public TViewerPipeClient {
116117
OutputChunkMaxSize = FromStringWithDefault<ui64>(params.Get("output_chunk_max_size"), OutputChunkMaxSize);
117118
}
118119
CollectDiagnostics = FromStringWithDefault<bool>(params.Get("collect_diagnostics"), CollectDiagnostics);
120+
if (params.Has("stats_period")) {
121+
StatsPeriod = TDuration::MilliSeconds(std::clamp<ui64>(FromStringWithDefault<ui64>(params.Get("stats_period"), StatsPeriod.MilliSeconds()), 1000, 600000));
122+
}
119123
}
120124

121125
TJsonQuery(IViewer* viewer, NHttp::TEvHttpProxy::TEvHttpIncomingRequest::TPtr& ev)
@@ -383,6 +387,9 @@ class TJsonQuery : public TViewerPipeClient {
383387
request.SetOutputChunkMaxSize(OutputChunkMaxSize);
384388
}
385389
request.SetCollectDiagnostics(CollectDiagnostics);
390+
if (StatsPeriod) {
391+
event->SetProgressStatsPeriod(StatsPeriod);
392+
}
386393
ActorIdToProto(SelfId(), event->Record.MutableRequestActorId());
387394
QueryResponse = MakeRequest<NKqp::TEvKqp::TEvQueryResponse>(NKqp::MakeKqpProxyID(SelfId().NodeId()), event.Release());
388395

@@ -1051,6 +1058,10 @@ class TJsonQuery : public TViewerPipeClient {
10511058
description: collect query diagnostics
10521059
type: boolean
10531060
default: true
1061+
- name: stats_period
1062+
in: query
1063+
description: time interval for sending periodical query statistics in ms
1064+
type: integer
10541065
requestBody:
10551066
description: Executes SQL query
10561067
required: false

0 commit comments

Comments
 (0)