-
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-32248 Add tracing to rowservice #19314
base: candidate-9.8.x
Are you sure you want to change the base?
Conversation
Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-32248 Jirabot Action Result: |
@@ -162,6 +162,69 @@ static ISecureSocket *createSecureSocket(ISocket *sock, bool disableClientCertVe | |||
} | |||
#endif | |||
|
|||
//------------------------------------------------------------------------------ |
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.
ActiveSpanScope is very similar to ThreadedSpanScope described by Gavin here: https://hpccsystems.atlassian.net/jira/software/c/projects/HPCC/issues/HPCC-32982. I liked the name ActiveSpanScope because I believe the class has utility outside of multithreaded contexts, IE: time slicing. Would it be worthwhile to move this out of dafilesrv into jtrace?
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.
yes. These utility changes should be in jlib, ideally as separate PRs/requests. It would be worth merging your other PR, and having a PR that implements an agreed solution to HPCC-32982, and then rebasing this PR on it.
I'm open to discussing what the different classes should be called.
@@ -366,13 +366,31 @@ version: 1.0 | |||
detail: 100 | |||
)!!"; | |||
|
|||
IPropertyTree * loadConfigurationWithGlobalDefault(const char * defaultYaml, Owned<IPropertyTree>& globalConfig, const char * * argv, const char * componentTag, const char * envPrefix) |
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.
This function is similar to work Jake has done in HPCC-32991, might be worthwhile to retarget to master and call the overloaded doLoadConfiguration instead?
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.
yes. Should reuse the from HPCC-32991. If this change are wanted in to 9.8, we could consider cherry-picking back the changed in HPCC-32991 to 9.8.
std::string traceParent = fullTraceContext ? fullTraceContext : ""; | ||
traceParent = traceParent.substr(0,traceParent.find_last_of("-")); | ||
|
||
if (!traceParent.empty() && requestTraceParent != traceParent) |
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.
Note: I am checking if the traceParent has changed every time process is called here because the client side may use multiple spans during the lifetime a single CRemoteRequest. See below screenshots for an example.
- Added opentelemetry tracing to rowservice Signed-off-by: James McMullan [email protected]
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. It would be good to rationalise the helper span scope classes so they cover all the options.
@@ -162,6 +162,69 @@ static ISecureSocket *createSecureSocket(ISocket *sock, bool disableClientCertVe | |||
} | |||
#endif | |||
|
|||
//------------------------------------------------------------------------------ |
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.
yes. These utility changes should be in jlib, ideally as separate PRs/requests. It would be worth merging your other PR, and having a PR that implements an agreed solution to HPCC-32982, and then rebasing this PR on it.
I'm open to discussing what the different classes should be called.
const char* fullTraceContext = requestTree->queryProp("_trace/traceparent"); | ||
|
||
// We only want to compare the trace-id & span-id, so remove the last "sampling" group | ||
std::string traceParent = fullTraceContext ? fullTraceContext : ""; |
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: You can use strrchr on the const char * to avoid cloning the string. Alternatively use std::string_view and assign to a new string.
{ | ||
// Check to see if we have an existing span that needs to be closed out, this can happen | ||
// when the span parent changes on the client side | ||
if (requestSpan != nullptr) |
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.
This should be automatic when requestSpan is cleared. That would come if the changes in HPCC-32982 are implemented. Possibly requires a boolean to indicate success..
Owned<IProperties> traceHeaders = createProperties(); | ||
traceHeaders->setProp("traceparent", fullTraceContext); | ||
|
||
std::string requestSpanName; |
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 efficiency: use a const char * and avoid a string being cloned.
if (traceParent != nullptr) | ||
{ | ||
Owned<IProperties> traceHeaders = createProperties(); | ||
traceHeaders->setProp("traceparent", traceParent); |
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.
Should this also have the sampling suffix removed?
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 - please see comments.
//------------------------------------------------------------------------------ | ||
// ActiveSpanScope Design Notes: | ||
//------------------------------------------------------------------------------ | ||
// ActiveSpanScope updates the threadActiveSpan when it is intstantiated |
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.
intstantiated -> instantiated
if (0 == cursorHandle) | ||
throw createDafsException(DAFSERR_cmdstream_protocol_failure, "cursor handle not supplied to 'close' command"); | ||
{ | ||
IException* exception = createDafsException(DAFSERR_cmdstream_protocol_failure, "cursor handle not supplied to 'close' command"); |
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.
this should be changed to : IDAFS_Exception* exception = createDafsException..
otherwise the throw exception (of an IException) will not be caught by catch (IDAFS_Exception *e) handlers.
Owned<IPropertyTree> env = getHPCCEnvironment(); | ||
IPropertyTree* globalTracing = env->queryPropTree("Software/tracing"); | ||
if (globalTracing != nullptr) | ||
extractedGlobalConfig->addPropTree("tracing", globalTracing); |
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 think this should be LINK(globalTracing) (or env->getPropTree)
#endif | ||
|
||
// NB: bare-metal dafilesrv does not have a component specific xml, extracting relevant global configuration instead | ||
Owned<IPropertyTree> config = loadConfigurationWithGlobalDefault(defaultYaml, extractedGlobalConfig, argv, "dafilesrv", "DAFILESRV"); |
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.
instead of new function/adding to global, could you add 'tracing' to the component config instead?
e.g.:
#ifndef _CONTAINERIZED
Owned<IPropertyTree> env = getHPCCEnvironment();
IPropertyTree* tracing = env->getPropTree("Software/tracing");
if (tracing)
config->setPropTree("tracing", tracing);
#endif
(and combine with #else // __CONTAINERIZED block below)
Signed-off-by: James McMullan [email protected]
Type of change:
Checklist:
Smoketest:
Testing: