From 6774affcb14b1213925ec2f9c242d4ddb8f1a241 Mon Sep 17 00:00:00 2001
From: Gagan Juneja <gjjuneja@amazon.com>
Date: Mon, 6 May 2024 22:26:56 +0530
Subject: [PATCH] test changes

---
 .../transport/PerformanceAnalyzerTransportChannel.java   | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/opensearch/performanceanalyzer/transport/PerformanceAnalyzerTransportChannel.java b/src/main/java/org/opensearch/performanceanalyzer/transport/PerformanceAnalyzerTransportChannel.java
index 5b564c9f..d9dae89c 100644
--- a/src/main/java/org/opensearch/performanceanalyzer/transport/PerformanceAnalyzerTransportChannel.java
+++ b/src/main/java/org/opensearch/performanceanalyzer/transport/PerformanceAnalyzerTransportChannel.java
@@ -79,12 +79,11 @@ public String getChannelType() {
     @Override
     public void sendResponse(TransportResponse response) throws IOException {
         if (throughputCounter != null) {
-            LOG.info("Updating the counter inside PATransportChannel");
+            long updatedValue = ManagementFactory.getThreadMXBean().getCurrentThreadCpuTime()
+                    - startCpuTimeNanos;
+            LOG.info("Updating the counter inside PATransportChannel {}", updatedValue);
             throughputCounter.add(
-                    Math.max(
-                            ManagementFactory.getThreadMXBean().getCurrentThreadCpuTime()
-                                    - startCpuTimeNanos,
-                            0),
+                    Math.max(updatedValue, 0),
                     Tags.create().addTag("indexName", indexName).addTag("shardId", shardId));
         }
         emitMetricsFinish(null);