This is an automated email from the ASF dual-hosted git repository.

yashmayya pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 0b5600db25 Add null checks when sampling thread resource usage. 
(#15069)
0b5600db25 is described below

commit 0b5600db25b730329b74416a22ea24076fefe8e6
Author: Rajat Venkatesh <[email protected]>
AuthorDate: Tue Feb 18 10:17:41 2025 +0530

    Add null checks when sampling thread resource usage. (#15069)
---
 .../core/accounting/PerQueryCPUMemAccountantFactory.java      | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git 
a/pinot-core/src/main/java/org/apache/pinot/core/accounting/PerQueryCPUMemAccountantFactory.java
 
b/pinot-core/src/main/java/org/apache/pinot/core/accounting/PerQueryCPUMemAccountantFactory.java
index 614bb8ff85..7052b077f6 100644
--- 
a/pinot-core/src/main/java/org/apache/pinot/core/accounting/PerQueryCPUMemAccountantFactory.java
+++ 
b/pinot-core/src/main/java/org/apache/pinot/core/accounting/PerQueryCPUMemAccountantFactory.java
@@ -278,8 +278,9 @@ public class PerQueryCPUMemAccountantFactory implements 
ThreadAccountantFactory
      */
     @SuppressWarnings("ConstantConditions")
     public void sampleThreadCPUTime() {
-      if (_isThreadCPUSamplingEnabled) {
-        _threadLocalEntry.get()._currentThreadCPUTimeSampleMS = 
getThreadResourceUsageProvider().getThreadTimeNs();
+      ThreadResourceUsageProvider provider = getThreadResourceUsageProvider();
+      if (_isThreadCPUSamplingEnabled && provider != null) {
+        _threadLocalEntry.get()._currentThreadCPUTimeSampleMS = 
provider.getThreadTimeNs();
       }
     }
 
@@ -289,9 +290,9 @@ public class PerQueryCPUMemAccountantFactory implements 
ThreadAccountantFactory
      */
     @SuppressWarnings("ConstantConditions")
     public void sampleThreadBytesAllocated() {
-      if (_isThreadMemorySamplingEnabled) {
-        _threadLocalEntry.get()._currentThreadMemoryAllocationSampleBytes
-            = getThreadResourceUsageProvider().getThreadAllocatedBytes();
+      ThreadResourceUsageProvider provider = getThreadResourceUsageProvider();
+      if (_isThreadMemorySamplingEnabled && provider != null) {
+        _threadLocalEntry.get()._currentThreadMemoryAllocationSampleBytes = 
provider.getThreadAllocatedBytes();
       }
     }
 


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

Reply via email to