@Override public boolean isMetricsEnabled() { return AwsSdkMetrics.isMetricsEnabled(); }
/** * Returns true if we should wrap the given input stream with a byte * counting wrapper; false otherwise. */ private static boolean wrapWithByteCounting(InputStream in) { if (!AwsSdkMetrics.isMetricsEnabled()) { return false; // metrics is disabled } if (in instanceof MetricAware) { MetricAware aware = (MetricAware) in; // wrap only if not already wrapped in one of it's inner chain of input stream return !aware.isMetricActivated(); } return true; // this is a raw input stream so metric wrapping is necessary }
/** * Returned the best-guessed throughput metric type for the given request, * or null if there is none or if metric is disabled. */ public static ThroughputMetricType guessThroughputMetricType( final Request<?> req, final String metricNameSuffix, final String byteCountMetricNameSuffix) { if (!AwsSdkMetrics.isMetricsEnabled()) return null; // metric disabled Object orig = req.getOriginalRequestObject(); if (orig.getClass().getName().startsWith("com.amazonaws.services.s3")) { return new SimpleThroughputMetricType( "S3" + metricNameSuffix, req.getServiceName(), "S3" + byteCountMetricNameSuffix); } return null; } }
@Override public boolean isMetricsEnabled() { return AwsSdkMetrics.isMetricsEnabled(); }
/** * Returns true if we should wrap the given input stream with a byte * counting wrapper; false otherwise. */ private static boolean wrapWithByteCounting(InputStream in) { if (!AwsSdkMetrics.isMetricsEnabled()) { return false; // metrics is disabled } if (in instanceof MetricAware) { final MetricAware aware = (MetricAware) in; // wrap only if not already wrapped in one of it's inner chain of // input stream return !aware.isMetricActivated(); } return true; // this is a raw input stream so metric wrapping is // necessary }
/** * Returned the best-guessed throughput metric type for the given request, * or null if there is none or if metric is disabled. */ public static ThroughputMetricType guessThroughputMetricType( final Request<?> req, final String metricNameSuffix, final String byteCountMetricNameSuffix) { if (!AwsSdkMetrics.isMetricsEnabled()) return null; // metric disabled AmazonWebServiceRequest orig = req.getOriginalRequest(); if (orig.getClass().getName().startsWith("com.amazonaws.services.s3")) { return new SimpleThroughputMetricType( "S3" + metricNameSuffix, req.getServiceName(), "S3" + byteCountMetricNameSuffix); } return null; } }
/** * Returned the best-guessed throughput metric type for the given request, * or null if there is none or if metric is disabled. */ public static ThroughputMetricType guessThroughputMetricType( final Request<?> req, final String metricNameSuffix, final String byteCountMetricNameSuffix) { if (!AwsSdkMetrics.isMetricsEnabled()) return null; // metric disabled Object orig = req.getOriginalRequestObject(); if (orig.getClass().getName().startsWith("com.amazonaws.services.s3")) { return new SimpleThroughputMetricType( "S3" + metricNameSuffix, req.getServiceName(), "S3" + byteCountMetricNameSuffix); } return null; } }
@Test public void isMetricEnabled() { assertFalse(AwsSdkMetrics.isMetricsEnabled()); assertFalse(AwsSdkMetrics.isMetricsEnabled()); assertTrue(AwsSdkMetrics.isMetricsEnabled());
@Override public boolean isMetricsEnabled() { return AwsSdkMetrics.isMetricsEnabled(); }
/** * Returns true if we should wrap the given input stream with a byte * counting wrapper; false otherwise. */ private static boolean wrapWithByteCounting(InputStream in) { if (!AwsSdkMetrics.isMetricsEnabled()) { return false; // metrics is disabled } if (in instanceof MetricAware) { MetricAware aware = (MetricAware) in; // wrap only if not already wrapped in one of it's inner chain of input stream return !aware.isMetricActivated(); } return true; // this is a raw input stream so metric wrapping is necessary }
/** * Returns true if we should wrap the given input stream with a byte * counting wrapper; false otherwise. */ private static boolean wrapWithByteCounting(InputStream in) { if (!AwsSdkMetrics.isMetricsEnabled()) { return false; // metrics is disabled } if (in instanceof MetricAware) { final MetricAware aware = (MetricAware) in; // wrap only if not already wrapped in one of it's inner chain of // input stream return !aware.isMetricActivated(); } return true; // this is a raw input stream so metric wrapping is // necessary }
/** * Returned the best-guessed throughput metric type for the given request, * or null if there is none or if metric is disabled. */ public static ThroughputMetricType guessThroughputMetricType( final Request<?> req, final String metricNameSuffix, final String byteCountMetricNameSuffix) { if (!AwsSdkMetrics.isMetricsEnabled()) return null; // metric disabled AmazonWebServiceRequest orig = req.getOriginalRequest(); if (orig.getClass().getName().startsWith("com.amazonaws.services.s3")) { return new SimpleThroughputMetricType( "S3" + metricNameSuffix, req.getServiceName(), "S3" + byteCountMetricNameSuffix); } return null; } }
/** * Returned the best-guessed throughput metric type for the given request, * or null if there is none or if metric is disabled. */ public static ThroughputMetricType guessThroughputMetricType( final Request<?> req, final String metricNameSuffix, final String byteCountMetricNameSuffix) { if (!AwsSdkMetrics.isMetricsEnabled()) return null; // metric disabled AmazonWebServiceRequest orig = req.getOriginalRequest(); if (orig.getClass().getName().startsWith("com.amazonaws.services.s3")) { return new SimpleThroughputMetricType( "S3" + metricNameSuffix, req.getServiceName(), "S3" + byteCountMetricNameSuffix); } return null; } }
.guessThroughputMetricType(req, suffix, byteCountTypeNameSuffix); if (!AwsSdkMetrics.isMetricsEnabled()) { assertNull(actualType);
/** * Returned the best-guessed throughput metric type for the given request, * or null if there is none or if metric is disabled. */ public static ThroughputMetricType guessThroughputMetricType( final Request<?> req, final String metricNameSuffix, final String byteCountMetricNameSuffix) { if (!AwsSdkMetrics.isMetricsEnabled()) return null; // metric disabled Object orig = req.getOriginalRequestObject(); if (orig.getClass().getName().startsWith("com.amazonaws.services.s3")) { return new SimpleThroughputMetricType( "S3" + metricNameSuffix, req.getServiceName(), "S3" + byteCountMetricNameSuffix); } return null; } }