This is an automated email from the ASF dual-hosted git repository.
kturner pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push:
new bd9e67637c Fixes class name in trace data (#5361)
bd9e67637c is described below
commit bd9e67637c3ecc9e8a4e8d1ffbee26b8e7e84370
Author: Keith Turner <[email protected]>
AuthorDate: Fri Feb 28 10:29:36 2025 -0500
Fixes class name in trace data (#5361)
Trace data for RPCs would include an empty string for the class name
because TraceProtocolFactory created an anonymous class. Changed to use
a named class to make linking trace data to code easier.
---
.../accumulo/core/rpc/TraceProtocolFactory.java | 43 +++++++++++++---------
1 file changed, 25 insertions(+), 18 deletions(-)
diff --git
a/core/src/main/java/org/apache/accumulo/core/rpc/TraceProtocolFactory.java
b/core/src/main/java/org/apache/accumulo/core/rpc/TraceProtocolFactory.java
index e7466c62e9..de8e0d7bf0 100644
--- a/core/src/main/java/org/apache/accumulo/core/rpc/TraceProtocolFactory.java
+++ b/core/src/main/java/org/apache/accumulo/core/rpc/TraceProtocolFactory.java
@@ -35,25 +35,32 @@ import io.opentelemetry.context.Scope;
public class TraceProtocolFactory extends TCompactProtocol.Factory {
private static final long serialVersionUID = 1L;
+ private static class TraceProtocol extends TCompactProtocol {
+
+ private Span span = null;
+ private Scope scope = null;
+
+ public TraceProtocol(TTransport transport) {
+ super(transport);
+ }
+
+ @Override
+ public void writeMessageBegin(TMessage message) throws TException {
+ span = TraceUtil.startClientRpcSpan(this.getClass(), message.name);
+ scope = span.makeCurrent();
+ super.writeMessageBegin(message);
+ }
+
+ @Override
+ public void writeMessageEnd() throws TException {
+ super.writeMessageEnd();
+ scope.close();
+ span.end();
+ }
+ }
+
@Override
public TProtocol getProtocol(TTransport trans) {
- return new TCompactProtocol(trans) {
- private Span span = null;
- private Scope scope = null;
-
- @Override
- public void writeMessageBegin(TMessage message) throws TException {
- span = TraceUtil.startClientRpcSpan(this.getClass(), message.name);
- scope = span.makeCurrent();
- super.writeMessageBegin(message);
- }
-
- @Override
- public void writeMessageEnd() throws TException {
- super.writeMessageEnd();
- scope.close();
- span.end();
- }
- };
+ return new TraceProtocol(trans);
}
}