@Override public boolean enableDefaultMetrics() { return AwsSdkMetrics.enableDefaultMetrics(); } @Override
public static <T extends MetricCollector> T getMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T)(mc == null ? MetricCollector.NONE : mc); return t; }
public static <T extends ServiceMetricCollector> T getServiceMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T)(mc == null ? ServiceMetricCollector.NONE : mc.getServiceMetricCollector()); return t; }
/** * Returns a non-null request metric collector for the SDK. If no custom * request metric collector has previously been specified via * {@link #setMetricCollector(MetricCollector)} and the * {@link SDKGlobalConfiguration#DEFAULT_METRICS_SYSTEM_PROPERTY} has been set, then this method * will initialize and return the default metric collector provided by the * AWS SDK on a best-attempt basis. */ public static <T extends RequestMetricCollector> T getRequestMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T)(mc == null ? RequestMetricCollector.NONE : mc.getRequestMetricCollector()); return t; }
@Override public boolean enableDefaultMetrics() { return AwsSdkMetrics.enableDefaultMetrics(); } @Override
public static <T extends MetricCollector> T getMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T)(mc == null ? MetricCollector.NONE : mc); return t; }
/** * @param <T> The MetricCollector type. * @return a non-null metric collector for the SDK. */ public static <T extends MetricCollector> T getMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T) (mc == null ? MetricCollector.NONE : mc); return t; }
public static <T extends ServiceMetricCollector> T getServiceMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T)(mc == null ? ServiceMetricCollector.NONE : mc.getServiceMetricCollector()); return t; }
/** * @param <T> Tje ServiceMetricCollector type. * @return a non-null service metric collector for the SDK. */ public static <T extends ServiceMetricCollector> T getServiceMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T) (mc == null ? ServiceMetricCollector.NONE : mc.getServiceMetricCollector()); return t; }
/** * Returns a non-null request metric collector for the SDK. If no custom * request metric collector has previously been specified via * {@link #setMetricCollector(MetricCollector)} and the * {@link SDKGlobalConfiguration#DEFAULT_METRICS_SYSTEM_PROPERTY} has been set, then this method * will initialize and return the default metric collector provided by the * AWS SDK on a best-attempt basis. */ public static <T extends RequestMetricCollector> T getRequestMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T)(mc == null ? RequestMetricCollector.NONE : mc.getRequestMetricCollector()); return t; }
/** * @param <T> RequestMetricCollector type. * @return a non-null request metric collector for the SDK. If no custom * request metric collector has previously been specified via * {@link #setMetricCollector(MetricCollector)} and the * {@link SDKGlobalConfiguration#DEFAULT_METRICS_SYSTEM_PROPERTY} has been * set, then this method will initialize and return the default metric * collector provided by the AWS SDK on a best-attempt basis. */ public static <T extends RequestMetricCollector> T getRequestMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T) (mc == null ? RequestMetricCollector.NONE : mc.getRequestMetricCollector()); return t; }
/** * By default the AWS SDK metric collection is disabled. Enabling it should * fail unless the necessary CloudWatch related jars are on the classpath. * Therefore, this test is expected to fail in enabling the default metric * collection, but have absolutely no impact otherwise. */ @Test public void enableDefaultMetrics() { Assert.assertFalse(AwsSdkMetrics.enableDefaultMetrics()); }
@Override public boolean enableDefaultMetrics() { return AwsSdkMetrics.enableDefaultMetrics(); } @Override
public static <T extends MetricCollector> T getMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T)(mc == null ? MetricCollector.NONE : mc); return t; }
/** * @param <T> The MetricCollector type. * @return a non-null metric collector for the SDK. */ public static <T extends MetricCollector> T getMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T) (mc == null ? MetricCollector.NONE : mc); return t; }
/** * @param <T> The MetricCollector type. * @return a non-null metric collector for the SDK. */ public static <T extends MetricCollector> T getMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T) (mc == null ? MetricCollector.NONE : mc); return t; }
@Test public void test() { // by default, it's disabled assertFalse(AwsSdkMetrics.isDefaultMetricsEnabled()); // won't be anble to enable unless the default impl library is on the // classpath assertFalse(AwsSdkMetrics.enableDefaultMetrics()); assertFalse(AwsSdkMetrics.isDefaultMetricsEnabled()); assertSame(RequestMetricCollector.NONE, AwsSdkMetrics.getRequestMetricCollector()); assertFalse(AwsSdkMetrics.isDefaultMetricsEnabled()); // effectively no effect AwsSdkMetrics.disableMetrics(); assertFalse(AwsSdkMetrics.isDefaultMetricsEnabled()); }
public static <T extends ServiceMetricCollector> T getServiceMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T)(mc == null ? ServiceMetricCollector.NONE : mc.getServiceMetricCollector()); return t; }
/** * @param <T> Tje ServiceMetricCollector type. * @return a non-null service metric collector for the SDK. */ public static <T extends ServiceMetricCollector> T getServiceMetricCollector() { if (mc == null) { if (isDefaultMetricsEnabled()) enableDefaultMetrics(); } @SuppressWarnings("unchecked") T t = (T) (mc == null ? ServiceMetricCollector.NONE : mc.getServiceMetricCollector()); return t; }
public AwsMetricManager(IConfiguration config, INameFactory nameFactory) { cwClient_ = AmazonCloudWatchClientBuilder.defaultClient(); nameSpace_ = nameFactory.getMultiTenantServiceName().toString(); tenantId_ = config.getString("id/tenantId", null); AwsSdkMetrics.enableDefaultMetrics(); // AwsSdkMetrics.setCredentialProvider(credentialsProvider); AwsSdkMetrics.setMetricNameSpace(nameSpace_); }