@NotThreadSafe public class CloudWatchMetricConfig extends Object
Example:
/** * My custom Request Metric Collector by extending from the internal Amazon CloudWatch * implementation. */ static class MyCloudWatchMetricCollector extends CloudWatchRequestMetricCollector { MyCloudWatchMetricCollector(CloudWatchMetricConfig config) { super(config); } } MyCloudWatchMetricCollector myCollector = new MyCloudWatchMetricCollector( new CloudWatchMetricConfig() .withQueuePollTimeoutMilli(60000) .withMetricQueueSize(1000) .withCredentialsProvider( new DefaultAWSCredentialsProviderChain()) .withCloudWatchEndPoint("monitoring.us-west-2.amazonaws.com") .withPredefinedMetrics( new HashSet<Field>(Arrays.asList(Field.HttpRequestTime, Field.ResponseProcessingTime)))); myCollector.start(); // Enable the AWS SDK level request metric collection with a custom collector AwsSdkMetrics.setRequestMetricCollector(myCollector);
AwsSdkMetrics
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_METRICS_QSIZE
Default metrics queue size.
|
static int |
DEFAULT_QUEUE_POLL_TIMEOUT_MILLI
Default timeout in millisecond for queue polling.
|
Constructor and Description |
---|
CloudWatchMetricConfig() |
Modifier and Type | Method and Description |
---|---|
ClientConfiguration |
getClientConfiguration()
Returns the Client Configuration used to connect to
Amazon CloudWatch.
|
String |
getCloudWatchEndPoint()
Returns the end point of AmazonCloudWatch to upload the metrics.
|
AWSCredentialsProvider |
getCredentialsProvider()
Returns the credential provider that holds the credentials to connect to
Amazon CloudWatch.
|
int |
getMetricQueueSize() |
long |
getQueuePollTimeoutMilli()
Returns the metrics queue polling timeout in millisecond.
|
void |
setClientConfiguration(ClientConfiguration clientConfiguration)
Sets the Client Configuration.
|
void |
setCloudWatchEndPoint(String cloudWatchEndPoint)
Sets the end point of AmazonCloudWatch to upload the metrics.
|
void |
setCredentialsProvider(AWSCredentialsProvider credentialsProvider)
Sets the credential provider to the given provider.
|
void |
setMetricQueueSize(int metricQueueSize)
Configure the metric queue size, overriding the default.
|
void |
setQueuePollTimeoutMilli(long queuePollTimeoutMilli)
Sets the metric queue polling timeout in millisecond.
|
CloudWatchMetricConfig |
withClientConfiguration(ClientConfiguration clientConfiguration) |
CloudWatchMetricConfig |
withCloudWatchEndPoint(String cloudWatchEndPoint) |
CloudWatchMetricConfig |
withCredentialsProvider(AWSCredentialsProvider credentialsProvider) |
CloudWatchMetricConfig |
withMetricQueueSize(int metricQueueSize) |
CloudWatchMetricConfig |
withQueuePollTimeoutMilli(long queuePollTimeoutMilli) |
public static final int DEFAULT_METRICS_QSIZE
public static final int DEFAULT_QUEUE_POLL_TIMEOUT_MILLI
public AWSCredentialsProvider getCredentialsProvider()
public void setCredentialsProvider(AWSCredentialsProvider credentialsProvider)
public CloudWatchMetricConfig withCredentialsProvider(AWSCredentialsProvider credentialsProvider)
public ClientConfiguration getClientConfiguration()
public void setClientConfiguration(ClientConfiguration clientConfiguration)
public CloudWatchMetricConfig withClientConfiguration(ClientConfiguration clientConfiguration)
public long getQueuePollTimeoutMilli()
public void setQueuePollTimeoutMilli(long queuePollTimeoutMilli)
public CloudWatchMetricConfig withQueuePollTimeoutMilli(long queuePollTimeoutMilli)
public String getCloudWatchEndPoint()
public void setCloudWatchEndPoint(String cloudWatchEndPoint)
public CloudWatchMetricConfig withCloudWatchEndPoint(String cloudWatchEndPoint)
public int getMetricQueueSize()
public void setMetricQueueSize(int metricQueueSize)
DEFAULT_METRICS_QSIZE
public CloudWatchMetricConfig withMetricQueueSize(int metricQueueSize)
Copyright © 2013 Amazon Web Services, Inc. All Rights Reserved.