-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[CURATOR-695] Open Telemetry tracing #494
base: master
Are you sure you want to change the base?
Conversation
This changes adds an Open Telemetry tracing driver. To make this more effective, it also decomposes OperationTrace events so that the start and end of the event can be managed separately.
This changes adds an Open Telemetry tracing driver. To make this more effective, it also decomposes OperationTrace events so that the start and end of the event can be managed separately.
Co-authored-by: shenjianeng <[email protected]>
Any thoughts on how this looks @eolivelli ? |
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.
Nice work.
I left some comment about files that we don't need.
Apart from that I think it is better to also add a test case that uses some basic curator functions and verify that otel tracks them
curator-drivers/LICENSE
Outdated
@@ -0,0 +1,202 @@ | |||
|
|||
Apache License |
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.
We don't need this file
curator-drivers/NOTICE
Outdated
@@ -0,0 +1,5 @@ | |||
Apache Curator |
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.
We don't need this file
@@ -0,0 +1,202 @@ | |||
|
|||
Apache License |
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.
No need for this file
@@ -0,0 +1,5 @@ | |||
Apache Curator |
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.
No need
<dependency> | ||
<groupId>org.apache.curator</groupId> | ||
<artifactId>curator-client</artifactId> | ||
<version>${project.version}</version> |
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 at scope 'provided'
@@ -0,0 +1,5 @@ | |||
Apache Curator |
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.
The target directory must not be committed
Signed-off-by: tison <[email protected]>
This changes adds an Open Telemetry tracing driver. To make this more effective, it also decomposes OperationTrace events so that the start and end of the event can be managed separately.
# Conflicts: # curator-client/src/main/java/org/apache/curator/drivers/OperationTrace.java # curator-drivers/open-telemetry/pom.xml # curator-drivers/open-telemetry/src/main/java/org/apache/curator/drivers/opentelemetry/OpenTelemetryTracingDriver.java # curator-drivers/pom.xml
@@ -26,11 +26,11 @@ | |||
<parent> | |||
<groupId>org.apache.curator</groupId> | |||
<artifactId>apache-curator</artifactId> | |||
<version>5.5.1-SNAPSHOT</version> | |||
<version>5.6.1-SNAPSHOT</version> |
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.
we should bump the version in a separate commit, can you please revert ?
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.
Overall LGTM
but please revert the change to the pom versions
I have asked for review on the mailing list |
also please check CI |
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 like the direction and attach my comments inline.
*/ | ||
public abstract void addTrace(OperationTrace trace); | ||
public abstract Object startTrace(OperationTrace 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.
It would be better to introduce a new sub-class/sub-interface of TracerDriver
so we won't break third-party usage of AdvancedTracerDriver
.
} | ||
// We will close this in endTrace | ||
@SuppressWarnings("MustBeClosedChecker") | ||
Scope scope = span.makeCurrent(); |
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.
Curator invokes callbacks asynchronously.
The timing of callback invocation is indeterministic. Span::makeCurrent
in startTrace
and Scope::close
in endTrace
probably will not form try-with-resources as suggested in javadoc of Span::makeCurrent
.
Also, endTrace
is probably not invoked in thread where startTrace
called as far as I known. Given CuratorFramework::getChildren
as an example, startTrace
is invoked in Curator threads while endTrace
is invoked in ZooKeeper thread.
Since startTrace
and endTrace
are the only interceptions, I think we can drop scope
/context
propagation here.
); | ||
} | ||
|
||
span.setAttribute(LATENCY_MS_ATTRIBUTE, trace.getRequestBytesLength()); |
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 be trace.getLatencyMs()
?
This changes adds an Open Telemetry tracing driver. To make this more effective, it also decomposes
OperationTrace
events so that the start and end of the event can be handled distinctly.Curator's
OperationTraces
are mapped to OTelSpans
. When anOperationTrace
is started (created), a corresponding OTel span is started and made current. The span is closed when theOperationTrace
is committed.OperationTrace
members are mapped to OTel span attributes, and result codes are mapped to appropriate OTel representations.Any Curator
EventTraces
are attributed to the current OTel span.