@@ -371,27 +371,37 @@ class TClusterStateRPC : public TRpcRequestActor<TClusterStateRPC, TEvClusterSta
371371 }
372372 }
373373
374- void ReplyAndPassAway () {
375- CloseSession ();
376- TResponse response;
377- Ydb::Operations::Operation& operation = *response.mutable_operation ();
378- operation.set_ready (true );
379- operation.set_status (Ydb::StatusIds::SUCCESS);
374+ void AddBlock (Ydb::Monitoring::ClusterStateResult& result, const TString& name, const auto & obj) {
380375 google::protobuf::util::JsonPrintOptions jsonOpts;
381376 jsonOpts.add_whitespace = true ;
382377 TString data;
383- google::protobuf::util::MessageToJsonString (State, &data, jsonOpts);
384- Ydb::Monitoring::ClusterStateResult result;
378+ google::protobuf::util::MessageToJsonString (obj, &data, jsonOpts);
385379 auto * block = result.Addblocks ();
386- block->Setname (" cluster_state.json " );
380+ block->Setname (name );
387381 block->Setcontent (data);
388382 block->Mutabletimestamp ()->set_seconds (TInstant::Now ().Seconds ());
383+ }
389384
385+ void ReplyAndPassAway () {
386+ CloseSession ();
387+ TResponse response;
388+ Ydb::Operations::Operation& operation = *response.mutable_operation ();
389+ operation.set_ready (true );
390+ operation.set_status (Ydb::StatusIds::SUCCESS);
391+
392+ Ydb::Monitoring::ClusterStateResult result;
393+ AddBlock (result, " cluster_state.json" , State);
394+ NKikimrClusterStateInfoProto::TClusterStateInfoParameters params;
395+ params.SetStartedAt (Started.ToStringUpToSeconds ());
396+ params.SetDurationSeconds (Duration.Seconds ());
397+ params.SetPeriodSeconds (Period.Seconds ());
398+ AddBlock (result, " cluster_state_fetch_parameters.json" , params);
390399 for (ui32 node : xrange (Counters.size ())) {
391400 for (ui32 i : xrange (Counters[node].size ())) {
392401 auto * counterBlock = result.Addblocks ();
393402 TStringBuilder sb;
394- sb << " node_" << node << " _counters_" << i << " .json" ;
403+ auto nodeId = Nodes[node].NodeId ;
404+ sb << " node_" << nodeId << " _counters_" << i << " .json" ;
395405 counterBlock->Setname (sb);
396406 counterBlock->Setcontent (Counters[node][i].first );
397407 counterBlock->Mutabletimestamp ()->set_seconds (Counters[node][i].second .Seconds ());
0 commit comments