Skip to content

Commit

Permalink
Merge pull request #17762 from wangkx/h2849992x
Browse files Browse the repository at this point in the history
HPCC-28499 Add roxie stats to WsECL GUI

Reviewed-By: Anthony Fishbeck <[email protected]>
Reviewed-by: Gavin Halliday <[email protected]>
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored Sep 19, 2023
2 parents 2f7aa54 + 23f2e61 commit 8f13dbf
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 4 deletions.
2 changes: 2 additions & 0 deletions common/wuwebview/wuwebview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions esp/services/common/jsonhelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions esp/services/ws_ecl/ws_ecl_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions esp/xslt/wsecl3_form.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,14 @@ function switchInputForm()
</span>
</td>
</tr>
<tr>
<td class='input' align='left'>
<span>
<hr/>
<input type='checkbox' name='@statsToWorkunit'/> Save stats to workunit.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='checkbox' name='@summaryStats'/> Get summary stats.<br/>
</span>
</td>
</tr>
</xsl:if>
<tr><td bgcolor="#030303" height="1"></td></tr>
<tr><td height="6"></td></tr>
Expand Down
18 changes: 18 additions & 0 deletions esp/xslt/wsecl3_result.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,29 @@

<xsl:template match="Results">
<xsl:apply-templates select="Exception"/>
<xsl:apply-templates select="Result/SummaryStats">
<xsl:with-param name="wsecl" select="true()"/>
</xsl:apply-templates>
<xsl:apply-templates select="Result/StatsWorkUnit">
<xsl:with-param name="wsecl" select="true()"/>
</xsl:apply-templates>
<xsl:apply-templates select="Result">
<xsl:with-param name="wsecl" select="true()"/>
</xsl:apply-templates>
<xsl:apply-templates select="Result/Tracing"/>
</xsl:template>
<xsl:template match="SummaryStats">
<xsl:param name="wsecl" select="false()"/>
<b><xsl:text>SummaryStats: </xsl:text></b><xsl:value-of select="."/>
<br/>
<br/>
</xsl:template>
<xsl:template match="StatsWorkUnit">
<xsl:param name="wsecl" select="false()"/>
<b><xsl:text>Stats WorkUnit: </xsl:text></b><xsl:value-of select="wuid"/>
<br/>
<br/>
</xsl:template>
<xsl:template match="Exception">
<b>Exception</b>
<br/>
Expand Down
22 changes: 18 additions & 4 deletions roxie/ccd/ccdlistener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1768,12 +1768,26 @@ class RoxieProtocolMsgSink : implements IHpccNativeProtocolMsgSink, public CInte
Owned<IXmlWriter> logwriter = protocol->writeAppendContent(nullptr);
msgctx->writeLogXML(*logwriter);
}
if (statsWuid.length())

bool summaryStats = msg->getPropBool("@summaryStats", false);
if (!statsWuid.isEmpty() || summaryStats)
{
Owned<IXmlWriter> 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<IRoxieContextLogger&>(*msgctx->queryLogContext());
logctx.getStats(s).newline();
wuwriter->outputCString(s.str(), "SummaryStats");
}
}

protocol->finalize(idx);
Expand Down

0 comments on commit 8f13dbf

Please sign in to comment.