-
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-32691 Add optional timestamp arg to createClientSpan() #18969
HPCC-32691 Add optional timestamp arg to createClientSpan() #18969
Conversation
@rpastrana here are my quick changes to be able to call createClientSpan() with a starting timestamp so that we can time something and if that time exceeds a threshold we then create the span. |
I am using this code via -
|
@rpastrana - Should I create a real Pull Request for this ? |
@mckellyln yes let's move forward with this. |
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.
@mckellyln seems fine, consider extending feature to createInternal. Also, should add unittets:
class JlibTraceTest : public CppUnit::TestFixture |
system/jlib/jtrace.cpp
Outdated
@@ -557,7 +557,7 @@ class CSpan : public CInterfaceOf<ISpan> | |||
return spanID.get(); | |||
} | |||
|
|||
ISpan * createClientSpan(const char * name) override; | |||
ISpan * createClientSpan(const char * name, const SpanTimeStamp * spanStartTimeStamp = nullptr) override; | |||
ISpan * createInternalSpan(const char * name) override; |
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 optional spansparttime to createInternalSpan as well?
system/jlib/jtrace.cpp
Outdated
: CChildSpan(spanName, parent) | ||
{ | ||
if (spanStartTimeStamp && spanStartTimeStamp->isInitialized()) |
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.
if we add the starttime option to internal, it might make sense to move this to CChildSpan?
a46d622
to
4a01adf
Compare
8afcaa6
to
efa28e8
Compare
e6f0432
to
8aebdec
Compare
@rpastrana I've updated PR and added a test case. |
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.
@mckellyln looks good, but a couple of questions re: unittests
testing/unittests/jlibtests.cpp
Outdated
@@ -482,11 +483,33 @@ class JlibTraceTest : public CppUnit::TestFixture | |||
CPPUNIT_ASSERT_MESSAGE("Mismatched localParentSpanID detected", | |||
strsame(serverSpanID, retrievedSpanCtxAttributes->queryProp("localParentSpanID"))); | |||
|
|||
CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected missing remoteParentID detected", true, | |||
retrievedSpanCtxAttributes->hasProp("remoteParentID")); | |||
CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected GlobalID detected", false, |
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.
some of these changes seem unrelated.
testing/unittests/jlibtests.cpp
Outdated
unsigned startMs = msTick() - 1234; | ||
SpanTimeStamp SpanTS; | ||
SpanTS.setMSTickTime(startMs); | ||
OwnedSpanScope clientSpan = serverSpan->createClientSpan("clientSpan", &SpanTS); |
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.
L:503 exercises the new constructor signature, but the bulk of this test seems unrelated to the functionality we want to test which is the span's manually declared start time. I think manualTestsDeclaredSpanStartTime could be used as a template to test this new functionality
8aebdec
to
b9aa7e6
Compare
I am not sure how to get unittest output into OTEL collector |
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.
@mckellyln looks good, but I'm left wondering if there's enough in the manual test to confirm the feature worked as expected.
@@ -231,6 +231,11 @@ class JlibTraceTest : public CppUnit::TestFixture | |||
OwnedSpanScope serverSpan = queryTraceManager().createServerSpan("declaredSpanStartTime", emptyMockHTTPHeaders, &declaredSpanStartTime); | |||
//{ "type": "span", "name": "declaredSpanStartTime", "trace_id": "0a2eff24e1996540056745aaeb2f5824", "span_id": "46d0faf8b4da893e", | |||
//"start": 1702672311203213259, "duration": 125311051 } | |||
|
|||
SpanTimeStamp clientSpanTimeStamp; |
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.
were you able to confirm the start time was adjusted as expected?
We're not able to automatically validate these values (yet) but the log output should match your expected start time (we might need to printout clientSpanTimeStamp.
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, I added the comments for the jlog Span output
Right now we're dependent on visual inspection of the log output |
c084788
to
3d612b0
Compare
Signed-off-by: M Kelly <[email protected]>
3d612b0
to
ebd3d33
Compare
Added jlog output as comments to help verify output is expected. |
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.
@mckellyln approved
Thanks so much. |
Type of change:
Checklist:
Smoketest:
Testing: