@@ -117,16 +117,16 @@ struct TQueryStatKeyHash {
117
117
};
118
118
119
119
struct TAggQueryStat {
120
- NYql::TCounters::TEntry FilteredReadBytes ;
121
- NYql::TCounters::TEntry UnreadBytes ;
122
- NYql::TCounters::TEntry UnreadRows ;
120
+ NYql::TCounters::TEntry FilteredBytes ;
121
+ NYql::TCounters::TEntry QueuedBytes ;
122
+ NYql::TCounters::TEntry QueuedRows ;
123
123
NYql::TCounters::TEntry ReadLagMessages;
124
124
bool IsWaiting = false ;
125
125
126
126
void Add (const TTopicSessionClientStatistic& stat) {
127
- FilteredReadBytes .Add (NYql::TCounters::TEntry (stat.FilteredReadBytes ));
128
- UnreadBytes .Add (NYql::TCounters::TEntry (stat.UnreadBytes ));
129
- UnreadRows .Add (NYql::TCounters::TEntry (stat.UnreadRows ));
127
+ FilteredBytes .Add (NYql::TCounters::TEntry (stat.FilteredBytes ));
128
+ QueuedBytes .Add (NYql::TCounters::TEntry (stat.QueuedBytes ));
129
+ QueuedRows .Add (NYql::TCounters::TEntry (stat.QueuedRows ));
130
130
ReadLagMessages.Add (NYql::TCounters::TEntry (stat.ReadLagMessages ));
131
131
IsWaiting = IsWaiting || stat.IsWaiting ;
132
132
}
@@ -410,7 +410,7 @@ class TRowDispatcher : public TActorBootstrapped<TRowDispatcher> {
410
410
void UpdateReadActorsInternalState ();
411
411
template <class TEventPtr >
412
412
bool CheckSession (TAtomicSharedPtr<TConsumerInfo>& consumer, const TEventPtr& ev);
413
- void SetQueryMetrics (const TQueryStatKey& queryKey, ui64 unreadBytesMax , ui64 unreadBytesAvg , i64 readLagMessagesMax);
413
+ void SetQueryMetrics (const TQueryStatKey& queryKey, ui64 queuedBytesMax , ui64 queuedBytesAvg , i64 readLagMessagesMax);
414
414
void PrintStateToLog ();
415
415
void UpdateCpuTime ();
416
416
@@ -611,7 +611,7 @@ void TRowDispatcher::UpdateMetrics() {
611
611
toDelete.insert (key);
612
612
continue ;
613
613
}
614
- SetQueryMetrics (key, stats->UnreadBytes .Max , stats->UnreadBytes .Avg , stats->ReadLagMessages .Max );
614
+ SetQueryMetrics (key, stats->QueuedBytes .Max , stats->QueuedBytes .Avg , stats->ReadLagMessages .Max );
615
615
}
616
616
for (const auto & key : toDelete) {
617
617
SetQueryMetrics (key, 0 , 0 , 0 );
@@ -621,11 +621,11 @@ void TRowDispatcher::UpdateMetrics() {
621
621
PrintStateToLog ();
622
622
}
623
623
624
- void TRowDispatcher::SetQueryMetrics (const TQueryStatKey& queryKey, ui64 unreadBytesMax , ui64 unreadBytesAvg , i64 readLagMessagesMax) {
624
+ void TRowDispatcher::SetQueryMetrics (const TQueryStatKey& queryKey, ui64 queuedBytesMax , ui64 queuedBytesAvg , i64 readLagMessagesMax) {
625
625
auto queryGroup = Metrics.Counters ->GetSubgroup (" query_id" , queryKey.QueryId );
626
626
auto topicGroup = queryGroup->GetSubgroup (" read_group" , SanitizeLabel (queryKey.ReadGroup ));
627
- topicGroup->GetCounter (" MaxUnreadBytes " )->Set (unreadBytesMax );
628
- topicGroup->GetCounter (" AvgUnreadBytes " )->Set (unreadBytesAvg );
627
+ topicGroup->GetCounter (" MaxQueuedBytes " )->Set (queuedBytesMax );
628
+ topicGroup->GetCounter (" AvgQueuedBytes " )->Set (queuedBytesAvg );
629
629
topicGroup->GetCounter (" MaxReadLag" )->Set (readLagMessagesMax);
630
630
}
631
631
@@ -663,11 +663,11 @@ TString TRowDispatcher::GetInternalState() {
663
663
664
664
THashMap<TQueryStatKey, TAggQueryStat, TQueryStatKeyHash> queryState;
665
665
THashMap<TQueryStatKey, ui64, TQueryStatKeyHash> sessionCountByQuery;
666
- ui64 unreadBytesSum = 0 ;
666
+ ui64 queuedBytesSum = 0 ;
667
667
668
668
for (auto & [sessionKey, sessionsInfo] : TopicSessions) {
669
669
for (auto & [actorId, sessionInfo] : sessionsInfo.Sessions ) {
670
- unreadBytesSum += sessionInfo.Stat .UnreadBytes ;
670
+ queuedBytesSum += sessionInfo.Stat .QueuedBytes ;
671
671
for (auto & [readActorId, consumer] : sessionInfo.Consumers ) {
672
672
auto key = TQueryStatKey{consumer->QueryId , sessionKey.ReadGroup };
673
673
++sessionCountByQuery[key];
@@ -677,18 +677,18 @@ TString TRowDispatcher::GetInternalState() {
677
677
}
678
678
679
679
if (TopicSessions.size ()) {
680
- str << " Buffer used: " << Prec (unreadBytesSum * 100.0 / (TopicSessions.size () * MaxSessionBufferSizeBytes), 4 ) << " % (" << toHuman (unreadBytesSum ) << " )\n " ;
680
+ str << " Buffer used: " << Prec (queuedBytesSum * 100.0 / (TopicSessions.size () * MaxSessionBufferSizeBytes), 4 ) << " % (" << toHuman (queuedBytesSum ) << " )\n " ;
681
681
}
682
682
683
683
str << " Queries:\n " ;
684
684
for (const auto & [queryStatKey, stat]: queryState) {
685
685
auto [queryId, readGroup] = queryStatKey;
686
686
const auto & aggStat = AggrStats.LastQueryStats [queryStatKey];
687
687
auto sessionsBufferSumSize = sessionCountByQuery[queryStatKey] * MaxSessionBufferSizeBytes;
688
- auto used = sessionsBufferSumSize ? (stat.UnreadBytes .Sum * 100.0 / sessionsBufferSumSize) : 0.0 ;
689
- str << " " << queryId << " / " << readGroup << " : buffer used (all partitions) " << LeftPad (Prec (used, 4 ), 10 ) << " % (" << toHuman (stat.UnreadBytes .Sum ) << " ) unread max (one partition) " << toHuman (stat.UnreadBytes .Max ) << " data rate" ;
688
+ auto used = sessionsBufferSumSize ? (stat.QueuedBytes .Sum * 100.0 / sessionsBufferSumSize) : 0.0 ;
689
+ str << " " << queryId << " / " << readGroup << " : buffer used (all partitions) " << LeftPad (Prec (used, 4 ), 10 ) << " % (" << toHuman (stat.QueuedBytes .Sum ) << " ) unread max (one partition) " << toHuman (stat.QueuedBytes .Max ) << " data rate" ;
690
690
if (aggStat) {
691
- printDataRate (aggStat->FilteredReadBytes );
691
+ printDataRate (aggStat->FilteredBytes );
692
692
}
693
693
str << " waiting " << stat.IsWaiting << " max read lag " << stat.ReadLagMessages .Max ;
694
694
str << " \n " ;
@@ -698,7 +698,7 @@ TString TRowDispatcher::GetInternalState() {
698
698
str << " " << key.TopicPath << " / " << key.PartitionId << " / " << key.ReadGroup ;
699
699
for (auto & [actorId, sessionInfo] : sessionsInfo.Sessions ) {
700
700
str << " / " << LeftPad (actorId, 32 )
701
- << " data rate " << toHumanDR (sessionInfo.AggrReadBytes .Sum ) << " unread bytes " << toHuman (sessionInfo.Stat .UnreadBytes )
701
+ << " data rate " << toHumanDR (sessionInfo.AggrReadBytes .Sum ) << " unread bytes " << toHuman (sessionInfo.Stat .QueuedBytes )
702
702
<< " offset " << LeftPad (sessionInfo.Stat .LastReadedOffset , 12 ) << " restarts by offsets " << sessionInfo.Stat .RestartSessionByOffsets << " \n " ;
703
703
ui64 maxInitialOffset = 0 ;
704
704
ui64 minInitialOffset = std::numeric_limits<ui64>::max ();
@@ -712,7 +712,7 @@ TString TRowDispatcher::GetInternalState() {
712
712
for (auto & [readActorId, consumer] : sessionInfo.Consumers ) {
713
713
const auto & partition = consumer->Partitions [key.PartitionId ];
714
714
str << " " << consumer->QueryId << " " << LeftPad (readActorId, 32 ) << " unread bytes "
715
- << toHuman (consumer->Stat .UnreadBytes ) << " (" << leftPad (consumer->Stat .UnreadRows ) << " rows) "
715
+ << toHuman (consumer->Stat .QueuedBytes ) << " (" << leftPad (consumer->Stat .QueuedRows ) << " rows) "
716
716
<< " offset " << leftPad (consumer->Stat .Offset ) << " init offset " << leftPad (consumer->Stat .InitialOffset )
717
717
<< " get " << leftPad (consumer->Counters .GetNextBatch )
718
718
<< " arr " << leftPad (consumer->Counters .NewDataArrived ) << " btc " << leftPad (consumer->Counters .MessageBatch )
@@ -1054,6 +1054,10 @@ void TRowDispatcher::Handle(NFq::TEvPrivate::TEvSendStatistic::TPtr&) {
1054
1054
}
1055
1055
auto event = std::make_unique<TEvRowDispatcher::TEvStatistics>();
1056
1056
ui64 readBytes = 0 ;
1057
+ ui64 filteredBytes = 0 ;
1058
+ ui64 filteredRows = 0 ;
1059
+ ui64 queuedBytes = 0 ;
1060
+ ui64 queuedRows = 0 ;
1057
1061
for (auto & [partitionId, partition] : consumer->Partitions ) {
1058
1062
if (!partition.StatisticsUpdated ) {
1059
1063
continue ;
@@ -1062,12 +1066,20 @@ void TRowDispatcher::Handle(NFq::TEvPrivate::TEvSendStatistic::TPtr&) {
1062
1066
partitionsProto->SetPartitionId (partitionId);
1063
1067
partitionsProto->SetNextMessageOffset (partition.Stat .Offset );
1064
1068
readBytes += partition.Stat .ReadBytes ;
1069
+ filteredBytes += partition.Stat .FilteredBytes ;
1070
+ filteredRows += partition.Stat .FilteredRows ;
1071
+ queuedBytes += partition.Stat .QueuedBytes ;
1072
+ queuedRows += partition.Stat .QueuedRows ;
1065
1073
partition.Stat .Clear ();
1066
1074
partition.StatisticsUpdated = false ;
1067
1075
}
1068
1076
event->Record .SetReadBytes (readBytes);
1069
1077
event->Record .SetCpuMicrosec (consumer->CpuMicrosec );
1070
1078
consumer->CpuMicrosec = 0 ;
1079
+ event->Record .SetFilteredBytes (filteredBytes);
1080
+ event->Record .SetFilteredRows (filteredRows);
1081
+ event->Record .SetQueuedBytes (queuedBytes);
1082
+ event->Record .SetQueuedRows (queuedRows);
1071
1083
LWPROBE (Statistics, consumer->ReadActorId .ToString (), consumer->QueryId , consumer->Generation , event->Record .ByteSizeLong ());
1072
1084
consumer->EventsQueue .Send (event.release (), consumer->Generation );
1073
1085
}
@@ -1102,7 +1114,7 @@ void TRowDispatcher::Handle(NFq::TEvRowDispatcher::TEvSessionStatistic::TPtr& ev
1102
1114
key.TopicPath ,
1103
1115
key.PartitionId ,
1104
1116
stat.Common .ReadBytes ,
1105
- stat.Common .UnreadBytes ,
1117
+ stat.Common .QueuedBytes ,
1106
1118
stat.Common .RestartSessionByOffsets ,
1107
1119
stat.Common .ReadEvents ,
1108
1120
stat.Common .LastReadedOffset );
0 commit comments