message_status_counter.h 972 B

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include "message_status.h"
  3. #include <library/cpp/messagebus/monitoring/mon_proto.pb.h>
  4. #include <util/generic/string.h>
  5. #include <array>
  6. namespace NBus {
  7. namespace NPrivate {
  8. struct TMessageStatusCounter {
  9. static TMessageStatusRecord::EMessageStatus MessageStatusToProtobuf(EMessageStatus status) {
  10. return (TMessageStatusRecord::EMessageStatus)status;
  11. }
  12. std::array<unsigned, MESSAGE_STATUS_COUNT> Counts;
  13. unsigned& operator[](EMessageStatus index) {
  14. return Counts[index];
  15. }
  16. const unsigned& operator[](EMessageStatus index) const {
  17. return Counts[index];
  18. }
  19. TMessageStatusCounter();
  20. TMessageStatusCounter& operator+=(const TMessageStatusCounter&);
  21. TString PrintToString() const;
  22. void FillErrorsProtobuf(TConnectionStatusMonRecord*) const;
  23. };
  24. }
  25. }