Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-29790 Switch to using > as a stage name prefix #17483

Merged
merged 1 commit into from
Jan 25, 2024

Conversation

ghalliday
Copy link
Member

@ghalliday ghalliday commented Jun 22, 2023

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change improves the code (refactor or other change that does not change the functionality)
  • This change fixes warnings (the fix does not alter the functionality or the generated code)
  • This change is a breaking change (fix or feature that will cause existing behavior to change).
  • This change alters the query API (existing queries will have to be recompiled)

Checklist:

  • My code follows the code style of this project.
    • My code does not create any new warnings from compiler, build system, or lint.
  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit is signed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the CONTRIBUTORS document.
  • The change has been fully tested:
    • I have added tests to cover my changes.
    • All new and existing tests passed.
    • I have checked that this change does not introduce memory leaks.
    • I have used Valgrind or similar tools to check for potential issues.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Cloud-compatibility
    • Premature optimization
    • Existing deployed queries will not be broken
    • This change fixes the problem, not just the symptom
    • The target branch of this pull request is appropriate for such a change.
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised JIRA issues to address them separately
  • This is a user interface / front-end modification
    • I have tested my changes in multiple modern browsers
    • The component(s) render as expected

Smoketest:

  • Send notifications about my Pull Request position in Smoketest queue.
  • Test my draft Pull Request.

Testing:

@ghalliday ghalliday requested a review from GordonSmith June 22, 2023 15:14
@github-actions
Copy link

@ghalliday
Copy link
Member Author

@GordonSmith here is my experimental PR.
Note the change in the TS - I'm not sure if that is where you would place it.
Note, the labels for containers (pseudo-subgraphs) do not have the > removed. I didn't know where to modify.
It also has a change from another PR (adding git timings) and a few fixes for scopes.

Main questions are what are the implications of adding the prefix, will it cause any problems, and what needs changing to improve the display?

@@ -203,7 +203,10 @@ export class MetricGraph extends Graph2<IScope, IScopeEdge, IScope> {
}

vertexLabel(v: IScope, options: MetricsOptions): string {
return v.type === "activity" ? format(options.activityTpl, v) : v.Label || v.id;
return v.type === "activity" ? format(options.activityTpl, v) :
v.type === "function" ? v.id + "()" :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does "function" have a "Label"?

return v.type === "activity" ? format(options.activityTpl, v) : v.Label || v.id;
return v.type === "activity" ? format(options.activityTpl, v) :
v.type === "function" ? v.id + "()" :
v.type === "stage" && v.id.charAt(0) === '>' ? v.id.substring(1) :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does "stage" have a "Label"?

@ghalliday ghalliday changed the base branch from candidate-9.2.x to master January 4, 2024 10:39
@ghalliday ghalliday force-pushed the issue29790 branch 2 times, most recently from 71d3b51 to 38b8271 Compare January 5, 2024 14:30
@ghalliday ghalliday marked this pull request as ready for review January 5, 2024 14:31
@ghalliday
Copy link
Member Author

@GordonSmith @shamser This is pushed and rebased for discussion.
The problem it is trying to solve is that we often have arbitrary text "e.g., compile, generate++, copy, import, etc. etc." which is used to indicate a scope. Most scopes can deduce the scope type from the scope text. E.g. graph10, ac23,
sg99, fmyFunc.
The idea is to use a prefix character - in this case > to indicate that the scope is an operation. However this has a few problems as far as the UI goes - all the labels and display text look strange. Is the correct solution to filter any ">"s from the text before displaying it?
A different alternative would be that if you cannot recognise the scope text then assume it is an operation. However that has problems that you couldn't have any operations beginning with f, n or p. (These are prefixes for function, section and file scope). I don't think file is currently used and could be changed. But whatever prefix is used should probably be stripped in a similar way.
This has been on my list to fix for a while, and @shamser needs it to integrate the file copy stats properly into the workunits.
Please think about it, and may be best to have a meeting to talk about it next week.

Copy link
Contributor

@shamser shamser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that representing "compile" in SSToperation is going to be challenging. Both clarity and bug prevention will be hard to achieve.

SSToperation is prefixing all operations with >. However, "compile" scope is used with SSToperation type without the prefix. I would imagine there is there potential for bugs. There is definitely one issue where a StatsScopeId may set to SSToperation("compile") but calling getScopeText on the same StatsScopeId would return ">compile".

I believe SSTcompilestage should remain to represent the top level compile scope.

scope.append("compiler::parse::").append(name);
parseCtx.statsTarget.addStatistic(SSTcompilestage, scope, StTimeTotalExecute, nullptr, totalTime, 1, 0, StatsMergeSum);
parseCtx.statsTarget.addStatistic(SSTcompilestage, scope, StTimeLocalExecute, nullptr, localTime, 1, 0, StatsMergeSum);
scope.append("compile::>parse::>").append(name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be unrelated to this but why is double colons used here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A mistake... They should be single.

@@ -66,7 +68,7 @@ enum StatisticScopeType
SSTactivity,
SSTallocator, // identifies an allocator
SSTsection, // A section within the query - not a great differentiator
SSTcompilestage, // a stage within the compilation process
SSToperation, // an operation or stage in processing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there is a good case to have "compile" as the parent scope for compilation related stats. And if "compile" is a valid scope, then SSTcompilestage should remain. So, for "compile:>compile c++", it makes sense to use SSTcompilestage(compile) and SSToperation(compile c++).

StatsScopeId::getScopeText() is called when scopeType is SSToperation and name is "compile" should it return ">compile" or would there be special code to return "compile"?

(Or, SSTcompilestage is eliminated then ">compile" should be used instead of "compile" in all cases. Instead of "compile:>compile c++", the following format should be used if SSTcompilestage is eliminated ">compile:>compile c++". )

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good point. I started off using >compile everywhere, and then relaxed it, but you are correct it will be inconsistent, which is not great. It could be also be a SSTstage where it only matches specific words with no prefix - if so would there be any other examples it could be used for? Your "dfu" scope could be another.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SSTstage sounds like a good idea. I agree it could be used for dfu as well. I assume there would be a prefix for stage?

@@ -12346,7 +12346,7 @@ extern WORKUNIT_API void submitWorkUnit(const char *wuid, const char *username,

{
Owned<IWorkUnit> wu = &cw->lock();
addTimeStamp(wu, SSTcompilestage, "compile", StWhenQueued, 0);
addTimeStamp(wu, SSToperation, "compile", StWhenQueued, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't all SSToperation be prefixed with >? Shouldn't it be either

addTimeStamp(wu, SSTcompilestage, "compile", StWhenQueued, 0);

OR
addTimeStamp(wu, SSToperation, ">compile", StWhenQueued, 0);

@@ -554,7 +554,7 @@ StatisticScopeType getScopeType(const char * scope)
if (nullptr == scope)
id.setId(SSTglobal, 0);
else if (startsWith(scope, "compile"))
id.setId(SSTcompilestage, 0);
id.setId(SSToperation, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This produces the scope ">". Line 556-557 may be eliminated as setScopeText in the next code block (line 560-564) has code to handle compile scope.

case SSTsection:
return out.append(SectionScopePrefix).append(name);
case SSToperation:
return out.append(OperationScopePrefix).append(name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, all operation scopes are prefixed with >. It wouldn't ever produce the scope "compile" but ">compile". Please see comment regarding keeping SSTcompilestage.

@@ -1673,6 +1686,11 @@ bool StatsScopeId::setScopeText(const char * text, const char * * _next)
setChildGraphId(strtoul(text+ strlen(ChildGraphScopePrefix), next, 10));
return true;
}
if (MATCHES_CONST_PREFIX(text, "compile"))
{
setOperationId("compile");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, getScopeText for this will return ">compile"

@ghalliday ghalliday force-pushed the issue29790 branch 2 times, most recently from bb90e7b to 95f5c4e Compare January 19, 2024 13:49
Copy link
Contributor

@shamser shamser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@ghalliday
Copy link
Member Author

@GordonSmith please can we talk this through next week to check what implications it has for eclwatch

@ghalliday ghalliday merged commit cb7016f into hpcc-systems:master Jan 25, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants