diff --git a/common/wuwebview/wuwebview.cpp b/common/wuwebview/wuwebview.cpp index fb824ccc042..f74f7bdd242 100644 --- a/common/wuwebview/wuwebview.cpp +++ b/common/wuwebview/wuwebview.cpp @@ -80,6 +80,8 @@ class WuExpandedResultBuffer : implements IPTreeNotifyEvent, public CInterface resultChildTags.setValue("Warning", true); resultChildTags.setValue("Alert", true); resultChildTags.setValue("Info", true); + resultChildTags.setValue("StatsWorkUnit", true); + resultChildTags.setValue("SummaryStats", true); } void appendResults(IConstWorkUnit *wu, const char *username, const char *pw) diff --git a/esp/services/common/jsonhelpers.hpp b/esp/services/common/jsonhelpers.hpp index 969dcd40783..9bedec5d2d0 100644 --- a/esp/services/common/jsonhelpers.hpp +++ b/esp/services/common/jsonhelpers.hpp @@ -329,6 +329,12 @@ namespace JsonHelpers bool log = reqTree->getPropBool("@log", false); //not in schema if (log) appendJSONValue(out, "@log", true); + bool statsToWorkunit = reqTree->getPropBool("@statsToWorkunit", false); //not in schema + if (statsToWorkunit) + appendJSONValue(out, "@statsToWorkunit", true); + bool summaryStats = reqTree->getPropBool("@summaryStats", false); //not in schema + if (summaryStats) + appendJSONValue(out, "@summaryStats", true); int tracelevel = reqTree->getPropInt("@traceLevel", -1); if (tracelevel>=0) appendJSONValue(out, "@traceLevel", tracelevel); diff --git a/esp/services/ws_ecl/ws_ecl_service.cpp b/esp/services/ws_ecl/ws_ecl_service.cpp index 12317eb08a6..c2a087e0fe8 100644 --- a/esp/services/ws_ecl/ws_ecl_service.cpp +++ b/esp/services/ws_ecl/ws_ecl_service.cpp @@ -660,6 +660,12 @@ static void buildReqXml(StringArray& parentTypes, IXmlType* type, StringBuffer& bool log = reqTree->getPropBool("@log", false); if (log) appendXMLAttr(out, "log", "true", nullptr, true); + bool statsToWorkunit = reqTree->getPropBool("@statsToWorkunit", false); + if (statsToWorkunit) + appendXMLAttr(out, "statsToWorkunit", "true", nullptr, true); + bool summaryStats = reqTree->getPropBool("@summaryStats", false); + if (summaryStats) + appendXMLAttr(out, "summaryStats", "true", nullptr, true); int tracelevel = reqTree->getPropInt("@traceLevel", -1); if (tracelevel >= 0) out.appendf(" traceLevel=\"%d\"", tracelevel); diff --git a/esp/xslt/wsecl3_form.xsl b/esp/xslt/wsecl3_form.xsl index 5382b3c9291..d2b6a7ff012 100644 --- a/esp/xslt/wsecl3_form.xsl +++ b/esp/xslt/wsecl3_form.xsl @@ -320,6 +320,14 @@ function switchInputForm() + + + +
+ Save stats to workunit.      Get summary stats.
+
+ + diff --git a/esp/xslt/wsecl3_result.xslt b/esp/xslt/wsecl3_result.xslt index 9125c85c977..733fe972474 100644 --- a/esp/xslt/wsecl3_result.xslt +++ b/esp/xslt/wsecl3_result.xslt @@ -77,11 +77,29 @@ + + + + + + + + + SummaryStats: +
+
+
+ + + Stats WorkUnit: +
+
+
Exception
diff --git a/roxie/ccd/ccdlistener.cpp b/roxie/ccd/ccdlistener.cpp index 27b10f94cd6..d659928df9e 100644 --- a/roxie/ccd/ccdlistener.cpp +++ b/roxie/ccd/ccdlistener.cpp @@ -1768,12 +1768,26 @@ class RoxieProtocolMsgSink : implements IHpccNativeProtocolMsgSink, public CInte Owned logwriter = protocol->writeAppendContent(nullptr); msgctx->writeLogXML(*logwriter); } - if (statsWuid.length()) + + bool summaryStats = msg->getPropBool("@summaryStats", false); + if (!statsWuid.isEmpty() || summaryStats) { Owned wuwriter = protocol->writeAppendContent(nullptr); - wuwriter->outputBeginNested("StatsWorkUnit", true); - wuwriter->outputCString(statsWuid.str(), "wuid"); - wuwriter->outputEndNested("StatsWorkUnit"); + if (!statsWuid.isEmpty()) + { + wuwriter->outputBeginNested("StatsWorkUnit", true); + wuwriter->outputCString(statsWuid.str(), "wuid"); + wuwriter->outputEndNested("StatsWorkUnit"); + } + if (summaryStats) + { + //The query completion time needs discussion and is unavailable for now. + VStringBuffer s(" COMPLETE: %s %s memory=%u Mb agentsreply=%u duplicatePackets=%u resentPackets=%u", + target, roxieMsgCtx->uid.str(), memused, agentsReplyLen, agentsDuplicates, agentsResends); + IRoxieContextLogger &logctx = static_cast(*msgctx->queryLogContext()); + logctx.getStats(s).newline(); + wuwriter->outputCString(s.str(), "SummaryStats"); + } } protocol->finalize(idx);