-
Notifications
You must be signed in to change notification settings - Fork 307
HPCC-32372 Support tracing from testsocket #19613
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-32372 Support tracing from testsocket #19613
Conversation
Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-32372 Jirabot Action Result: |
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.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
3bd2f8c
to
3a0e4b1
Compare
Disclaimer, if custom JTrace configuration is provided, we should expect JLOG output akin to this: and also, potential OTel export debug info such as: Also, if debug build, Jtrace log exporter will be automatically enabled and will generate output such as: Also, the preexisting "trace" file will contain the resulting trace id |
@mckellyln please review |
Sample program args: |
tools/testsocket/testsocket.cpp
Outdated
} | ||
else if (strieq(argv[arg], "-ctc")) | ||
{ | ||
tracingConfig.set(argv[++arg]); |
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.
good to check if ++arg doesnt >= argc, but we dont check that everywhere above like we should.
tools/testsocket/testsocket.cpp
Outdated
@@ -619,8 +623,19 @@ int doSendQuery(const char * ip, unsigned port, const char * base) | |||
newQuery.appendf("</%sRequest></Body></Envelope>", queryName); | |||
base = newQuery.str(); | |||
} | |||
|
|||
StringBuffer tpHeader; | |||
Owned<IProperties> retrievedClientHeaders = createProperties(); |
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 move to inside the if below, since retrievedClientHeaders is only used in the if block ?
Doesnt really make a difference tho.
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.
Approved.
Just one small comment.
Good to squash.
2758cb0
to
4863882
Compare
Suggested change incorporated, and squashed. |
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.
@rpastrana Looks useful. A couple of trivial comments, one suggestion for a simpler implementation and a couple of leaks.
tools/testsocket/testsocket.cpp
Outdated
|
||
if (retrievedClientHeaders->hasProp("traceparent")) | ||
{ | ||
//disassemble xml in oder to inject _trace header |
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.
typo: order
tools/testsocket/testsocket.cpp
Outdated
ForEach(*traceElemets) | ||
{ | ||
IPTree &traceHeaderElem = traceElemets->query(); | ||
if (strcmp(traceHeaderElem.queryName(), "traceparent") != 0) //if not _trace |
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.
comment references the wrong label.
tools/testsocket/testsocket.cpp
Outdated
|
||
fullQuery.setf("<%s><_trace><traceparent>%s</traceparent>", queryName, retrievedClientHeaders->queryProp("traceparent")); | ||
|
||
IPropertyTree * traceHeader = p ->queryPropTree("_trace"); |
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.
Would it work (and be simpler) to code as:
if (traceHeader)
traceHeader->setProp("traceparent", retrievedClientHeaders->queryProp("traceparent");
and then convert the whole property tree to xml again?
tools/testsocket/testsocket.cpp
Outdated
} | ||
else | ||
{ | ||
serverSpan.set(getNullSpan()); |
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 will leak - it should be setown
tools/testsocket/testsocket.cpp
Outdated
|
||
initTraceManager("testsocket", traceConfig, nullptr); | ||
|
||
serverSpan.set(queryTraceManager().createServerSpan("testsocket_server", nullptr)); //can we avoid creating a server span? |
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 will leak, it should be setown
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.
@rpastrana looks good, please squash
IPropertyTree * traceHeader = p ->queryPropTree("_trace"); | ||
|
||
if (traceHeader) | ||
IPropertyTree * traceHeaderTree = fullQueryTree->queryPropTree("_trace"); |
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.
For future, simpler would be
IPropertyTree * traceHeaderTree = ensurePTree(fullQueryTree, "_trace");
traceHeaderTree->setProp("traceparent", retrievedClientHeaders->queryProp("traceparent"));
- Adds testsocket option to generate and propagate OTel based trace context - Adds option to customize JTrace - Tests for valid yaml - Updates usage message Signed-off-by: Rodrigo Pastrana <[email protected]>
683f5a6
to
65b52b6
Compare
commits are squashed. |
Jirabot Action Result: |
Type of change:
Checklist:
Smoketest:
Testing: