Skip to content

Commit

Permalink
HPCC-28499 Add roxie stats to WsECL GUI
Browse files Browse the repository at this point in the history
1. Display checkbox 'Save stats to workunit.' and checkbox 'Get
summary stats.' in WsECL GUI.
2. Pass the requests of the 2 checkboxes to WsECL and roxie.
3. Add code to report the summary stats in roxie when the
request is sent from WsECL GUI.
4. Display the stats workunit id and the summary stats in WsECL
GUI.

Revise based on review:
1. Rename the 'save_stats' to '@statsToWorkunit' and rename the
'summary_stats' to 'summaryStats'.
2. Remove the code for converting the 'save_stats' to the
'@statsToWorkunit'. The code is not needed.
3. Add the code to pass the '@statsToWorkunit' and '@summaryStats'
to the SOAP test form and JSON test form.

Signed-off-by: wangkx <[email protected]>
  • Loading branch information
wangkx committed Sep 18, 2023
1 parent 0a91c2c commit 23f2e61
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 23f2e61

Please sign in to comment.