sumitagrawl commented on code in PR #11993:
URL: https://github.com/apache/ozone/pull/11993#discussion_r4643838719


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/tracing/TracingUtil.java:
##########
@@ -623,6 +623,20 @@ public static void addAttributesToCurrentSpan(String key, 
boolean value) {
     }
   }
 
+  /** Adds each audit param as {@code ozone.audit.<key>}, truncating long 
values; same key overwrites. */
+  public static void addAuditParamsToCurrentSpan(Map<String, String> 
auditParams) {
+    Span span = Span.current();
+    if (auditParams == null || !span.isRecording()) {
+      return;
+    }
+    auditParams.forEach((key, value) -> {
+      if (value != null) {
+        span.setAttribute(AUDIT_ATTRIBUTE_PREFIX + key,

Review Comment:
   since attribute is added within span, AUDIT_ATTRIBUTE_PREFIX is not required 
as prefix



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHAManagerImpl.java:
##########
@@ -88,7 +89,8 @@ public SCMHAManagerImpl(final ConfigurationSource conf,
     this.scm = scm;
     this.exitManager = new ExitManager();
     this.transactionBuffer = new SCMHADBTransactionBufferImpl(scm);
-    this.ratisServer = new SCMRatisServerImpl(conf, scm, transactionBuffer);
+    this.ratisServer = TracingUtil.createInternalProxy(new 
SCMRatisServerImpl(conf, scm, transactionBuffer),

Review Comment:
   we can remove proxy from here, add span to submit() method



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMStateMachine.java:
##########
@@ -189,6 +193,14 @@ public void initialize(RaftServer server, RaftGroupId id,
     });
   }
 
+  @Override
+  public TransactionContext startTransaction(RaftClientRequest request) throws 
IOException {

Review Comment:
   we can remove startTransaction()



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMBlockProtocolServer.java:
##########
@@ -142,7 +143,8 @@ public SCMBlockProtocolServer(OzoneConfiguration conf,
     BlockingService blockProtoPbService =
         ScmBlockLocationProtocolProtos.ScmBlockLocationProtocolService
             .newReflectiveBlockingService(
-                new ScmBlockLocationProtocolServerSideTranslatorPB(this, scm,
+                new ScmBlockLocationProtocolServerSideTranslatorPB(
+                    TracingUtil.createInternalProxy(this, 
ScmBlockLocationProtocol.class, conf), scm,

Review Comment:
   we do not need proxy here



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java:
##########
@@ -171,7 +171,8 @@ public SCMClientProtocolServer(OzoneConfiguration conf,
     // SCM Container Service RPC
     BlockingService storageProtoPbService =
         newReflectiveBlockingService(
-            new StorageContainerLocationProtocolServerSideTranslatorPB(this,
+            new StorageContainerLocationProtocolServerSideTranslatorPB(
+                TracingUtil.createInternalProxy(this, 
StorageContainerLocationInternalInterface.class, conf),

Review Comment:
   creating proxy for SCMClientProtocolServer, have many methods, but all may 
not be required.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/WritableContainerFactory.java:
##########
@@ -43,20 +44,20 @@ public class WritableContainerFactory {
   public WritableContainerFactory(StorageContainerManager scm) {
     ConfigurationSource conf = scm.getConfiguration();
 
-    this.ratisProvider = new WritableRatisContainerProvider(
+    this.ratisProvider = TracingUtil.createInternalProxy(new 
WritableRatisContainerProvider(

Review Comment:
   we can remove proxy for WritableRatisContainerProvider, but span can be 
added only in case where its creating Pipeline in deep flow.



##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/tracing/TracingUtil.java:
##########
@@ -623,6 +623,20 @@ public static void addAttributesToCurrentSpan(String key, 
boolean value) {
     }
   }
 
+  /** Adds each audit param as {@code ozone.audit.<key>}, truncating long 
values; same key overwrites. */
+  public static void addAuditParamsToCurrentSpan(Map<String, String> 
auditParams) {

Review Comment:
   let the method name be addParamsToCurrentSpan() removing audit keywork and 
local var with audit also, can be removed



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java:
##########
@@ -823,7 +824,8 @@ private void initializeSystemManagers(OzoneConfiguration 
conf,
     if (configurator.getScmBlockManager() != null) {
       scmBlockManager = configurator.getScmBlockManager();
     } else {
-      scmBlockManager = new BlockManagerImpl(conf, scmConfig, this);
+      scmBlockManager = TracingUtil.createInternalProxy(new 
BlockManagerImpl(conf, scmConfig, this),

Review Comment:
   we do not need proxy here



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java:
##########
@@ -164,13 +166,17 @@ public AllocatedBlock allocateBlock(final long size,
         size, replicationConfig, owner, excludeList);
 
     if (containerInfo != null) {
+      
TracingUtil.addAttributesToCurrentSpan(ScmTracingAttributes.HDDS_CONTAINER_ID, 
containerInfo.getContainerID());

Review Comment:
   we can remove add attributes here, as its available in audit already



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to