Example usage for com.amazonaws.services.cloudwatch AmazonCloudWatchAsyncClient AmazonCloudWatchAsyncClient

List of usage examples for com.amazonaws.services.cloudwatch AmazonCloudWatchAsyncClient AmazonCloudWatchAsyncClient

Introduction

In this page you can find the example usage for com.amazonaws.services.cloudwatch AmazonCloudWatchAsyncClient AmazonCloudWatchAsyncClient.

Prototype

@Deprecated
public AmazonCloudWatchAsyncClient() 

Source Link

Document

Constructs a new asynchronous client to invoke service methods on CloudWatch.

Usage

From source file:com.blacklocus.metrics.CloudWatchReporterBuilder.java

License:Apache License

/**
 * @return a new CloudWatchReporter instance based on the state of this builder
 *///from   w w w  . j  a va 2s.  c om
public CloudWatchReporter build() {
    Preconditions.checkState(!Strings.isNullOrEmpty(namespace), "Metric namespace is required.");

    String resolvedNamespace = namespace;

    // Use specified or fall back to default. Don't secretly modify the fields of this builder
    // in case the caller wants to re-use it to build other reporters, or something.

    MetricRegistry resolvedRegistry = null != registry ? registry : new MetricRegistry();
    MetricFilter resolvedFilter = null != filter ? filter : MetricFilter.ALL;
    AmazonCloudWatchAsync resolvedCloudWatchClient = null != client ? client
            : new AmazonCloudWatchAsyncClient();
    String resolvedDimensions = null != dimensions ? dimensions : null;
    Boolean resolvedTimestampLocal = null != timestampLocal ? timestampLocal : false;

    String resolvedTypeDimName = null != typeDimName ? typeDimName : Constants.DEF_DIM_NAME_TYPE;
    String resolvedTypeDimValGauge = null != typeDimValGauge ? typeDimValGauge : Constants.DEF_DIM_VAL_GAUGE;
    String resolvedTypeDimValCounterCount = null != typeDimValCounterCount ? typeDimValCounterCount
            : Constants.DEF_DIM_VAL_COUNTER_COUNT;
    String resolvedTypeDimValMeterCount = null != typeDimValMeterCount ? typeDimValMeterCount
            : Constants.DEF_DIM_VAL_METER_COUNT;
    String resolvedTypeDimValHistoSamples = null != typeDimValHistoSamples ? typeDimValHistoSamples
            : Constants.DEF_DIM_VAL_HISTO_SAMPLES;
    String resolvedTypeDimValHistoStats = null != typeDimValHistoStats ? typeDimValHistoStats
            : Constants.DEF_DIM_VAL_HISTO_STATS;
    String resolvedTypeDimValTimerSamples = null != typeDimValTimerSamples ? typeDimValTimerSamples
            : Constants.DEF_DIM_VAL_TIMER_SAMPLES;
    String resolvedTypeDimValTimerStats = null != typeDimValTimerStats ? typeDimValTimerStats
            : Constants.DEF_DIM_VAL_TIMER_STATS;

    Predicate<MetricDatum> resolvedReporterFilter = null != reporterFilter ? reporterFilter
            : Predicates.<MetricDatum>alwaysTrue();

    return new CloudWatchReporter(resolvedRegistry, resolvedNamespace, resolvedFilter, resolvedCloudWatchClient)
            .withDimensions(resolvedDimensions).withTimestampLocal(resolvedTimestampLocal)
            .withTypeDimName(resolvedTypeDimName).withTypeDimValGauge(resolvedTypeDimValGauge)
            .withTypeDimValCounterCount(resolvedTypeDimValCounterCount)
            .withTypeDimValMeterCount(resolvedTypeDimValMeterCount)
            .withTypeDimValHistoSamples(resolvedTypeDimValHistoSamples)
            .withTypeDimValHistoStats(resolvedTypeDimValHistoStats)
            .withTypeDimValTimerSamples(resolvedTypeDimValTimerSamples)
            .withTypeDimValTimerStats(resolvedTypeDimValTimerStats).withReporterFilter(resolvedReporterFilter);
}

From source file:com.boundlessgeo.suite.geoserver.cloudwatch.aws.CloudwatchSender.java

License:Open Source License

public CloudwatchSender() {
    try {//w w  w. j  a va2  s. c  om
        cloudwatch = new AmazonCloudWatchAsyncClient();
        enabled = true;
        logger.info("Initialized AWS Client");
    } catch (Exception ex) {
        logger.error("Error initializing AWS Client!");
        logger.error(ex.getMessage());
    }
}

From source file:com.jlhood.metrics.ExampleMetrics.java

License:Apache License

public ExampleMetrics() {
    new ScheduledCloudWatchReporter(registry,
            new CloudWatchReporter(ExampleMetrics.class.getSimpleName(), new AmazonCloudWatchAsyncClient()))
                    .start(1, TimeUnit.MINUTES);
}