diff options
author | zhenyok <zhenyok@yandex-team.ru> | 2022-02-10 16:50:32 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:32 +0300 |
commit | ae11a371d50c25e7fff450f692a12cba03ceaf4f (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp | |
parent | b4b9936f4dce18fb9da09a1e46342c289d19663b (diff) | |
download | ydb-ae11a371d50c25e7fff450f692a12cba03ceaf4f.tar.gz |
Restoring authorship annotation for <zhenyok@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/messagebus/message_status_counter.cpp | 28 | ||||
-rw-r--r-- | library/cpp/messagebus/message_status_counter.h | 6 | ||||
-rw-r--r-- | library/cpp/messagebus/message_status_counter_ut.cpp | 34 | ||||
-rw-r--r-- | library/cpp/messagebus/monitoring/mon_proto.proto | 52 | ||||
-rw-r--r-- | library/cpp/messagebus/remote_connection_status.cpp | 52 | ||||
-rw-r--r-- | library/cpp/messagebus/remote_connection_status.h | 8 | ||||
-rw-r--r-- | library/cpp/messagebus/session_impl.cpp | 12 |
7 files changed, 96 insertions, 96 deletions
diff --git a/library/cpp/messagebus/message_status_counter.cpp b/library/cpp/messagebus/message_status_counter.cpp index dd417081e0..891c8f5bb2 100644 --- a/library/cpp/messagebus/message_status_counter.cpp +++ b/library/cpp/messagebus/message_status_counter.cpp @@ -5,7 +5,7 @@ #include <library/cpp/messagebus/monitoring/mon_proto.pb.h> -#include <util/stream/str.h> +#include <util/stream/str.h> using namespace NBus; using namespace NBus::NPrivate; @@ -55,17 +55,17 @@ TString TMessageStatusCounter::PrintToString() const { return ss.Str(); } -void TMessageStatusCounter::FillErrorsProtobuf(TConnectionStatusMonRecord* status) const { - status->clear_errorcountbystatus(); - for (size_t i = 0; i < MESSAGE_STATUS_COUNT; ++i) { - if (i == MESSAGE_OK) { +void TMessageStatusCounter::FillErrorsProtobuf(TConnectionStatusMonRecord* status) const { + status->clear_errorcountbystatus(); + for (size_t i = 0; i < MESSAGE_STATUS_COUNT; ++i) { + if (i == MESSAGE_OK) { Y_VERIFY(Counts[i] == 0); - continue; - } - if (Counts[i] != 0) { - TMessageStatusRecord* description = status->add_errorcountbystatus(); - description->SetStatus(TMessageStatusCounter::MessageStatusToProtobuf((EMessageStatus)i)); - description->SetCount(Counts[i]); - } - } -} + continue; + } + if (Counts[i] != 0) { + TMessageStatusRecord* description = status->add_errorcountbystatus(); + description->SetStatus(TMessageStatusCounter::MessageStatusToProtobuf((EMessageStatus)i)); + description->SetCount(Counts[i]); + } + } +} diff --git a/library/cpp/messagebus/message_status_counter.h b/library/cpp/messagebus/message_status_counter.h index 5fbfca2478..e8ba2fdd31 100644 --- a/library/cpp/messagebus/message_status_counter.h +++ b/library/cpp/messagebus/message_status_counter.h @@ -3,7 +3,7 @@ #include "message_status.h" #include <library/cpp/messagebus/monitoring/mon_proto.pb.h> - + #include <util/generic/string.h> #include <array> @@ -25,9 +25,9 @@ namespace NBus { } TMessageStatusCounter(); - + TMessageStatusCounter& operator+=(const TMessageStatusCounter&); - + TString PrintToString() const; void FillErrorsProtobuf(TConnectionStatusMonRecord*) const; }; diff --git a/library/cpp/messagebus/message_status_counter_ut.cpp b/library/cpp/messagebus/message_status_counter_ut.cpp index 10f636844d..9598651329 100644 --- a/library/cpp/messagebus/message_status_counter_ut.cpp +++ b/library/cpp/messagebus/message_status_counter_ut.cpp @@ -1,23 +1,23 @@ #include <library/cpp/testing/unittest/registar.h> - + #include "message_status_counter.h" #include <library/cpp/messagebus/monitoring/mon_proto.pb.h> - -using namespace NBus; -using namespace NBus::NPrivate; - + +using namespace NBus; +using namespace NBus::NPrivate; + Y_UNIT_TEST_SUITE(MessageStatusCounter) { Y_UNIT_TEST(MessageStatusConversion) { - const ::google::protobuf::EnumDescriptor* descriptor = - TMessageStatusRecord_EMessageStatus_descriptor(); - - for (int i = 0; i < MESSAGE_STATUS_COUNT; i++) { - const ::google::protobuf::EnumValueDescriptor* valueDescriptor = - descriptor->FindValueByName(ToString((EMessageStatus)i)); - UNIT_ASSERT_UNEQUAL(valueDescriptor, nullptr); - UNIT_ASSERT_EQUAL(valueDescriptor->number(), i); - } - UNIT_ASSERT_EQUAL(MESSAGE_STATUS_COUNT, descriptor->value_count()); - } -} + const ::google::protobuf::EnumDescriptor* descriptor = + TMessageStatusRecord_EMessageStatus_descriptor(); + + for (int i = 0; i < MESSAGE_STATUS_COUNT; i++) { + const ::google::protobuf::EnumValueDescriptor* valueDescriptor = + descriptor->FindValueByName(ToString((EMessageStatus)i)); + UNIT_ASSERT_UNEQUAL(valueDescriptor, nullptr); + UNIT_ASSERT_EQUAL(valueDescriptor->number(), i); + } + UNIT_ASSERT_EQUAL(MESSAGE_STATUS_COUNT, descriptor->value_count()); + } +} diff --git a/library/cpp/messagebus/monitoring/mon_proto.proto b/library/cpp/messagebus/monitoring/mon_proto.proto index 3b465a54ad..73b6614481 100644 --- a/library/cpp/messagebus/monitoring/mon_proto.proto +++ b/library/cpp/messagebus/monitoring/mon_proto.proto @@ -4,30 +4,30 @@ package NBus; option java_package = "ru.yandex.messagebus.monitoring.proto"; -message TMessageStatusRecord { - enum EMessageStatus { - MESSAGE_OK = 0; - MESSAGE_CONNECT_FAILED = 1; - MESSAGE_TIMEOUT = 2; - MESSAGE_SERVICE_UNKNOWN = 3; - MESSAGE_BUSY = 4; - MESSAGE_UNKNOWN = 5; - MESSAGE_DESERIALIZE_ERROR = 6; - MESSAGE_HEADER_CORRUPTED = 7; - MESSAGE_DECOMPRESS_ERROR = 8; - MESSAGE_MESSAGE_TOO_LARGE = 9; - MESSAGE_REPLY_FAILED = 10; - MESSAGE_DELIVERY_FAILED = 11; - MESSAGE_INVALID_VERSION = 12; - MESSAGE_SERVICE_TOOMANY = 13; - MESSAGE_SHUTDOWN = 14; - MESSAGE_DONT_ASK = 15; - } - - optional EMessageStatus Status = 1; - optional uint32 Count = 2; -} - +message TMessageStatusRecord { + enum EMessageStatus { + MESSAGE_OK = 0; + MESSAGE_CONNECT_FAILED = 1; + MESSAGE_TIMEOUT = 2; + MESSAGE_SERVICE_UNKNOWN = 3; + MESSAGE_BUSY = 4; + MESSAGE_UNKNOWN = 5; + MESSAGE_DESERIALIZE_ERROR = 6; + MESSAGE_HEADER_CORRUPTED = 7; + MESSAGE_DECOMPRESS_ERROR = 8; + MESSAGE_MESSAGE_TOO_LARGE = 9; + MESSAGE_REPLY_FAILED = 10; + MESSAGE_DELIVERY_FAILED = 11; + MESSAGE_INVALID_VERSION = 12; + MESSAGE_SERVICE_TOOMANY = 13; + MESSAGE_SHUTDOWN = 14; + MESSAGE_DONT_ASK = 15; + } + + optional EMessageStatus Status = 1; + optional uint32 Count = 2; +} + message TConnectionStatusMonRecord { optional uint32 SendQueueSize = 1 [ (NMonProto.Metric).Type = GAUGE ]; // client only @@ -44,8 +44,8 @@ message TConnectionStatusMonRecord { optional uint64 ReadMessages = 22 [ (NMonProto.Metric).Type = RATE ]; optional uint64 ReadSyscalls = 23; optional uint64 ReadActs = 24; - - repeated TMessageStatusRecord ErrorCountByStatus = 25; + + repeated TMessageStatusRecord ErrorCountByStatus = 25; } message TSessionStatusMonRecord { diff --git a/library/cpp/messagebus/remote_connection_status.cpp b/library/cpp/messagebus/remote_connection_status.cpp index 4e4e01dcf5..2c48b2a287 100644 --- a/library/cpp/messagebus/remote_connection_status.cpp +++ b/library/cpp/messagebus/remote_connection_status.cpp @@ -128,32 +128,32 @@ size_t TRemoteConnectionWriterStatus::GetInFlight() const { return SendQueueSize + AckMessagesSize; } -TConnectionStatusMonRecord TRemoteConnectionStatus::GetStatusProtobuf() const { - TConnectionStatusMonRecord status; - - // TODO: fill unfilled fields - status.SetSendQueueSize(WriterStatus.SendQueueSize); - status.SetAckMessagesSize(WriterStatus.AckMessagesSize); - // status.SetErrorCount(); - // status.SetWriteBytes(); - // status.SetWriteBytesCompressed(); - // status.SetWriteMessages(); - status.SetWriteSyscalls(WriterStatus.Incremental.NetworkOps); - status.SetWriteActs(WriterStatus.Acts); - // status.SetReadBytes(); - // status.SetReadBytesCompressed(); - // status.SetReadMessages(); - status.SetReadSyscalls(ReaderStatus.Incremental.NetworkOps); - status.SetReadActs(ReaderStatus.Acts); - - TMessageStatusCounter sumStatusCounter; - sumStatusCounter += WriterStatus.Incremental.StatusCounter; - sumStatusCounter += ReaderStatus.Incremental.StatusCounter; - sumStatusCounter.FillErrorsProtobuf(&status); - - return status; -} - +TConnectionStatusMonRecord TRemoteConnectionStatus::GetStatusProtobuf() const { + TConnectionStatusMonRecord status; + + // TODO: fill unfilled fields + status.SetSendQueueSize(WriterStatus.SendQueueSize); + status.SetAckMessagesSize(WriterStatus.AckMessagesSize); + // status.SetErrorCount(); + // status.SetWriteBytes(); + // status.SetWriteBytesCompressed(); + // status.SetWriteMessages(); + status.SetWriteSyscalls(WriterStatus.Incremental.NetworkOps); + status.SetWriteActs(WriterStatus.Acts); + // status.SetReadBytes(); + // status.SetReadBytesCompressed(); + // status.SetReadMessages(); + status.SetReadSyscalls(ReaderStatus.Incremental.NetworkOps); + status.SetReadActs(ReaderStatus.Acts); + + TMessageStatusCounter sumStatusCounter; + sumStatusCounter += WriterStatus.Incremental.StatusCounter; + sumStatusCounter += ReaderStatus.Incremental.StatusCounter; + sumStatusCounter.FillErrorsProtobuf(&status); + + return status; +} + TString TRemoteConnectionStatus::PrintToString() const { TStringStream ss; diff --git a/library/cpp/messagebus/remote_connection_status.h b/library/cpp/messagebus/remote_connection_status.h index 46d83ba4cd..5db10e51ea 100644 --- a/library/cpp/messagebus/remote_connection_status.h +++ b/library/cpp/messagebus/remote_connection_status.h @@ -11,10 +11,10 @@ #include <library/cpp/deprecated/enum_codegen/enum_codegen.h> -namespace NBus { - class TConnectionStatusMonRecord; -} - +namespace NBus { + class TConnectionStatusMonRecord; +} + namespace NBus { namespace NPrivate { #define WRITER_STATE_MAP(XX) \ diff --git a/library/cpp/messagebus/session_impl.cpp b/library/cpp/messagebus/session_impl.cpp index 7d70b9171f..ddf9f360c4 100644 --- a/library/cpp/messagebus/session_impl.cpp +++ b/library/cpp/messagebus/session_impl.cpp @@ -250,12 +250,12 @@ TString TBusSessionImpl::GetStatus(ui16 flags) { TConnectionStatusMonRecord TBusSessionImpl::GetStatusProtobuf() { Y_VERIFY(!Queue->GetExecutor()->IsInExecutorThread(), "GetStatus must not be called from executor thread"); - - TGuard<TMutex> guard(StatusData.StatusDumpCachedMutex); - - return StatusData.StatusDumpCached.ConnectionStatusSummary.GetStatusProtobuf(); -} - + + TGuard<TMutex> guard(StatusData.StatusDumpCachedMutex); + + return StatusData.StatusDumpCached.ConnectionStatusSummary.GetStatusProtobuf(); +} + TString TBusSessionImpl::GetStatusSingleLine() { TSessionDumpStatus status = GetStatusRecordInternal(); |