public class CloudWatchMetricsPersister extends Object implements MetricDetailsPersister
NOTE: If you are using the no-arg constructor (like with Spring) you will need to make sure that
initialize()
is called.
Constructor and Description |
---|
CloudWatchMetricsPersister() |
CloudWatchMetricsPersister(com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider,
String applicationName,
boolean addInstanceData) |
CloudWatchMetricsPersister(com.amazonaws.auth.AWSCredentials awsCredentials,
String applicationName,
boolean addInstanceData) |
Modifier and Type | Method and Description |
---|---|
void |
initialize()
Should be called if the no-arg construct is being used and after the file metrics have been set.
|
void |
persist(Map<ControlledMetric<?,?>,MetricValueDetails> metricValues,
long timeMillis)
Persists the metrics parameters to disk or some repository.
|
void |
setAddInstanceData(boolean addInstanceData)
Set to false to not add instance id to help identify the metric.
|
void |
setApplicationName(String applicationName)
Set our application name which will be used to identify the namespace for the metric.
|
void |
setAwsCredentials(com.amazonaws.auth.AWSCredentials awsCredentials)
Set the credentials to use when publishing to AWS.
|
void |
setAwsCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider)
Set the credentials provider.
|
void |
setCloudWatchClient(com.amazonaws.services.cloudwatch.AmazonCloudWatch cloudWatchClient)
Set the client to use to publish the metrics.
|
void |
setNameSpacePrefix(String nameSpacePrefix)
Sets the name-space prefix to use for metrics published from here.
|
public CloudWatchMetricsPersister()
public CloudWatchMetricsPersister(com.amazonaws.auth.AWSCredentials awsCredentials, String applicationName, boolean addInstanceData)
public CloudWatchMetricsPersister(com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider, String applicationName, boolean addInstanceData)
public void initialize()
public void persist(Map<ControlledMetric<?,?>,MetricValueDetails> metricValues, long timeMillis) throws IOException
MetricDetailsPersister
persist
in interface MetricDetailsPersister
metricValues
- The collection of metric and values-details we are persisting.timeMillis
- The time in millis when the metrics were collected.IOException
public void setAwsCredentials(com.amazonaws.auth.AWSCredentials awsCredentials)
public void setAwsCredentialsProvider(com.amazonaws.auth.AWSCredentialsProvider awsCredentialsProvider)
public void setApplicationName(String applicationName)
public void setAddInstanceData(boolean addInstanceData)
public void setNameSpacePrefix(String nameSpacePrefix)
public void setCloudWatchClient(com.amazonaws.services.cloudwatch.AmazonCloudWatch cloudWatchClient)
This content is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.