com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient Java Examples

The following examples show how to use com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CloudWatchExportAutoConfiguration.java    From spring-cloud-aws with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnMissingAmazonClient(AmazonCloudWatchAsync.class)
public AmazonWebserviceClientFactoryBean<AmazonCloudWatchAsyncClient> amazonCloudWatchAsync(
		AWSCredentialsProvider credentialsProvider,
		ObjectProvider<RegionProvider> regionProvider) {
	return new AmazonWebserviceClientFactoryBean<>(AmazonCloudWatchAsyncClient.class,
			credentialsProvider, regionProvider.getIfAvailable());
}
 
Example #2
Source File: CloudWatchReporterBuilder.java    From metrics-cloudwatch with Apache License 2.0 4 votes vote down vote up
/**
 * @return a new CloudWatchReporter instance based on the state of this builder
 */
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);
}
 
Example #3
Source File: CloudWatchAlertDispatcher.java    From s3mper with Apache License 2.0 4 votes vote down vote up
private void initCloudWatch(String keyId, String keySecret) {
    log.debug("Initializing CloudWatch Client");
    cloudWatch = new AmazonCloudWatchAsyncClient(new BasicAWSCredentials(keyId, keySecret));
}
 
Example #4
Source File: DynamoDBReplicationEmitter.java    From dynamodb-cross-region-library with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor with default CloudWatch client and default DynamoDBAsync.
 *
 * @param configuration
 *            The configuration for this emitter.
 * @deprecated Deprecated by {@link #DynamoDBReplicationEmitter(DynamoDBStreamsConnectorConfiguration, AmazonDynamoDBAsync, AmazonCloudWatchAsync)}
 */
@Deprecated
public DynamoDBReplicationEmitter(final DynamoDBStreamsConnectorConfiguration configuration) {
    this(configuration.APP_NAME, configuration.DYNAMODB_ENDPOINT, configuration.REGION_NAME, configuration.DYNAMODB_DATA_TABLE_NAME,
        (AmazonCloudWatchAsync) new AmazonCloudWatchAsyncClient(new DefaultAWSCredentialsProviderChain(), Executors.newFixedThreadPool(MAX_THREADS)).withRegion(Regions.getCurrentRegion() == null ? Region.getRegion(Regions.US_EAST_1) : Regions.getCurrentRegion()), new DefaultAWSCredentialsProviderChain());
}