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