You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2023/08/29 21:54:17 UTC

[sling-org-apache-sling-commons-threads] 01/01: SLING-12013 - Commons Threads exports invalid 'Pid' attribute as gauge

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

rombert pushed a commit to branch issue/SLING-12013
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-threads.git

commit f7a35abbe7fb8c73208a89f7caa134b4cb576a0e
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Aug 29 23:53:54 2023 +0200

    SLING-12013 - Commons Threads exports invalid 'Pid' attribute as gauge
    
    Don't expose 'Pid' as a gauge.
---
 .../apache/sling/commons/threads/impl/ThreadPoolMetricsGauges.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/sling/commons/threads/impl/ThreadPoolMetricsGauges.java b/src/main/java/org/apache/sling/commons/threads/impl/ThreadPoolMetricsGauges.java
index 96e892f..2b6f0d7 100644
--- a/src/main/java/org/apache/sling/commons/threads/impl/ThreadPoolMetricsGauges.java
+++ b/src/main/java/org/apache/sling/commons/threads/impl/ThreadPoolMetricsGauges.java
@@ -16,7 +16,7 @@
  */
 package org.apache.sling.commons.threads.impl;
 
-import java.util.Collections;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -33,9 +33,10 @@ class ThreadPoolMetricsGauges {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(ThreadPoolMetricsGauges.class);
 
-    // not exposing MaxThreadAge as bean.getMaxThreadAge() is deprecated due
+    // 1. not exposing MaxThreadAge as bean.getMaxThreadAge() is deprecated due
     // to SLING-6261 and always returns -1
-    private static final List<String> IGNORED_ATTRIBUTES = Collections.singletonList("MaxThreadAge");
+    // 2. not exposing Pid as it's many times empty and breaks exporting metrics, see SLING-12013
+    private static final List<String> IGNORED_ATTRIBUTES = Arrays.asList("MaxThreadAge", "Pid");
 
     private static final Map<Class<?>, Class<?>> WRAPPER_TO_PRIMITIVE = new HashMap<>();