14 #include "oneapi/tbb/concurrent_unordered_map.h" 36 struct ErrorSummaryMapKey {
41 bool operator<(ErrorSummaryMapKey
const& iOther)
const {
42 int comp =
severity.getLevel() - iOther.severity.getLevel();
52 bool operator==(ErrorSummaryMapKey
const& iOther)
const {
53 return ((iOther.category ==
category) and (iOther.module ==
module) and
54 (
severity.getLevel() == iOther.severity.getLevel()));
56 size_t smallHash()
const {
57 std::hash<std::string>
h;
63 std::size_t operator()(ErrorSummaryMapKey
const& iKey)
const {
return iKey.smallHash(); }
67 class AtomicUnsignedInt {
69 AtomicUnsignedInt() : value_(0) {}
70 AtomicUnsignedInt(AtomicUnsignedInt
const& r) : value_(r.value_.load(std::memory_order_acquire)) {}
71 std::atomic<unsigned int>&
value() {
return value_; }
72 std::atomic<unsigned int>
const&
value()
const {
return value_; }
75 std::atomic<unsigned int> value_;
83 oneapi::tbb::concurrent_unordered_map<ErrorSummaryMapKey, AtomicUnsignedInt, ErrorSummaryMapKey::key_hash>>
87 : errorobj_p(suppressed ? nullptr : new
ErrorObj(sev,
id, verbatim), ErrorObjDeleter()) {
94 void MessageSender::ErrorObjDeleter::operator()(
ErrorObj* errorObjPtr) {
95 if (errorObjPtr ==
nullptr) {
113 std::cerr <<
"MessageSender::~MessageSender() - Null drop pointer \n";
122 auto i = errorSummaryMap.find(
key);
123 if (
i != errorSummaryMap.end()) {
124 i->second.value().fetch_add(1, std::memory_order_acq_rel);
126 errorSummaryMap[
key].value().store(1, std::memory_order_release);
149 using namespace messagelogger;
169 std::vector<ErrorSummaryEntry>
v;
170 auto end = errorSummaryMap.end();
171 for (
auto i = errorSummaryMap.begin();
i != end; ++
i) {
172 auto const&
key =
i->first;
175 e.count =
i->second.value().load(std::memory_order_acquire);
190 std::vector<ErrorSummaryEntry>
v;
193 auto end = errorSummaryMap.end();
194 for (
auto i = errorSummaryMap.begin();
i != end; ++
i) {
195 auto const&
key =
i->first;
198 e.count =
i->second.value().load(std::memory_order_acquire);
messagelogger::ELseverityLevel severity
constexpr const ELseverityLevel ELwarning
bool EnableLoggedErrorsSummary()
ret
prodAgent to be discontinued
static MessageDrop * instance()
void clearLoggedErrorsSummary(unsigned int iStreamID)
void setMaxLoggedErrorsSummaryIndicies(unsigned int iMax)
bool FreshErrorsExist(unsigned int iStreamID)
bool DisableLoggedErrorsSummary()
constexpr bool operator==(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
key
prepare the HTCondor submission files and eventually submit them
virtual void setModule(std::string_view module)
const ELextendedID & xid() const
std::vector< messagelogger::ErrorSummaryEntry > LoggedErrorsOnlySummary(unsigned int iStreamID)
static std::vector< oneapi::tbb::concurrent_unordered_map< ErrorSummaryMapKey, AtomicUnsignedInt, ErrorSummaryMapKey::key_hash > > errorSummaryMaps
constexpr const ELseverityLevel ELerror
constexpr bool operator<(ELseverityLevel const &e1, ELseverityLevel const &e2) noexcept
static std::atomic< bool > errorSummaryIsBeingKept
virtual void setContext(std::string_view context)
static void MLqLOG(ErrorObj *p)
std::vector< messagelogger::ErrorSummaryEntry > LoggedErrorsSummary(unsigned int iStreamID)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.