1
1
#include " service.h"
2
2
#include " http_request.h"
3
3
4
+ #include < ydb/core/statistics/common.h>
4
5
#include < ydb/core/statistics/events.h>
5
6
#include < ydb/core/statistics/database/database.h>
6
7
@@ -103,8 +104,7 @@ struct TAggregationStatistics {
103
104
? &Nodes[i] : nullptr ;
104
105
}
105
106
}
106
- LOG_ERROR_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
107
- " Child node with the specified id was not found" );
107
+ SA_LOG_E (" Child node with the specified id was not found" );
108
108
return nullptr ;
109
109
}
110
110
};
@@ -211,15 +211,13 @@ class TStatService : public TActorBootstrapped<TStatService> {
211
211
hFunc (NMon::TEvHttpInfoRes, Handle);
212
212
cFunc (TEvents::TEvPoison::EventType, PassAway);
213
213
default :
214
- LOG_CRIT_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
215
- " NStat::TStatService: unexpected event# " << ev->GetTypeRewrite () << " " << ev->ToString ());
214
+ SA_LOG_CRIT (" NStat::TStatService: unexpected event# " << ev->GetTypeRewrite () << " " << ev->ToString ());
216
215
}
217
216
}
218
217
219
218
private:
220
219
void HandleConfig (NConsole::TEvConfigsDispatcher::TEvSetConfigSubscriptionResponse::TPtr&) {
221
- LOG_INFO_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
222
- " Subscribed for config changes on node " << SelfId ().NodeId ());
220
+ SA_LOG_I (" Subscribed for config changes on node " << SelfId ().NodeId ());
223
221
}
224
222
225
223
void HandleConfig (NConsole::TEvConsole::TEvConfigNotificationRequest::TPtr& ev) {
@@ -239,8 +237,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
239
237
240
238
bool IsNotCurrentRound (ui64 round) {
241
239
if (round != AggregationStatistics.Round ) {
242
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
243
- " Event round " << round << " is different from the current " << AggregationStatistics.Round );
240
+ SA_LOG_D (" Event round " << round << " is different from the current " << AggregationStatistics.Round );
244
241
return true ;
245
242
}
246
243
return false ;
@@ -305,8 +302,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
305
302
const auto & record = ev->Get ()->Record ;
306
303
const auto tabletId = record.GetShardTabletId ();
307
304
308
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
309
- " Received TEvStatisticsResponse TabletId: " << tabletId);
305
+ SA_LOG_D (" Received TEvStatisticsResponse TabletId: " << tabletId);
310
306
311
307
const auto round = ev->Cookie ;
312
308
if (IsNotCurrentRound (round)) {
@@ -334,8 +330,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
334
330
const auto round = record.GetRound ();
335
331
336
332
if (IsNotCurrentRound (round)) {
337
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
338
- " Skip TEvAggregateKeepAliveAck" );
333
+ SA_LOG_D (" Skip TEvAggregateKeepAliveAck" );
339
334
return ;
340
335
}
341
336
@@ -345,8 +340,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
345
340
void Handle (TEvPrivate::TEvKeepAliveAckTimeout::TPtr& ev) {
346
341
const auto round = ev->Get ()->Round ;
347
342
if (IsNotCurrentRound (round)) {
348
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
349
- " Skip TEvKeepAliveAckTimeout" );
343
+ SA_LOG_D (" Skip TEvKeepAliveAckTimeout" );
350
344
return ;
351
345
}
352
346
@@ -361,8 +355,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
361
355
362
356
// the parent node is unavailable
363
357
// invalidate the subtree with the root in the current node
364
- LOG_INFO_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
365
- " Parent node " << AggregationStatistics.ParentNode .NodeId () << " is unavailable" );
358
+ SA_LOG_I (" Parent node " << AggregationStatistics.ParentNode .NodeId () << " is unavailable" );
366
359
367
360
368
361
ResetAggregationStatistics ();
@@ -371,8 +364,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
371
364
void Handle (TEvPrivate::TEvDispatchKeepAlive::TPtr& ev) {
372
365
const auto round = ev->Get ()->Round ;
373
366
if (IsNotCurrentRound (round)) {
374
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
375
- " Skip TEvDispatchKeepAlive" );
367
+ SA_LOG_D (" Skip TEvDispatchKeepAlive" );
376
368
return ;
377
369
}
378
370
@@ -386,17 +378,15 @@ class TStatService : public TActorBootstrapped<TStatService> {
386
378
const auto round = ev->Get ()->Round ;
387
379
388
380
if (IsNotCurrentRound (round)) {
389
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
390
- " Skip TEvKeepAliveTimeout" );
381
+ SA_LOG_D (" Skip TEvKeepAliveTimeout" );
391
382
return ;
392
383
}
393
384
394
385
const auto nodeId = ev->Get ()->NodeId ;
395
386
auto node = AggregationStatistics.GetProcessingChildNode (nodeId);
396
387
397
388
if (node == nullptr ) {
398
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
399
- " Skip TEvKeepAliveTimeout" );
389
+ SA_LOG_D (" Skip TEvKeepAliveTimeout" );
400
390
return ;
401
391
}
402
392
@@ -411,8 +401,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
411
401
412
402
node->Status = TAggregationStatistics::TNode::EStatus::Unavailable;
413
403
++AggregationStatistics.PprocessedNodes ;
414
- LOG_INFO_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
415
- " Node " << nodeId << " is unavailable" );
404
+ SA_LOG_I (" Node " << nodeId << " is unavailable" );
416
405
417
406
if (AggregationStatistics.IsCompleted ()) {
418
407
OnAggregateStatisticsFinished ();
@@ -424,17 +413,15 @@ class TStatService : public TActorBootstrapped<TStatService> {
424
413
const auto round = record.GetRound ();
425
414
426
415
if (IsNotCurrentRound (round)) {
427
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
428
- " Skip TEvAggregateKeepAlive" );
416
+ SA_LOG_D (" Skip TEvAggregateKeepAlive" );
429
417
return ;
430
418
}
431
419
432
420
const auto nodeId = ev->Sender .NodeId ();
433
421
auto node = AggregationStatistics.GetProcessingChildNode (nodeId);
434
422
435
423
if (node == nullptr ) {
436
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
437
- " Skip TEvAggregateKeepAlive" );
424
+ SA_LOG_D ( " Skip TEvAggregateKeepAlive" );
438
425
return ;
439
426
}
440
427
@@ -446,24 +433,21 @@ class TStatService : public TActorBootstrapped<TStatService> {
446
433
}
447
434
448
435
void Handle (TEvStatistics::TEvAggregateStatisticsResponse::TPtr& ev) {
449
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
450
- " Received TEvAggregateStatisticsResponse SenderNodeId: " << ev->Sender .NodeId ());
436
+ SA_LOG_D (" Received TEvAggregateStatisticsResponse SenderNodeId: " << ev->Sender .NodeId ());
451
437
452
438
const auto & record = ev->Get ()->Record ;
453
439
const auto round = record.GetRound ();
454
440
455
441
if (IsNotCurrentRound (round)) {
456
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
457
- " Skip TEvAggregateStatisticsResponse" );
442
+ SA_LOG_D (" Skip TEvAggregateStatisticsResponse" );
458
443
return ;
459
444
}
460
445
461
446
const auto nodeId = ev->Sender .NodeId ();
462
447
auto node = AggregationStatistics.GetProcessingChildNode (nodeId);
463
448
464
449
if (node == nullptr ) {
465
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
466
- " Skip TEvAggregateStatisticsResponse" );
450
+ SA_LOG_D (" Skip TEvAggregateStatisticsResponse" );
467
451
return ;
468
452
}
469
453
@@ -503,8 +487,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
503
487
}
504
488
505
489
void SendAggregateStatisticsResponse () {
506
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
507
- " Send aggregate statistics response to node: " << AggregationStatistics.ParentNode .NodeId ());
490
+ SA_LOG_D (" Send aggregate statistics response to node: " << AggregationStatistics.ParentNode .NodeId ());
508
491
509
492
auto response = std::make_unique<TEvStatistics::TEvAggregateStatisticsResponse>();
510
493
auto & record = response->Record ;
@@ -589,8 +572,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
589
572
const auto & record = ev->Get ()->Record ;
590
573
const auto round = record.GetRound ();
591
574
592
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
593
- " Received TEvAggregateStatistics from node: " << ev->Sender .NodeId ()
575
+ SA_LOG_D (" Received TEvAggregateStatistics from node: " << ev->Sender .NodeId ()
594
576
<< " , Round: " << round << " , current Round: " << AggregationStatistics.Round );
595
577
596
578
// reset previous state
@@ -669,8 +651,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
669
651
return ;
670
652
}
671
653
672
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
673
- " Handle TEvStatistics::TEvGetStatistics, request id = " << requestId
654
+ SA_LOG_D (" Handle TEvStatistics::TEvGetStatistics, request id = " << requestId
674
655
<< " , ReplyToActorId = " << request.ReplyToActorId
675
656
<< " , StatRequests.size() = " << request.StatRequests .size ());
676
657
@@ -714,8 +695,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
714
695
715
696
auto cookie = navigate->Cookie ;
716
697
717
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
718
- " Handle TEvTxProxySchemeCache::TEvNavigateKeySetResult, request id = " << cookie);
698
+ SA_LOG_D (" Handle TEvTxProxySchemeCache::TEvNavigateKeySetResult, request id = " << cookie);
719
699
720
700
if (cookie == ResolveSACookie) {
721
701
Y_ABORT_UNLESS (navigate->ResultSet .size () == 1 );
@@ -731,7 +711,14 @@ class TStatService : public TActorBootstrapped<TStatService> {
731
711
ConnectToSA ();
732
712
SyncNode ();
733
713
} else {
734
- ReplyAllFailed ();
714
+ for (auto it = InFlight.begin (); it != InFlight.end ();) {
715
+ if (EStatType::COUNT_MIN_SKETCH == it->second .StatType ) {
716
+ ++it;
717
+ continue ;
718
+ }
719
+ ReplyFailed (it->first , false );
720
+ it = InFlight.erase (it);
721
+ }
735
722
}
736
723
return ;
737
724
}
@@ -837,8 +824,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
837
824
}
838
825
839
826
void Handle (TEvStatistics::TEvPropagateStatistics::TPtr& ev) {
840
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
841
- " EvPropagateStatistics, node id = " << SelfId ().NodeId ());
827
+ SA_LOG_D (" EvPropagateStatistics, node id = " << SelfId ().NodeId ());
842
828
843
829
Send (ev->Sender , new TEvStatistics::TEvPropagateStatisticsResponse);
844
830
@@ -922,21 +908,18 @@ class TStatService : public TActorBootstrapped<TStatService> {
922
908
void Handle (TEvPrivate::TEvStatisticsRequestTimeout::TPtr& ev) {
923
909
const auto round = ev->Get ()->Round ;
924
910
if (IsNotCurrentRound (round)) {
925
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
926
- " Skip TEvStatisticsRequestTimeout" );
911
+ SA_LOG_D (" Skip TEvStatisticsRequestTimeout" );
927
912
return ;
928
913
}
929
914
930
915
const auto tabletId = ev->Get ()->TabletId ;
931
916
auto tabletPipe = AggregationStatistics.LocalTablets .TabletsPipes .find (tabletId);
932
917
if (tabletPipe == AggregationStatistics.LocalTablets .TabletsPipes .end ()) {
933
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
934
- " Tablet " << tabletId << " has already been processed" );
918
+ SA_LOG_D (" Tablet " << tabletId << " has already been processed" );
935
919
return ;
936
920
}
937
921
938
- LOG_ERROR_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
939
- " No result was received from the tablet " << tabletId);
922
+ SA_LOG_E (" No result was received from the tablet " << tabletId);
940
923
941
924
auto clientId = tabletPipe->second ;
942
925
OnTabletError (tabletId);
@@ -961,15 +944,13 @@ class TStatService : public TActorBootstrapped<TStatService> {
961
944
NTabletPipe::SendData (SelfId (), clientId, request.release (), round);
962
945
Schedule (Settings.StatisticsRequestTimeout , new TEvPrivate::TEvStatisticsRequestTimeout (round, tabletId));
963
946
964
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
965
- " TEvStatisticsRequest send"
947
+ SA_LOG_D (" TEvStatisticsRequest send"
966
948
<< " , client id = " << clientId
967
949
<< " , path = " << *path);
968
950
}
969
951
970
952
void OnTabletError (ui64 tabletId) {
971
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
972
- " Tablet " << tabletId << " is not local." );
953
+ SA_LOG_D (" Tablet " << tabletId << " is not local." );
973
954
974
955
const auto error = NKikimrStat::TEvAggregateStatisticsResponse::TYPE_NON_LOCAL_TABLET;
975
956
AggregationStatistics.FailedTablets .emplace_back (tabletId, 0 , error);
@@ -987,8 +968,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
987
968
const auto & clientId = ev->Get ()->ClientId ;
988
969
const auto & tabletId = ev->Get ()->TabletId ;
989
970
990
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
991
- " EvClientConnected"
971
+ SA_LOG_D (" EvClientConnected"
992
972
<< " , node id = " << ev->Get ()->ClientId .NodeId ()
993
973
<< " , client id = " << clientId
994
974
<< " , server id = " << ev->Get ()->ServerId
@@ -1017,16 +997,14 @@ class TStatService : public TActorBootstrapped<TStatService> {
1017
997
return ;
1018
998
}
1019
999
1020
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
1021
- " Skip EvClientConnected" );
1000
+ SA_LOG_D (" Skip EvClientConnected" );
1022
1001
}
1023
1002
1024
1003
void Handle (TEvTabletPipe::TEvClientDestroyed::TPtr& ev) {
1025
1004
const auto & clientId = ev->Get ()->ClientId ;
1026
1005
const auto & tabletId = ev->Get ()->TabletId ;
1027
1006
1028
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
1029
- " EvClientDestroyed"
1007
+ SA_LOG_D (" EvClientDestroyed"
1030
1008
<< " , node id = " << ev->Get ()->ClientId .NodeId ()
1031
1009
<< " , client id = " << clientId
1032
1010
<< " , server id = " << ev->Get ()->ServerId
@@ -1048,8 +1026,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
1048
1026
return ;
1049
1027
}
1050
1028
1051
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
1052
- " Skip EvClientDestroyed" );
1029
+ SA_LOG_D (" Skip EvClientDestroyed" );
1053
1030
}
1054
1031
1055
1032
void Handle (TEvStatistics::TEvStatisticsIsDisabled::TPtr&) {
@@ -1059,13 +1036,19 @@ class TStatService : public TActorBootstrapped<TStatService> {
1059
1036
1060
1037
void Handle (TEvStatistics::TEvLoadStatisticsQueryResponse::TPtr& ev) {
1061
1038
ui64 cookie = ev->Get ()->Cookie ;
1062
-
1063
1039
auto itLoadQuery = LoadQueriesInFlight.find (cookie);
1064
1040
Y_ABORT_UNLESS (itLoadQuery != LoadQueriesInFlight.end ());
1065
1041
auto [requestId, requestIndex] = itLoadQuery->second ;
1066
1042
1043
+ SA_LOG_D (" TEvLoadStatisticsQueryResponse, request id = " << requestId);
1044
+
1067
1045
auto itRequest = InFlight.find (requestId);
1068
- Y_ABORT_UNLESS (itRequest != InFlight.end ());
1046
+ if (InFlight.end () == itRequest) {
1047
+ SA_LOG_E (" TEvLoadStatisticsQueryResponse, request id = " << requestId
1048
+ << " . Request not found in InFlight" );
1049
+ return ;
1050
+ }
1051
+
1069
1052
auto & request = itRequest->second ;
1070
1053
1071
1054
auto & response = request.StatResponses [requestIndex];
@@ -1092,8 +1075,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
1092
1075
}
1093
1076
1094
1077
void Handle (TEvPrivate::TEvRequestTimeout::TPtr& ev) {
1095
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
1096
- " EvRequestTimeout"
1078
+ SA_LOG_D (" EvRequestTimeout"
1097
1079
<< " , pipe client id = " << ev->Get ()->PipeClientId
1098
1080
<< " , schemeshard count = " << ev->Get ()->NeedSchemeShards .size ());
1099
1081
@@ -1125,8 +1107,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
1125
1107
NTabletPipe::TClientConfig pipeConfig{policy};
1126
1108
SAPipeClientId = Register (NTabletPipe::CreateClient (SelfId (), StatisticsAggregatorId, pipeConfig));
1127
1109
1128
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
1129
- " ConnectToSA(), pipe client id = " << SAPipeClientId);
1110
+ SA_LOG_D (" ConnectToSA(), pipe client id = " << SAPipeClientId);
1130
1111
}
1131
1112
1132
1113
void SyncNode () {
@@ -1155,8 +1136,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
1155
1136
Schedule (RequestTimeout, timeout.release ());
1156
1137
}
1157
1138
1158
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
1159
- " SyncNode(), pipe client id = " << SAPipeClientId);
1139
+ SA_LOG_D (" SyncNode(), pipe client id = " << SAPipeClientId);
1160
1140
}
1161
1141
1162
1142
void ReplySuccess (ui64 requestId, bool eraseRequest) {
@@ -1166,8 +1146,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
1166
1146
}
1167
1147
auto & request = itRequest->second ;
1168
1148
1169
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
1170
- " ReplySuccess(), request id = " << requestId
1149
+ SA_LOG_D (" ReplySuccess(), request id = " << requestId
1171
1150
<< " , ReplyToActorId = " << request.ReplyToActorId
1172
1151
<< " , StatRequests.size() = " << request.StatRequests .size ());
1173
1152
@@ -1213,8 +1192,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
1213
1192
}
1214
1193
auto & request = itRequest->second ;
1215
1194
1216
- LOG_DEBUG_S (TlsActivationContext->AsActorContext (), NKikimrServices::STATISTICS,
1217
- " ReplyFailed(), request id = " << requestId);
1195
+ SA_LOG_D (" ReplyFailed(), request id = " << requestId);
1218
1196
1219
1197
auto result = std::make_unique<TEvStatistics::TEvGetStatisticsResult>();
1220
1198
result->Success = false ;
0 commit comments