diff --git a/collector/src/main/java/io/prometheus/jmx/BuildInfoMetrics.java b/collector/src/main/java/io/prometheus/jmx/BuildInfoMetrics.java index 130edb3d..f9a60a58 100755 --- a/collector/src/main/java/io/prometheus/jmx/BuildInfoMetrics.java +++ b/collector/src/main/java/io/prometheus/jmx/BuildInfoMetrics.java @@ -42,6 +42,11 @@ */ public class BuildInfoMetrics { + /** Constructor */ + public BuildInfoMetrics() { + // INTENTIONALLY BLANK + } + /** * Method to register BuildInfoMetrics * diff --git a/collector/src/main/java/io/prometheus/jmx/JmxCollector.java b/collector/src/main/java/io/prometheus/jmx/JmxCollector.java index df22ceb1..f1a3f989 100644 --- a/collector/src/main/java/io/prometheus/jmx/JmxCollector.java +++ b/collector/src/main/java/io/prometheus/jmx/JmxCollector.java @@ -48,13 +48,17 @@ import javax.management.ObjectName; import org.yaml.snakeyaml.Yaml; +/** Class to implement JmxCollector */ @SuppressWarnings("unchecked") public class JmxCollector implements MultiCollector { private static final Logger LOGGER = LoggerFactory.getLogger(JmxCollector.class); + /** Enum to implement Mode */ public enum Mode { + /** Agent mode */ AGENT, + /** Standalone mode */ STANDALONE } @@ -103,10 +107,25 @@ private static class Config { private final JmxMBeanPropertyCache jmxMBeanPropertyCache = new JmxMBeanPropertyCache(); + /** + * Constructor + * + * @param in in + * @throws IOException IOException + * @throws MalformedObjectNameException MalformedObjectNameException + */ public JmxCollector(File in) throws IOException, MalformedObjectNameException { this(in, null); } + /** + * Constructor + * + * @param in in + * @param mode mode + * @throws IOException IOException + * @throws MalformedObjectNameException MalformedObjectNameException + */ public JmxCollector(File in, Mode mode) throws IOException, MalformedObjectNameException { configFile = in; this.mode = mode; @@ -115,20 +134,43 @@ public JmxCollector(File in, Mode mode) throws IOException, MalformedObjectNameE exitOnConfigError(); } + /** + * Constructor + * + * @param yamlConfig yamlConfig + * @throws MalformedObjectNameException MalformedObjectNameException + */ public JmxCollector(String yamlConfig) throws MalformedObjectNameException { config = loadConfig(new Yaml().load(yamlConfig)); mode = null; } + /** + * Constructor + * + * @param inputStream inputStream + * @throws MalformedObjectNameException MalformedObjectNameException + */ public JmxCollector(InputStream inputStream) throws MalformedObjectNameException { config = loadConfig(new Yaml().load(inputStream)); mode = null; } + /** + * Method to register the JmxCollector + * + * @return the JmxCollector + */ public JmxCollector register() { return register(PrometheusRegistry.defaultRegistry); } + /** + * Method to register the JmxCollector + * + * @param prometheusRegistry prometheusRegistry + * @return the JmxCollector + */ public JmxCollector register(PrometheusRegistry prometheusRegistry) { this.prometheusRegistry = prometheusRegistry; diff --git a/collector/src/main/java/io/prometheus/jmx/JmxScraper.java b/collector/src/main/java/io/prometheus/jmx/JmxScraper.java index 8a6c0ef8..16f00b82 100644 --- a/collector/src/main/java/io/prometheus/jmx/JmxScraper.java +++ b/collector/src/main/java/io/prometheus/jmx/JmxScraper.java @@ -50,11 +50,25 @@ import javax.naming.Context; import javax.rmi.ssl.SslRMIClientSocketFactory; +/** Class to implement JmxScraper */ class JmxScraper { private static final Logger LOGGER = LoggerFactory.getLogger(JmxScraper.class); + /** Interface to implement MBeanReceiver */ public interface MBeanReceiver { + + /** + * Method to create a bean + * + * @param domain domain + * @param beanProperties beanProperties + * @param attrKeys attrKeys + * @param attrName attrName + * @param attrType attrType + * @param attrDescription attrDescription + * @param value value + */ void recordBean( String domain, LinkedHashMap beanProperties, @@ -74,6 +88,19 @@ void recordBean( private final ObjectNameAttributeFilter objectNameAttributeFilter; private final JmxMBeanPropertyCache jmxMBeanPropertyCache; + /** + * Constructor + * + * @param jmxUrl jmxUrl + * @param username username + * @param password password + * @param ssl ssl + * @param includeObjectNames includeObjectNames + * @param excludeObjectNames excludeObjectNames + * @param objectNameAttributeFilter objectNameAttributeFilter + * @param receiver receiver + * @param jmxMBeanPropertyCache jmxMBeanPropertyCache + */ public JmxScraper( String jmxUrl, String username, diff --git a/collector/src/main/java/io/prometheus/jmx/MatchedRule.java b/collector/src/main/java/io/prometheus/jmx/MatchedRule.java index fbef982b..774973b4 100644 --- a/collector/src/main/java/io/prometheus/jmx/MatchedRule.java +++ b/collector/src/main/java/io/prometheus/jmx/MatchedRule.java @@ -49,6 +49,18 @@ private MatchedRule() { this.valueFactor = 1.0; } + /** + * Constructor + * + * @param name name + * @param matchName matchName + * @param type type + * @param help help + * @param labelNames labelNames + * @param labelValues labelValues + * @param value value + * @param valueFactor valueFactor + */ public MatchedRule( final String name, final String matchName, @@ -68,6 +80,12 @@ public MatchedRule( this.valueFactor = valueFactor; } + /** + * Method to create a MatchedRule with a value + * + * @param value value + * @return a MatchedRule with a value + */ public MatchedRule withValue(double value) { return new MatchedRule( PrometheusNaming.sanitizeMetricName(this.name), @@ -91,10 +109,20 @@ public static MatchedRule unmatched() { return _unmatched; } + /** + * Method to return if the rule is unmatched + * + * @return true if unmatched, else false + */ public boolean isUnmatched() { return this == _unmatched; } + /** + * Method to return if the rule is matched + * + * @return true if matched, else false + */ public boolean isMatched() { return !isUnmatched(); } diff --git a/collector/src/main/java/io/prometheus/jmx/MatchedRuleToMetricSnapshotsConverter.java b/collector/src/main/java/io/prometheus/jmx/MatchedRuleToMetricSnapshotsConverter.java index 731bab4c..2cfe809b 100644 --- a/collector/src/main/java/io/prometheus/jmx/MatchedRuleToMetricSnapshotsConverter.java +++ b/collector/src/main/java/io/prometheus/jmx/MatchedRuleToMetricSnapshotsConverter.java @@ -32,6 +32,7 @@ import java.util.Set; import java.util.logging.Level; +/** Class to implement MatchedRuleToMetricSnapshotsConverter */ public class MatchedRuleToMetricSnapshotsConverter { private static final Logger LOGGER = @@ -39,6 +40,17 @@ public class MatchedRuleToMetricSnapshotsConverter { private static final String OBJECTNAME = "_objectname"; + /** Constructor */ + public MatchedRuleToMetricSnapshotsConverter() { + // INTENTIONALLY BLANK + } + + /** + * Method to convert a List of MatchedRules to MetricSnapshots + * + * @param matchedRules matchedRules + * @return a MetricSnapshots + */ public static MetricSnapshots convert(List matchedRules) { Map> rulesByPrometheusMetricName = new HashMap<>(); diff --git a/collector/src/main/java/io/prometheus/jmx/MatchedRulesCache.java b/collector/src/main/java/io/prometheus/jmx/MatchedRulesCache.java index 213799c0..c1d2225c 100644 --- a/collector/src/main/java/io/prometheus/jmx/MatchedRulesCache.java +++ b/collector/src/main/java/io/prometheus/jmx/MatchedRulesCache.java @@ -29,8 +29,14 @@ * pattern) to avoid matching against the same pattern in later bean collections. */ public class MatchedRulesCache { + private final Map> cachedRules; + /** + * Constructor + * + * @param rules rules + */ public MatchedRulesCache(Collection rules) { this.cachedRules = new HashMap<>(rules.size()); for (JmxCollector.Rule rule : rules) { @@ -38,17 +44,36 @@ public MatchedRulesCache(Collection rules) { } } + /** + * Method to put a matched rule in the cache + * + * @param rule rule + * @param cacheKey cacheKey + * @param matchedRule matchedRule + */ public void put( final JmxCollector.Rule rule, final String cacheKey, final MatchedRule matchedRule) { Map cachedRulesForRule = cachedRules.get(rule); cachedRulesForRule.put(cacheKey, matchedRule); } + /** + * Method to get a MatchedRule from the cache + * + * @param rule rule + * @param cacheKey cacheKey + * @return the MatchedRule + */ public MatchedRule get(final JmxCollector.Rule rule, final String cacheKey) { return cachedRules.get(rule).get(cacheKey); } - // Remove stale rules (in the cache but not collected in the last run of the collector) + /** + * Method to remove stale rules (in the cache but not collected in the last run of the + * collector) + * + * @param stalenessTracker stalenessTracker + */ public void evictStaleEntries(final StalenessTracker stalenessTracker) { for (Map.Entry> entry : cachedRules.entrySet()) { @@ -63,21 +88,46 @@ public void evictStaleEntries(final StalenessTracker stalenessTracker) { } } + /** Class to implement StalenessTracker */ public static class StalenessTracker { + private final Map> lastCachedEntries = new HashMap<>(); + /** Constructor */ + public StalenessTracker() { + // INTENTIONALLY BLANK + } + + /** + * Method to add a Rule + * + * @param rule rule + * @param cacheKey cacheKey + */ public void add(final JmxCollector.Rule rule, final String cacheKey) { Set lastCachedEntriesForRule = lastCachedEntries.computeIfAbsent(rule, k -> new HashSet<>()); lastCachedEntriesForRule.add(cacheKey); } + /** + * Method to return if a Rule is stale + * + * @param rule rule + * @param cacheKey cacheKey + * @return true if the stale, else false + */ public boolean contains(final JmxCollector.Rule rule, final String cacheKey) { Set lastCachedEntriesForRule = lastCachedEntries.get(rule); return (lastCachedEntriesForRule != null) && lastCachedEntriesForRule.contains(cacheKey); } + /** + * Method to get the count of stale rules + * + * @return the count of stale rules + */ public long cachedCount() { long count = 0; for (Set cacheKeys : lastCachedEntries.values()) { diff --git a/collector/src/main/java/io/prometheus/jmx/ObjectNameAttributeFilter.java b/collector/src/main/java/io/prometheus/jmx/ObjectNameAttributeFilter.java index 78f7c7e3..335b52cd 100644 --- a/collector/src/main/java/io/prometheus/jmx/ObjectNameAttributeFilter.java +++ b/collector/src/main/java/io/prometheus/jmx/ObjectNameAttributeFilter.java @@ -34,9 +34,10 @@ public class ObjectNameAttributeFilter { private static final Logger LOGGER = LoggerFactory.getLogger(ObjectNameAttributeFilter.class); - /** Configuration constant to define a mapping of ObjectNames to attribute names */ + /** Configuration constant to define a mapping of ObjectNames to attribute names to exclude */ public static final String EXCLUDE_OBJECT_NAME_ATTRIBUTES = "excludeObjectNameAttributes"; + /** Configuration constant to define a mapping of ObjectNames to attribute names to include */ public static final String INCLUDE_OBJECT_NAME_ATTRIBUTES = "includeObjectNameAttributes"; /** Configuration constant to enable auto ObjectName attributes filtering */ @@ -172,6 +173,13 @@ private boolean exclude( return result; } + /** + * Method to return whether an attribute should be included + * + * @param objectName objectName + * @param attributeName attributeName + * @return true if the attribute should be included, else false + */ public boolean include(ObjectName objectName, String attributeName) { boolean result = false; @@ -183,6 +191,11 @@ public boolean include(ObjectName objectName, String attributeName) { return result; } + /** + * Method to return whether any attributes are included + * + * @return true if empty, else false + */ public boolean includeObjectNameAttributesIsEmpty() { return includeObjectNameAttributesMap.isEmpty(); } diff --git a/collector/src/main/java/io/prometheus/jmx/logger/LoggerFactory.java b/collector/src/main/java/io/prometheus/jmx/logger/LoggerFactory.java index 4f42f58b..3656ffc6 100644 --- a/collector/src/main/java/io/prometheus/jmx/logger/LoggerFactory.java +++ b/collector/src/main/java/io/prometheus/jmx/logger/LoggerFactory.java @@ -21,7 +21,7 @@ public class LoggerFactory { /** Constructor */ private LoggerFactory() { - // DO NOTHING + // INTENTIONALLY BLANK } /** diff --git a/collector/src/test/java/io/prometheus/jmx/TotalValueMBean.java b/collector/src/test/java/io/prometheus/jmx/TotalValueMBean.java index 99eb94e8..1d5c72d3 100644 --- a/collector/src/test/java/io/prometheus/jmx/TotalValueMBean.java +++ b/collector/src/test/java/io/prometheus/jmx/TotalValueMBean.java @@ -27,7 +27,7 @@ public interface TotalValueMBean { class TotalValue implements TotalValueMBean { public TotalValue() { - // DO NOTHING + // INTENTIONALLY BLANK } @Override diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/JavaDockerImages.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/JavaDockerImages.java index 6a53cfeb..02a2143c 100644 --- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/JavaDockerImages.java +++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/JavaDockerImages.java @@ -49,7 +49,7 @@ public final class JavaDockerImages { /** Constructor */ private JavaDockerImages() { - // DO NOTHING + // INTENTIONALLY BLANK } /** @@ -117,7 +117,7 @@ private static List load(String resource) { try { bufferedReader.close(); } catch (Throwable t) { - // DO NOTHING + // INTENTIONALLY BLANK } } @@ -125,7 +125,7 @@ private static List load(String resource) { try { inputStream.close(); } catch (Throwable t) { - // DO NOTHING + // INTENTIONALLY BLANK } } } diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/PrometheusDockerImages.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/PrometheusDockerImages.java index 1da29bdb..3f93f9ad 100644 --- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/PrometheusDockerImages.java +++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/PrometheusDockerImages.java @@ -49,7 +49,7 @@ public final class PrometheusDockerImages { /** Constructor */ private PrometheusDockerImages() { - // DO NOTHING + // INTENTIONALLY BLANK } /** @@ -117,7 +117,7 @@ private static List load(String resource) { try { bufferedReader.close(); } catch (Throwable t) { - // DO NOTHING + // INTENTIONALLY BLANK } } @@ -125,7 +125,7 @@ private static List load(String resource) { try { inputStream.close(); } catch (Throwable t) { - // DO NOTHING + // INTENTIONALLY BLANK } } } diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricsParser.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricsParser.java index 43ee7ba3..cc01a917 100644 --- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricsParser.java +++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/metrics/MetricsParser.java @@ -38,7 +38,7 @@ public class MetricsParser { /** Constructor */ private MetricsParser() { - // DO NOTHING + // INTENTIONALLY BLANK } /** @@ -382,7 +382,7 @@ public void close() { try { bufferedReader.close(); } catch (Throwable t) { - // DO NOTHING + // INTENTIONALLY BLANK } bufferedReader = null; diff --git a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/throttle/ExponentialBackoffThrottle.java b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/throttle/ExponentialBackoffThrottle.java index 2bfec6f2..71125730 100644 --- a/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/throttle/ExponentialBackoffThrottle.java +++ b/integration_test_suite/integration_tests/src/main/java/io/prometheus/jmx/test/support/throttle/ExponentialBackoffThrottle.java @@ -58,7 +58,7 @@ public void throttle() { try { Thread.sleep(throttleMilliseconds); } catch (InterruptedException e) { - // DO NOTHING + // INTENTIONALLY BLANK } throttleMilliseconds = throttleMilliseconds * 2; diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/opentelemetry/ExpectedMetricsNames.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/opentelemetry/ExpectedMetricsNames.java index b8e63f5a..9a9e376b 100644 --- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/opentelemetry/ExpectedMetricsNames.java +++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/opentelemetry/ExpectedMetricsNames.java @@ -187,7 +187,7 @@ public class ExpectedMetricsNames { /** Constructor */ private ExpectedMetricsNames() { - // DO NOTHING + // INTENTIONALLY BLANK } /** diff --git a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/support/OpenTelemetryTestEnvironment.java b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/support/OpenTelemetryTestEnvironment.java index 725a7878..9d1dc5bb 100644 --- a/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/support/OpenTelemetryTestEnvironment.java +++ b/integration_test_suite/integration_tests/src/test/java/io/prometheus/jmx/test/support/OpenTelemetryTestEnvironment.java @@ -469,7 +469,7 @@ private static boolean hasResource(String resource) { break; } } catch (Throwable t) { - // DO NOTHING + // INTENTIONALLY BLANK } } diff --git a/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/OptionalValueMBean.java b/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/OptionalValueMBean.java index c587b738..1420608d 100644 --- a/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/OptionalValueMBean.java +++ b/integration_test_suite/jmx_example_application/src/main/java/io/prometheus/jmx/OptionalValueMBean.java @@ -26,7 +26,7 @@ public interface OptionalValueMBean { class OptionalValue implements OptionalValueMBean { public OptionalValue() { - // DO NOTHING + // INTENTIONALLY BLANK } @Override diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToInteger.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToInteger.java index bf65d3fd..84c617ef 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToInteger.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToInteger.java @@ -20,6 +20,7 @@ import java.util.function.Function; import java.util.function.Supplier; +/** Class to implement ConvertToInteger */ public class ConvertToInteger implements Function { private final Supplier supplier; diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToString.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToString.java index a73db58d..9ed475f1 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToString.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ConvertToString.java @@ -20,6 +20,7 @@ import java.util.function.Function; import java.util.function.Supplier; +/** Class to implement ConvertToString */ public class ConvertToString implements Function { private final Supplier supplier; diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ValidateIntegerInRange.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ValidateIntegerInRange.java index 6da4a02e..ad3809b1 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ValidateIntegerInRange.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/configuration/ValidateIntegerInRange.java @@ -20,6 +20,7 @@ import java.util.function.Function; import java.util.function.Supplier; +/** Class to implement ValidateIntegerInRange */ public class ValidateIntegerInRange implements Function { private final int minimum; diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/ConfigurationException.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/ConfigurationException.java index cf14efef..14e7a248 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/ConfigurationException.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/ConfigurationException.java @@ -18,16 +18,34 @@ import java.util.function.Supplier; +/** Class to implement ConfigurationException */ public class ConfigurationException extends RuntimeException { + /** + * Constructor + * + * @param message message + */ public ConfigurationException(String message) { super(message); } + /** + * Constructor + * + * @param message message + * @param throwable throwable + */ public ConfigurationException(String message, Throwable throwable) { super(message, throwable); } + /** + * Method to create a ConfigurationException supplier + * + * @param message message + * @return a ConfigurationException supplier + */ public static Supplier supplier(String message) { return () -> new ConfigurationException(message); } diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/HTTPServerFactory.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/HTTPServerFactory.java index 5c10bdb9..2918a24e 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/HTTPServerFactory.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/HTTPServerFactory.java @@ -92,7 +92,7 @@ public class HTTPServerFactory { /** Constructor */ public HTTPServerFactory() { - // DO NOTHING + // INTENTIONALLY BLANK } /** @@ -728,7 +728,7 @@ public void rejectedExecution(Runnable runnable, ThreadPoolExecutor threadPoolEx try { threadPoolExecutor.getQueue().put(runnable); } catch (InterruptedException e) { - // DO NOTHING + // INTENTIONALLY BLANK } } } diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/HexString.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/HexString.java index c6020199..f8e520f4 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/HexString.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/authenticator/HexString.java @@ -23,13 +23,14 @@ package io.prometheus.jmx.common.http.authenticator; +/** Class to implement HexString */ public class HexString { private static final char[] HEX_ARRAY = "0123456789abcdef".toCharArray(); /** Constructor */ private HexString() { - // DO NOTHING + // INTENTIONALLY BLANK } /** diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/ssl/SSLContextFactory.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/ssl/SSLContextFactory.java index 48dc8ac0..a948b1c5 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/ssl/SSLContextFactory.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/http/ssl/SSLContextFactory.java @@ -32,13 +32,14 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManagerFactory; +/** Class to implement SSLContextFactory */ public class SSLContextFactory { private static final String[] PROTOCOLS = {"TLSv1.3", "TLSv1.2", "TLSv1.1", "TLSv1"}; /** Constructor */ private SSLContextFactory() { - // DO NOTHING + // INTENTIONALLY BLANK } /** @@ -122,7 +123,7 @@ private static SSLContext createSSLContext() throws GeneralSecurityException { try { return SSLContext.getInstance(protocol); } catch (Throwable t) { - // DO NOTHING + // INTENTIONALLY BLANK } } diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/opentelemetry/OpenTelemetryExporterFactory.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/opentelemetry/OpenTelemetryExporterFactory.java index ac8839c5..eb0586bc 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/opentelemetry/OpenTelemetryExporterFactory.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/opentelemetry/OpenTelemetryExporterFactory.java @@ -27,7 +27,7 @@ public class OpenTelemetryExporterFactory { /** Constructor */ private OpenTelemetryExporterFactory() { - // DO NOTHING + // INTENTIONALLY BLANK } /** diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/util/Precondition.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/util/Precondition.java index b408a6f2..e9cd7819 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/util/Precondition.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/util/Precondition.java @@ -18,10 +18,12 @@ import static java.lang.String.format; +/** Class to implement Precondition */ public class Precondition { + /** Constructor */ private Precondition() { - // DO NOTHING + // INTENTIONALLY BLANK } /** diff --git a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/util/ResourceSupport.java b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/util/ResourceSupport.java index b0dc44df..690c9890 100644 --- a/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/util/ResourceSupport.java +++ b/jmx_prometheus_common/src/main/java/io/prometheus/jmx/common/util/ResourceSupport.java @@ -11,9 +11,16 @@ public class ResourceSupport { /** Constructor */ private ResourceSupport() { - // DO NOTHING + // INTENTIONALLY BLANK } + /** + * Method to load a resource's content + * + * @param resource resource + * @return the resource content + * @throws IOException IOException + */ public static String load(String resource) throws IOException { Precondition.notNull(resource, "resource is null"); diff --git a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/yaml/YamlMapAccessorTest.java b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/yaml/YamlMapAccessorTest.java index b79d92d7..f8956fc0 100644 --- a/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/yaml/YamlMapAccessorTest.java +++ b/jmx_prometheus_common/src/test/java/io/prometheus/jmx/common/yaml/YamlMapAccessorTest.java @@ -112,28 +112,28 @@ public void testInvalidPaths() throws IOException { yamlMapAccessor.get(""); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { - // DO NOTHING + // INTENTIONALLY BLANK } try { yamlMapAccessor.get("//"); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { - // DO NOTHING + // INTENTIONALLY BLANK } try { yamlMapAccessor.get("foo"); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { - // DO NOTHING + // INTENTIONALLY BLANK } try { yamlMapAccessor.get("/foo/"); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { - // DO NOTHING + // INTENTIONALLY BLANK } } diff --git a/jmx_prometheus_javaagent/src/main/java/io/prometheus/jmx/JavaAgent.java b/jmx_prometheus_javaagent/src/main/java/io/prometheus/jmx/JavaAgent.java index d9c88d72..2ebf5670 100644 --- a/jmx_prometheus_javaagent/src/main/java/io/prometheus/jmx/JavaAgent.java +++ b/jmx_prometheus_javaagent/src/main/java/io/prometheus/jmx/JavaAgent.java @@ -30,6 +30,7 @@ import java.util.Date; import java.util.Locale; +/** Class to implement JavaAgent */ public class JavaAgent { private static final SimpleDateFormat SIMPLE_DATE_FORMAT = @@ -37,6 +38,11 @@ public class JavaAgent { private static final PrometheusRegistry DEFAULT_REGISTRY = PrometheusRegistry.defaultRegistry; + /** Constructor */ + public JavaAgent() { + // INTENTIONALLY BLANK + } + /** * Java agent main * diff --git a/jmx_prometheus_standalone/src/main/java/io/prometheus/jmx/Standalone.java b/jmx_prometheus_standalone/src/main/java/io/prometheus/jmx/Standalone.java index dd289c9e..3f2e0709 100644 --- a/jmx_prometheus_standalone/src/main/java/io/prometheus/jmx/Standalone.java +++ b/jmx_prometheus_standalone/src/main/java/io/prometheus/jmx/Standalone.java @@ -40,6 +40,11 @@ public class Standalone { private static final PrometheusRegistry DEFAULT_REGISTRY = PrometheusRegistry.defaultRegistry; + /** Constructor */ + private Standalone() { + // INTENTIONALLY BLANK + } + /** * Main method *