@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()) .withEndpointConfiguration(new EndpointConfiguration("https://monitoring.us-west-2.amazonaws.com", "us-west-2")) .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.
|
AwsClientBuilder.EndpointConfiguration |
getEndpointConfiguration() |
int |
getMetricQueueSize() |
long |
getQueuePollTimeoutMilli()
Returns the metrics queue polling timeout in millisecond.
|
void |
setClientConfiguration(ClientConfiguration clientConfiguration)
Sets the Client Configuration.
|
void |
setCloudWatchEndPoint(String cloudWatchEndPoint)
Deprecated.
Use
#setEndpointConfiguration(EndpointConfiguration) instead |
void |
setCredentialsProvider(AWSCredentialsProvider credentialsProvider)
Sets the credential provider to the given provider.
|
void |
setEndpointConfiguration(AwsClientBuilder.EndpointConfiguration endpointConfiguration)
Configure the endpoint to be used
|
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)
Deprecated.
Use
#withEndpointConfiguration(EndpointConfiguration) instead |
CloudWatchMetricConfig |
withCredentialsProvider(AWSCredentialsProvider credentialsProvider) |
CloudWatchMetricConfig |
withEndpointConfiguration(AwsClientBuilder.EndpointConfiguration endpointConfiguration)
Configure the endpoint to be used
|
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()
@Deprecated public void setCloudWatchEndPoint(String cloudWatchEndPoint)
#setEndpointConfiguration(EndpointConfiguration)
instead@Deprecated public CloudWatchMetricConfig withCloudWatchEndPoint(String cloudWatchEndPoint)
#withEndpointConfiguration(EndpointConfiguration)
insteadpublic AwsClientBuilder.EndpointConfiguration getEndpointConfiguration()
public void setEndpointConfiguration(AwsClientBuilder.EndpointConfiguration endpointConfiguration)
endpointConfiguration
- the endpoint configurationpublic CloudWatchMetricConfig withEndpointConfiguration(AwsClientBuilder.EndpointConfiguration endpointConfiguration)
endpointConfiguration
- the endpoint configurationpublic int getMetricQueueSize()
public void setMetricQueueSize(int metricQueueSize)
DEFAULT_METRICS_QSIZE
public CloudWatchMetricConfig withMetricQueueSize(int metricQueueSize)