1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

Enhance overlay stats output (#386)

* Expand overlay stats

* Add scope and peer broadcast errors to stats

* Add json output format
Co-authored-by: EmelyanenkoK <emelyanenko.kirill@gmail.com>
This commit is contained in:
Tsenilov Oleg 2022-06-07 16:24:26 +03:00 committed by GitHub
parent fea912e05c
commit e30049930a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 396 additions and 38 deletions

View file

@ -918,11 +918,51 @@ class GetOverlaysStatsQuery : public Query {
static std::string get_help() {
return "getoverlaysstats\tgets stats for all overlays";
}
static std::string time_to_human(int unixtime) {
char time_buffer[80];
time_t rawtime = unixtime;
struct tm tInfo;
struct tm* timeinfo = localtime_r(&rawtime, &tInfo);
assert(timeinfo == &tInfo);
strftime(time_buffer, 80, "%c", timeinfo);
return std::string(time_buffer);
}
std::string name() const override {
return get_name();
}
};
class GetOverlaysStatsJsonQuery : public Query {
public:
GetOverlaysStatsJsonQuery(td::actor::ActorId<ValidatorEngineConsole> console, Tokenizer tokenizer)
: Query(console, std::move(tokenizer)) {
}
td::Status run() override;
td::Status send() override;
td::Status receive(td::BufferSlice data) override;
static std::string get_name() {
return "getoverlaysstatsjson";
}
static std::string get_help() {
return "getoverlaysstatsjson <outfile>\tgets stats for all overlays and writes to json file";
}
static std::string time_to_human(int unixtime) {
char time_buffer[80];
time_t rawtime = unixtime;
struct tm tInfo;
struct tm* timeinfo = localtime_r(&rawtime, &tInfo);
assert(timeinfo == &tInfo);
strftime(time_buffer, 80, "%c", timeinfo);
return std::string(time_buffer);
}
std::string name() const override {
return get_name();
}
private:
std::string file_name_;
};
class SignCertificateQuery : public Query {
public:
SignCertificateQuery(td::actor::ActorId<ValidatorEngineConsole> console, Tokenizer tokenizer)