Class CloudWatchMetricConfig
java.lang.Object
com.amazonaws.metrics.internal.cloudwatch.CloudWatchMetricConfig
Configuration for the default AWS SDK collection implementation. This class
is not intended to be used directly by client code except for cases where the
default behavior of the internal Amazon CloudWatch collector implementation
needs to be customized.
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);
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Default metrics queue size.static final int
Default timeout in millisecond for queue polling. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the end point of AmazonCloudWatch to upload the metrics.Returns the credential provider that holds the credentials to connect to Amazon CloudWatch.int
long
Returns the metrics queue polling timeout in millisecond.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.withCloudWatchEndPoint
(String cloudWatchEndPoint) withCredentialsProvider
(AWSCredentialsProvider credentialsProvider) withMetricQueueSize
(int metricQueueSize) withQueuePollTimeoutMilli
(long queuePollTimeoutMilli)
-
Field Details
-
DEFAULT_METRICS_QSIZE
public static final int DEFAULT_METRICS_QSIZEDefault metrics queue size. If the queue size exceeds this value, then excessive metrics will be dropped to prevent resource exhaustion.- See Also:
-
DEFAULT_QUEUE_POLL_TIMEOUT_MILLI
public static final int DEFAULT_QUEUE_POLL_TIMEOUT_MILLIDefault timeout in millisecond for queue polling. Set to one-minute which is the finest granularity of Amazon CloudWatch.
-
-
Constructor Details
-
CloudWatchMetricConfig
public CloudWatchMetricConfig()
-
-
Method Details
-
getCredentialsProvider
Returns the credential provider that holds the credentials to connect to Amazon CloudWatch. -
setCredentialsProvider
Sets the credential provider to the given provider. This credential provider is used by the uploader thread to connect to Amazon CloudWatch. -
withCredentialsProvider
-
getQueuePollTimeoutMilli
public long getQueuePollTimeoutMilli()Returns the metrics queue polling timeout in millisecond. -
setQueuePollTimeoutMilli
public void setQueuePollTimeoutMilli(long queuePollTimeoutMilli) Sets the metric queue polling timeout in millisecond. The default set set to one-minute per the finest granularity of Amazon CloudWatch -
withQueuePollTimeoutMilli
-
getCloudWatchEndPoint
Returns the end point of AmazonCloudWatch to upload the metrics. -
setCloudWatchEndPoint
Sets the end point of AmazonCloudWatch to upload the metrics. -
withCloudWatchEndPoint
-
getMetricQueueSize
public int getMetricQueueSize() -
setMetricQueueSize
public void setMetricQueueSize(int metricQueueSize) Configure the metric queue size, overriding the default. Must be at least 1.- See Also:
-
withMetricQueueSize
-