-
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-30401 JTrace should optionally suppress trace/span ids generation #17935
HPCC-30401 JTrace should optionally suppress trace/span ids generation #17935
Conversation
https://track.hpccsystems.com/browse/HPCC-30401 |
@ghalliday it wasn't clear exactly when we wanted to force traceids. This PR is not complete but wanted to get in synch with you before spending any more time down this path... |
@ghalliday sample output from first commit doesn't make much sense. Hoping 2nd commit is closer to your intention.
|
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. A couple of questions.
helm/hpcc/templates/thor.yaml
Outdated
@@ -32,7 +32,7 @@ Pass in dict with root and me | |||
{{- $thorAgentScope := dict "name" .thorAgentName "replicas" .thorAgentReplicas "maxActive" .me.maxGraphs | merge (pick .me "keepJobs") }} | |||
{{- $eclAgentResources := .me.eclAgentResources | default dict -}} | |||
{{- $hthorScope := dict "name" $hthorName "jobMemorySectionName" "eclAgentMemory" | merge (pick .me "multiJobLinger" "maxGraphStartupTime") | merge (dict "resources" (deepCopy $eclAgentResources)) }} | |||
{{- $thorScope := omit .me "eclagent" "thoragent" "hthor" "logging" "env" "eclAgentResources" "eclAgentUseChildProcesses" "eclAgentReplicas" "thorAgentReplicas" "eclAgentType" }} | |||
{{- $thorScope := omit .me "eclagent" "thoragent" "hthor" "logging" "Tracing" "env" "eclAgentResources" "eclAgentUseChildProcesses" "eclAgentReplicas" "thorAgentReplicas" "eclAgentType" }} |
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 be a lower case "tracing"?
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.
definitely, good catch
{ | ||
bool createLocalId = !isEmptyString(hpccGlobalId); | ||
if (createLocalId) | ||
hpccLocalId.set(ln_uid::createUniqueIdString().c_str()); | ||
|
||
auto provider = opentelemetry::trace::Provider::GetTracerProvider(); | ||
//we don't always want to create trace/span IDs |
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.
Does this preserve trace-ids if this flags are 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.
Does this preserve trace-ids if this flags are false?
Good point, opentel remote/local parentSpans won't have a span to associate with...
We use the otel span object to track many attributes including parent trace/span ID, do we care to keep track of them ourselves if !hasMask(flags, SpanFlags::EnsureTraceId) && !queryTraceManager().alwaysCreateTraceIds()
Update, we actually do track
opentelemetry::v1::trace::SpanContext remoteParentSpanCtx and
CSpan * localParentSpan
We just have to ensure tolog/tostring etc draws from these members and not just the span member
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.
removing this comment to avoid confusion
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.
Latest amended commit simply inherits traceID from parent when no parent otel span available:
sample output for no traceID generated mode serverSpan(propagated parent)->clientSpanserverchild->internalSpan->internalSpan2
15:07:40.802583 27843 Span end: {"Type":"Internal","Name":"internalSpan2","TraceID":"beca49ca8f3138a2842e5cf21402bfff","ParentSpanID": ""}
15:07:40.802618 27843 Span end: {"Type":"Internal","Name":"internalSpan","TraceID":"beca49ca8f3138a2842e5cf21402bfff","ParentSpanID": ""}
15:07:40.802628 27843 Span end: {"Type":"Client","Name":"clientSpanserverchild","TraceID":"beca49ca8f3138a2842e5cf21402bfff","ParentSpanID": ""}
15:07:40.802637 27843 Span end: {"Type":"Server","Name":"propegatedServerSpan","GlobalID":"IncomingUGID","CallerID":"IncomingCID","LocalID":"JDbF4xnv7LSWDV4Eug1SpJ","TraceID":"beca49ca8f3138a2842e5cf21402bfff","ParentSpanID":"4b960b3e4647da3f"}
system/jlib/jtrace.cpp
Outdated
@@ -637,6 +638,33 @@ class CServerSpan : public CSpan | |||
opts.parent = remoteParentSpanCtx; | |||
} | |||
} | |||
|
|||
/*if ((!httpHeaders || !httpHeaders->hasProp("traceparent")) && queryTraceManager().alwaysCreateTraceIds()) |
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.
When this is a full PR this should be moved elsewhere.
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.
When this is a full PR this should be moved elsewhere.
I initially assumed this is what we wanted to do in this feature, but quickly realized forcing a remote trace/span ID didn't really make sense but left the commented out block to inspire this conversation...
Do we ever envision forcing a synthetic remote trace/span ID?
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 don't think you ever want to create a synthetic remote id.
I'm not sure why "Feature request somewhat ambiguous" is in the commit. If it is ambiguous it is worth clarifying before creating the PR. |
Because I found the description somewhat ambiguous and the creator was away and this feature was identified as priority. |
2528c90
to
623b1a7
Compare
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 I think this is close, but it isn't quite right yet.
system/jlib/jtrace.cpp
Outdated
@@ -16,7 +16,7 @@ | |||
############################################################################## */ | |||
|
|||
|
|||
|
|||
//#include "opentelemetry/sdk/trace/random_id_generator_factory.h" |
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.
trivial: remove
system/jlib/jtrace.cpp
Outdated
@@ -185,18 +190,19 @@ class CSpan : public CInterfaceOf<ISpan> | |||
if (!isEmptyString(hpccLocalId.get())) | |||
out.append(",\"LocalID\":\"").append(hpccLocalId.get()).append("\""); | |||
|
|||
//traceID not always tied to span object | |||
out.append(",\"TraceID\":\"").append(traceID.get()).append("\""); |
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 check for isEmptyString()
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 I think this question is still relevant
system/jlib/jtrace.cpp
Outdated
@@ -637,6 +638,33 @@ class CServerSpan : public CSpan | |||
opts.parent = remoteParentSpanCtx; | |||
} | |||
} | |||
|
|||
/*if ((!httpHeaders || !httpHeaders->hasProp("traceparent")) && queryTraceManager().alwaysCreateTraceIds()) |
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 don't think you ever want to create a synthetic remote id.
system/jlib/jtrace.cpp
Outdated
//what if tracerName is empty? | ||
auto tracer = provider->GetTracer(tracerName.get()); | ||
//we don't always want to create trace/span IDs | ||
if (hasMask(flags, SpanFlags::EnsureTraceId) || queryTraceManager().alwaysCreateTraceIds()) |
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 doesn't seem quite right. You still want to create a span if a trace-id was provided by the caller. It is only omitted if it is not provided and ids are not created by default.
system/jlib/jtrace.cpp
Outdated
@@ -171,6 +171,11 @@ class CSpan : public CInterfaceOf<ISpan> | |||
return spanID.get(); | |||
} | |||
|
|||
const char * getTraceID() const | |||
{ | |||
return traceID.get(); |
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 shouldn't really be stored for non-server spans, similar to caller and local spans. The span class structure would benefit from some refactoring (but as a separate PR)
623b1a7
to
2d5d45b
Compare
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 one question comment, but otherwise it looks ready to merge.
system/jlib/jtrace.cpp
Outdated
@@ -185,18 +190,19 @@ class CSpan : public CInterfaceOf<ISpan> | |||
if (!isEmptyString(hpccLocalId.get())) | |||
out.append(",\"LocalID\":\"").append(hpccLocalId.get()).append("\""); | |||
|
|||
//traceID not always tied to span object | |||
out.append(",\"TraceID\":\"").append(traceID.get()).append("\""); |
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 I think this question is still relevant
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 rebase. Thanks.
e1c7fba
to
0668208
Compare
@rpastrana unfortunately needs rebasing again because I merged your other test. |
0668208
to
2806c9f
Compare
Rebased, but yes, the introduction of the create
Rebased. Initially, disabled would suppress configuration of Otel's tracer(span processor/exporter, etc), and thereby avoid all otel trace/span creation/processing/exporting. |
2806c9f
to
07783ea
Compare
@ghalliday this was showing a conflict that shouldn't have been there. After re-rebasing, I manually resolved the conflict. |
@rpastrana the commits are not quite right. I suspect you may need to rebase your branch onto the most recent 9.4.x |
- Copies global.tracing to component helm values - Revises logic to create otel span -- Span created if per-span flag set -- or global/component config flag set -- or serverSpan receives valid remote parent - Adds cppunit (cannot test scenario where no span created yet) Signed-off-by: Rodrigo Pastrana <[email protected]>
21bd30b
to
b8d0e49
Compare
11c0506
into
hpcc-systems:candidate-9.4.x
Type of change:
Checklist:
Smoketest:
Testing: