-
Notifications
You must be signed in to change notification settings - Fork 304
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-32982 Add alternative span scopes & OwnedSpanScope refactoring #19342
Conversation
Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-32982 Jirabot Action Result: |
Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-32982 Jirabot Action Result: |
@@ -159,11 +159,70 @@ interface ISpan : extends IInterface | |||
virtual const char* queryLocalId() const = 0; | |||
}; | |||
|
|||
//------------------------------------------------------------------------------ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I felt ActiveSpanScope and OwnedActiveSpanScope better explained what these classes are doing but I am certainly open to changing the names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jpmcmu looks good. A few minor comments.
system/jlib/jtrace.hpp
Outdated
// involving multiple threads, time sliced work, etc ActiveSpanScope should be used. | ||
//------------------------------------------------------------------------------ | ||
|
||
class ActiveSpanScope |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment that the span must be guaranteed to be owned by another class while this executes.
system/jlib/jtrace.hpp
Outdated
// involving multiple threads, time sliced work, etc ActiveSpanScope should be used. | ||
//------------------------------------------------------------------------------ | ||
|
||
class ActiveSpanScope |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs class jlib_decl, otherwise you will get link failures when symbols are not exported.
system/jlib/jtrace.hpp
Outdated
Owned<ISpan> span; | ||
ISpan * prevSpan = nullptr; | ||
}; | ||
|
||
class jlib_decl OwnedSpanScope |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest reordering this before OwnedActiveSpanScope, so there is a logical progression of functionality within the classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I almost wonder if OwnedSpanLifetime would be a better name - since it isn't really associated with a scope.
system/jlib/jtrace.cpp
Outdated
ISpan* current = queryThreadedActiveSpan(); | ||
if (current != span) | ||
{ | ||
const char* currSpanID = current != nullptr ? current->querySpanId() : "null"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: queryThreadedActiveSpan() can never be null, but CNullSpan::querySpanId() should be changed to return "null".
system/jlib/jtrace.hpp
Outdated
// OwnedActiveSpanScope controls the lifetime of its ISpan while ActiveSpanScope | ||
// does not. In cases where the ISpan will be used from a single thread and within | ||
// a single scope OwnedActiveSpanScope should be used. For more complicated scenarios, | ||
// involving multiple threads, time sliced work, etc ActiveSpanScope should be used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an extra comment? (Do you agree with it?)
involving multiple threads, time sliced work, ...
a OwnedSpanScope should be stored as a member in a class, and an ActiveSpanScope used to associate that span with each processing thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jpmcmu that looks good. This will be a really helpful distinction. I think there is one place in esp that should be revisited now these classes exist - I'll create a jira to cover that.
Please squash and I will merge.
…toring - Added ActiveSpanScope to track only current active span - Renamed existing OwnedSpanScope to OwnedActiveSpanScope - Added OwnedSpanScope to control only span lifetime Signed-off-by: James McMullan [email protected]
@ghalliday squashed |
0bb5480
into
hpcc-systems:candidate-9.8.x
Jirabot Action Result: |
Signed-off-by: James McMullan [email protected]
Type of change:
Checklist:
Smoketest:
Testing: