-
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-30301 JTrace log output improvements #17792
HPCC-30301 JTrace log output improvements #17792
Conversation
@ghalliday please review. Also, you'll notice new derived class destructors which utilize derived class methods. |
https://track.hpccsystems.com/browse/HPCC-30301 |
Sample JTrace.toString output:
Json Pretty formatted: {
"Type": "Internal",
"Name": "internalSpan2",
"SpanID": "41808b19c7e998b5",
"TraceID": "beca49ca8f3138a2842e5cf21402bfff",
"TraceFlags": "01",
"LocalParentSpan": {
"Type": "Internal",
"Name": "internalSpan",
"SpanID": "51e4dcf79e2ef6c1",
"TraceID": "beca49ca8f3138a2842e5cf21402bfff",
"TraceFlags": "01",
"LocalParentSpan": {
"Type": "Client",
"Name": "clientSpan",
"SpanID": "249295ad39f881ef",
"TraceID": "beca49ca8f3138a2842e5cf21402bfff",
"TraceFlags": "01",
"LocalParentSpan": {
"Type": "Server",
"Name": "propegatedServerSpan",
"HPCCGlobalID": "IncomingUGID",
"HPCCCallerID": "IncomingCID",
"SpanID": "bad8c01118f382c1",
"TraceID": "beca49ca8f3138a2842e5cf21402bfff",
"TraceFlags": "01",
"RemoteParentSpanID": "4b960b3e4647da3f"
}
}
}
} |
system/jlib/jtrace.cpp
Outdated
{ | ||
//Derived class specific behavior such as toString() should be |
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.
A few comments from out discussion - use beforeDispose() instead
system/jlib/jtrace.cpp
Outdated
@@ -348,7 +349,7 @@ class CSpan : public CInterfaceOf<ISpan> | |||
|
|||
StringBuffer out; | |||
toString(out); |
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.
Worth introducing a new toLog() which logs a subset of the information to avoid duplication.
Also a typo in the commit message |
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'm not sure about the second commit. I think you have two different uses for toString() which have very different characteristics.
The first use - which the 1st commit implements well, is to dump out all the information about a span for debugging/programmer tracing.
The second use is to provide the information needed by an external tool (or developer) to process the logs and reconstruct the span structure. That is a different task. For instance:
I would only expect to output the parent spanid, not the grandparents (they can be gathered from earlier log entries) - so it wouldn't nest/recurse.
LocalParentSpan is an internal concept so shouldn't really be in something for external consumption. I would expect "ParentSpan:" on all items which was either an internal span id, or the remote span id for a server span.
That's why I would introduce a different function, rather than overloading the toString() function.
ok, that is all very reasonable, not exactly in line with my takeaway from our offline conversation on this subject, but I'll go ahead and make the changes to meet these expectations. |
@ghalliday please review. |
internalSpan2->toLog {
"Type": "Internal",
"Name": "internalSpan2",
"SpanID": "fe439419be47653a",
"TraceID": "beca49ca8f3138a2842e5cf21402bfff",
"ParentSpanID": "6ab77ef196bcdb11"
} internalSpan2->toString {
"Type": "Internal",
"Name": "internalSpan2",
"SpanID": "fe439419be47653a",
"TraceID": "beca49ca8f3138a2842e5cf21402bfff",
"TraceFlags": "01",
"ParentSpan": {
"Type": "Internal",
"Name": "internalSpan",
"SpanID": "6ab77ef196bcdb11"
}
} |
On reflection, I'm equally happy with a ParentSpanId RemoteSpanId split. The main concern is that it would not recursively expand all the local parents. I'll merge as-is, but I expect to see more changes in this area. For example I think you only need to store globalid/traceid in the server span - which will change what is logged and where (see my second PR for some changes in that direction). |
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 please squash and I will merge. I'll then rebase my changes on top of it.
- Sets output to JSON format - Ensures Parent span output is encapsulated - Adds cppunit test for json output - Utilizes beforeDispose - Introduces leaf/branch toString dynamic output - Exposes public toLog - Provides end-user trace info - Continues to provide developer level toString - Continues to provide nested toString info - Adds toLog unittest - Updates toString unittests - Uses toLog in trace ctr and ~ Signed-off-by: Rodrigo Pastrana <[email protected]>
d8ae653
to
57fe708
Compare
@ghalliday squashed |
cc3d39c
into
hpcc-systems:candidate-9.4.x
Type of change:
Checklist:
Smoketest:
Testing: