From e44bd6c763aa27c19142f4f3fabb94b1bf9fe827 Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Fri, 30 Jun 2017 15:09:05 +0200 Subject: [PATCH] Fix offset --- .../ApplicationMessageOamModule.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/source/diameter.comm/ApplicationMessageOamModule.cpp b/source/diameter.comm/ApplicationMessageOamModule.cpp index 91fff6c..9c58cd1 100644 --- a/source/diameter.comm/ApplicationMessageOamModule.cpp +++ b/source/diameter.comm/ApplicationMessageOamModule.cpp @@ -91,7 +91,7 @@ void anna::diameter::comm::ApplicationMessageOamModule::count (int messageCode, LOGDEBUG(anna::Logger::debug(anna::functions::asString("No more holes to register new application message counters in the scope (up to %d message codes)", capacity), ANNA_FILE_LOCATION)); return; } - baseOffset = getCounterTypes() * a_eventMap.size(); // N counter types for each message code + baseOffset = getCounterTypes() * a_eventMap.size(); // N counter types for each message code / rc a_eventMap[eventId] = baseOffset; // Counter name: @@ -116,13 +116,19 @@ void anna::diameter::comm::ApplicationMessageOamModule::count (int messageCode, if (counterNamePrefix[counterNamePrefix.size() - 1] != '-') counterNamePrefix += "-"; std::string counterName; - // register only count event: - //for (int offset = 0; offset < getCounterTypes(); offset++) { - int offset = baseOffset + type; + /* + for (int offset = 0; offset < getCounterTypes(); offset++) { counterName = counterNamePrefix + getDefaultInternalCounterDescription(offset); if (resultCode != -1) counterName += anna::functions::asString("-ResultCode_%d", resultCode); registerCounter(baseOffset + offset, counterName, baseOffset + offset); - //} + } + */ + // Register only affected one: + int offset = baseOffset + type; + counterName = counterNamePrefix + getDefaultInternalCounterDescription(type); + if (resultCode != -1) counterName += anna::functions::asString("-ResultCode_%d", resultCode); + registerCounter(baseOffset + offset, counterName, baseOffset + offset); + } else { baseOffset = eventMap_it->second; -- 2.20.1