aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/message_status_counter.cpp
diff options
context:
space:
mode:
authornga <nga@yandex-team.ru>2022-02-10 16:48:09 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:09 +0300
commitc2a1af049e9deca890e9923abe64fe6c59060348 (patch)
treeb222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp/messagebus/message_status_counter.cpp
parent1f553f46fb4f3c5eec631352cdd900a0709016af (diff)
downloadydb-c2a1af049e9deca890e9923abe64fe6c59060348.tar.gz
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/messagebus/message_status_counter.cpp')
-rw-r--r--library/cpp/messagebus/message_status_counter.cpp98
1 files changed, 49 insertions, 49 deletions
diff --git a/library/cpp/messagebus/message_status_counter.cpp b/library/cpp/messagebus/message_status_counter.cpp
index 13d4cfbdab..891c8f5bb2 100644
--- a/library/cpp/messagebus/message_status_counter.cpp
+++ b/library/cpp/messagebus/message_status_counter.cpp
@@ -1,60 +1,60 @@
#include "message_status_counter.h"
-#include "key_value_printer.h"
-#include "text_utils.h"
-
+#include "key_value_printer.h"
+#include "text_utils.h"
+
#include <library/cpp/messagebus/monitoring/mon_proto.pb.h>
-
+
#include <util/stream/str.h>
-
-using namespace NBus;
-using namespace NBus::NPrivate;
-
+
+using namespace NBus;
+using namespace NBus::NPrivate;
+
TMessageStatusCounter::TMessageStatusCounter() {
- Zero(Counts);
-}
-
-TMessageStatusCounter& TMessageStatusCounter::operator+=(const TMessageStatusCounter& that) {
- for (size_t i = 0; i < MESSAGE_STATUS_COUNT; ++i) {
- Counts[i] += that.Counts[i];
- }
- return *this;
-}
-
+ Zero(Counts);
+}
+
+TMessageStatusCounter& TMessageStatusCounter::operator+=(const TMessageStatusCounter& that) {
+ for (size_t i = 0; i < MESSAGE_STATUS_COUNT; ++i) {
+ Counts[i] += that.Counts[i];
+ }
+ return *this;
+}
+
TString TMessageStatusCounter::PrintToString() const {
- TStringStream ss;
- TKeyValuePrinter p;
- bool hasNonZeros = false;
- bool hasZeros = false;
- for (size_t i = 0; i < MESSAGE_STATUS_COUNT; ++i) {
- if (i == MESSAGE_OK) {
+ TStringStream ss;
+ TKeyValuePrinter p;
+ bool hasNonZeros = false;
+ bool hasZeros = false;
+ for (size_t i = 0; i < MESSAGE_STATUS_COUNT; ++i) {
+ if (i == MESSAGE_OK) {
Y_VERIFY(Counts[i] == 0);
- continue;
- }
- if (Counts[i] != 0) {
- p.AddRow(EMessageStatus(i), Counts[i]);
- const char* description = MessageStatusDescription(EMessageStatus(i));
- // TODO: add third column
+ continue;
+ }
+ if (Counts[i] != 0) {
+ p.AddRow(EMessageStatus(i), Counts[i]);
+ const char* description = MessageStatusDescription(EMessageStatus(i));
+ // TODO: add third column
Y_UNUSED(description);
-
- hasNonZeros = true;
- } else {
- hasZeros = true;
- }
- }
- if (!hasNonZeros) {
- ss << "message status counts are zeros\n";
- } else {
- if (hasZeros) {
- ss << "message status counts are zeros, except:\n";
- } else {
- ss << "message status counts:\n";
- }
- ss << IndentText(p.PrintToString());
- }
- return ss.Str();
-}
-
+
+ hasNonZeros = true;
+ } else {
+ hasZeros = true;
+ }
+ }
+ if (!hasNonZeros) {
+ ss << "message status counts are zeros\n";
+ } else {
+ if (hasZeros) {
+ ss << "message status counts are zeros, except:\n";
+ } else {
+ ss << "message status counts:\n";
+ }
+ ss << IndentText(p.PrintToString());
+ }
+ return ss.Str();
+}
+
void TMessageStatusCounter::FillErrorsProtobuf(TConnectionStatusMonRecord* status) const {
status->clear_errorcountbystatus();
for (size_t i = 0; i < MESSAGE_STATUS_COUNT; ++i) {