Pārlūkot izejas kodu

HPCC-22852 Define a unique range message numbers for Analyzer message

Signed-off-by: Shamser Ahmed <shamser.ahmed@lexisnexis.co.uk>
Shamser Ahmed 5 gadi atpakaļ
vecāks
revīzija
ae2d031c5b

+ 1 - 0
common/wuanalysis/CMakeLists.txt

@@ -35,6 +35,7 @@ set (    SRCS
          anacommon.hpp
          anarule.hpp
          anawu.hpp
+         anaerrorcodes.hpp
     )
 
 include_directories (

+ 4 - 2
common/wuanalysis/anacommon.cpp

@@ -36,12 +36,13 @@ void PerformanceIssue::print() const
 {
     StringBuffer out;
     formatStatistic(out, cost, SMeasureTimeNs);
-    printf("[%s] %s: %s\n", out.str(), scope.str(), comment.str());
+    printf("[%s] E%d %s: %s\n", out.str(), errorCode, scope.str(), comment.str());
 }
 
 void PerformanceIssue::createException(IWorkUnit * wu)
 {
     Owned<IWUException> we = wu->createException();
+    we->setExceptionCode(errorCode);
     we->setSeverity(SeverityInformation);
     we->setScope(scope.str());
     we->setPriority((unsigned) statUnits2msecs(cost));
@@ -49,9 +50,10 @@ void PerformanceIssue::createException(IWorkUnit * wu)
     we->setExceptionSource("Workunit Analyser");
 }
 
-void PerformanceIssue::set(stat_type _cost, const char * msg, ...)
+void PerformanceIssue::set(AnalyzerErrorCode _errorCode, stat_type _cost, const char * msg, ...)
 {
     cost = _cost;
+    errorCode = _errorCode;
     va_list args;
     va_start(args, msg);
     comment.valist_appendf(msg, args);

+ 3 - 1
common/wuanalysis/anacommon.hpp

@@ -21,6 +21,7 @@
 #include "jliball.hpp"
 #include "wuattr.hpp"
 #include "eclhelper.hpp"
+#include "anaerrorcodes.hpp"
 
 #ifdef WUANALYSIS_EXPORTS
     #define WUANALYSIS_API DECL_EXPORT
@@ -66,11 +67,12 @@ public:
     void print() const;
     void createException(IWorkUnit * we);
 
-    void set(stat_type _cost, const char * msg, ...) __attribute__((format(printf, 3, 4)));
+    void set(AnalyzerErrorCode _errorCode, stat_type _cost, const char * msg, ...) __attribute__((format(printf, 4, 5)));
     void setScope(const char *_scope) { scope.set(_scope); }
     stat_type getCost() const         { return cost; }
 
 private:
+    AnalyzerErrorCode errorCode;
     StringAttr scope;
     stat_type cost = 0;      // number of nanoseconds lost as a result.
     StringBuffer comment;

+ 15 - 0
common/wuanalysis/anaerrorcodes.hpp

@@ -0,0 +1,15 @@
+#ifndef COMMON_WUANALYSIS_ANAERRORCODES_HPP_
+#define COMMON_WUANALYSIS_ANAERRORCODES_HPP_
+
+#include "errorlist.h"
+
+typedef enum
+{
+    ANA_GENERICERROR_ID=CONFIG_MGR_ERROR_START,
+    ANA_DISTRIB_SKEW_INPUT_ID,
+    ANA_DISTRIB_SKEW_OUTPUT_ID,
+    ANA_IOSKEW_RECORDS_ID,
+    ANA_IOSKEW_CHILDRECORDS_ID
+} AnalyzerErrorCode;
+
+#endif /* COMMON_WUANALYSIS_ANAERRORCODES_HPP_ */

+ 4 - 4
common/wuanalysis/anarule.cpp

@@ -63,9 +63,9 @@ public:
 
             IWuEdge * inputEdge = activity.queryInput(0);
             if (inputEdge && (inputEdge->getStatRaw(StNumRowsProcessed, StSkewMax) < rowsMaxSkew))
-                result.set(cost, "DISTRIBUTE output skew is worse than input skew (%s)", activity.queryName());
+                result.set(ANA_DISTRIB_SKEW_INPUT_ID, cost, "DISTRIBUTE output skew is worse than input skew (%s)", activity.queryName());
             else
-                result.set(cost, "Significant skew in DISTRIBUTE output (%s)", activity.queryName());
+                result.set(ANA_DISTRIB_SKEW_OUTPUT_ID, cost, "Significant skew in DISTRIBUTE output (%s)", activity.queryName());
             return true;
         }
         return false;
@@ -151,9 +151,9 @@ public:
             auto edgeMaxSkew = edge ? edge->getStatRaw(StNumRowsProcessed, StSkewMax) : 0;
             // If difference between ioSkew and edgeMaxSkew > 0.05%, then child record likely to have caused skew
             if (ioMaxSkew > edgeMaxSkew && (ioMaxSkew-edgeMaxSkew) > ioMaxSkew/200)
-                results.set(cost, "Significant skew in child records causes uneven %s time (%s)", category, activity.queryName());
+                results.set(ANA_IOSKEW_RECORDS_ID, cost, "Significant skew in child records causes uneven %s time (%s)", category, activity.queryName());
             else
-                results.set(cost, "Significant skew in records causes uneven %s time (%s)", category, activity.queryName());
+                results.set(ANA_IOSKEW_CHILDRECORDS_ID, cost, "Significant skew in records causes uneven %s time (%s)", category, activity.queryName());
             return true;
         }
         return false;

+ 2 - 0
system/include/errorlist.h

@@ -106,5 +106,7 @@
 #define CONFIG_MGR_ERROR_START  30000
 #define CONFIG_MGR_ERROR_END    30099
 
+#define WORKUNIT_ANALYZER_START 31000
+#define WORKUNIT_ANALYZER_END   31999
 #endif