mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Extra shard overlay stats
This commit is contained in:
parent
8c4bc5b3f1
commit
da137fecf5
7 changed files with 62 additions and 4 deletions
|
@ -661,7 +661,12 @@ void OverlayImpl::get_stats(td::Promise<tl_object_ptr<ton_api::engine_validator_
|
|||
res->stats_.push_back(
|
||||
create_tl_object<ton_api::engine_validator_oneStat>("neighbours_cnt", PSTRING() << neighbours_.size()));
|
||||
|
||||
promise.set_value(std::move(res));
|
||||
callback_->get_stats_extra([promise = std::move(promise), res = std::move(res)](td::Result<std::string> R) mutable {
|
||||
if (R.is_ok()) {
|
||||
res->extra_ = R.move_as_ok();
|
||||
}
|
||||
promise.set_value(std::move(res));
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace overlay
|
||||
|
|
|
@ -170,6 +170,9 @@ class Overlays : public td::actor::Actor {
|
|||
td::Promise<td::Unit> promise) {
|
||||
promise.set_value(td::Unit());
|
||||
}
|
||||
virtual void get_stats_extra(td::Promise<std::string> promise) {
|
||||
promise.set_result("");
|
||||
}
|
||||
virtual ~Callback() = default;
|
||||
};
|
||||
|
||||
|
|
|
@ -656,9 +656,14 @@ engine.validator.dhtServersStatus servers:(vector engine.validator.dhtServerStat
|
|||
|
||||
engine.validator.overlayStatsNode adnl_id:int256 ip_addr:string bdcst_errors:int fec_bdcst_errors:int last_in_query:int last_out_query:int t_out_bytes:int t_in_bytes:int t_out_pckts:int t_in_pckts:int = engine.validator.OverlayStatsNode;
|
||||
|
||||
engine.validator.overlayStats overlay_id:int256 overlay_id_full:PublicKey adnl_id:int256 scope:string nodes:(vector engine.validator.overlayStatsNode) stats:(vector engine.validator.oneStat) = engine.validator.OverlayStats;
|
||||
engine.validator.overlayStats overlay_id:int256 overlay_id_full:PublicKey adnl_id:int256 scope:string nodes:(vector engine.validator.overlayStatsNode) stats:(vector engine.validator.oneStat) extra:string = engine.validator.OverlayStats;
|
||||
engine.validator.overlaysStats overlays:(vector engine.validator.overlayStats) = engine.validator.OverlaysStats;
|
||||
|
||||
engine.validator.shardOverlayStats.neighbour id:string proto_verison:int capabilities:long
|
||||
roundtrip:double unreliability:double has_state:string = engine.validator.shardOverlayStats.Neighbour;
|
||||
engine.validator.shardOverlayStats shard:string mode:string
|
||||
neighbours:(vector engine.validator.shardOverlayStats.neighbour) = engine.validator.ShardOverlayStats;
|
||||
|
||||
engine.validator.onePerfTimerStat time:int min:double avg:double max:double = engine.validator.OnePerfTimerStat;
|
||||
engine.validator.perfTimerStatsByName name:string stats:(vector engine.validator.OnePerfTimerStat) = engine.validator.PerfTimerStatsByName;
|
||||
engine.validator.perfTimerStats stats:(vector engine.validator.PerfTimerStatsByName) = engine.validator.PerfTimerStats;
|
||||
|
|
Binary file not shown.
|
@ -934,8 +934,18 @@ td::Status GetOverlaysStatsJsonQuery::receive(td::BufferSlice data) {
|
|||
|
||||
sb << " \"" << t->key_ << "\": \"" << t->value_ << "\"";
|
||||
}
|
||||
sb << "\n }\n";
|
||||
sb << "}\n";
|
||||
sb << "\n }";
|
||||
if (!s->extra_.empty()) {
|
||||
sb << ",\n \"extra\": ";
|
||||
for (char c : s->extra_) {
|
||||
if (c == '\n') {
|
||||
sb << "\n ";
|
||||
} else {
|
||||
sb << c;
|
||||
}
|
||||
}
|
||||
}
|
||||
sb << "\n}\n";
|
||||
}
|
||||
sb << "]\n";
|
||||
sb << std::flush;
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
#include "td/utils/Random.h"
|
||||
|
||||
#include "common/delay.h"
|
||||
#include "td/utils/JsonBuilder.h"
|
||||
#include "tl/tl_json.h"
|
||||
#include "auto/tl/ton_api_json.h"
|
||||
|
||||
namespace ton {
|
||||
|
||||
|
@ -99,6 +102,9 @@ void FullNodeShardImpl::create_overlay() {
|
|||
td::Promise<td::Unit> promise) override {
|
||||
td::actor::send_closure(node_, &FullNodeShardImpl::check_broadcast, src, std::move(data), std::move(promise));
|
||||
}
|
||||
void get_stats_extra(td::Promise<std::string> promise) override {
|
||||
td::actor::send_closure(node_, &FullNodeShardImpl::get_stats_extra, std::move(promise));
|
||||
}
|
||||
Callback(td::actor::ActorId<FullNodeShardImpl> node) : node_(node) {
|
||||
}
|
||||
|
||||
|
@ -1290,6 +1296,34 @@ void FullNodeShardImpl::ping_neighbours() {
|
|||
}
|
||||
}
|
||||
|
||||
void FullNodeShardImpl::get_stats_extra(td::Promise<std::string> promise) {
|
||||
auto res = create_tl_object<ton_api::engine_validator_shardOverlayStats>();
|
||||
res->shard_ = shard_.to_str();
|
||||
switch (mode_) {
|
||||
case active:
|
||||
res->mode_ = "active";
|
||||
break;
|
||||
case active_temp:
|
||||
res->mode_ = "active_temp";
|
||||
break;
|
||||
case inactive:
|
||||
res->mode_ = "inactive";
|
||||
break;
|
||||
}
|
||||
for (const auto &p : neighbours_) {
|
||||
const auto &n = p.second;
|
||||
auto f = create_tl_object<ton_api::engine_validator_shardOverlayStats_neighbour>();
|
||||
f->id_ = n.adnl_id.bits256_value().to_hex();
|
||||
f->proto_verison_ = n.proto_version;
|
||||
f->capabilities_ = n.capabilities;
|
||||
f->roundtrip_ = n.roundtrip;
|
||||
f->unreliability_ = n.unreliability;
|
||||
f->has_state_ = (n.has_state_known ? (n.has_state ? "true" : "false") : "undefined");
|
||||
res->neighbours_.push_back(std::move(f));
|
||||
}
|
||||
promise.set_result(td::json_encode<std::string>(td::ToJson(*res), true));
|
||||
}
|
||||
|
||||
FullNodeShardImpl::FullNodeShardImpl(ShardIdFull shard, PublicKeyHash local_id, adnl::AdnlNodeIdShort adnl_id,
|
||||
FileHash zero_state_file_hash, FullNodeConfig config,
|
||||
td::actor::ActorId<keyring::Keyring> keyring, td::actor::ActorId<adnl::Adnl> adnl,
|
||||
|
|
|
@ -164,6 +164,7 @@ class FullNodeShardImpl : public FullNodeShard {
|
|||
void process_broadcast(PublicKeyHash src, ton_api::tonNode_newShardBlockBroadcast &query);
|
||||
void receive_broadcast(PublicKeyHash src, td::BufferSlice query);
|
||||
void check_broadcast(PublicKeyHash src, td::BufferSlice query, td::Promise<td::Unit> promise);
|
||||
void get_stats_extra(td::Promise<std::string> promise);
|
||||
void remove_neighbour(adnl::AdnlNodeIdShort id);
|
||||
|
||||
void send_ihr_message(td::BufferSlice data) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue