com.amazonaws.services.cloudwatch.model.PutMetricDataResult Java Examples
The following examples show how to use
com.amazonaws.services.cloudwatch.model.PutMetricDataResult.
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: MockPutCloudWatchMetric.java From localization_nifi with Apache License 2.0 | 5 votes |
protected PutMetricDataResult putMetricData(PutMetricDataRequest metricDataRequest) throws AmazonClientException { putMetricDataCallCount++; actualNamespace = metricDataRequest.getNamespace(); actualMetricData = metricDataRequest.getMetricData(); if (throwException != null) { throw throwException; } return result; }
Example #2
Source File: CloudWatchMeterRegistry.java From micrometer with Apache License 2.0 | 5 votes |
void sendMetricData(List<MetricDatum> metricData) throws InterruptedException { PutMetricDataRequest putMetricDataRequest = new PutMetricDataRequest() .withNamespace(config.namespace()) .withMetricData(metricData); CountDownLatch latch = new CountDownLatch(1); amazonCloudWatchAsync.putMetricDataAsync(putMetricDataRequest, new AsyncHandler<PutMetricDataRequest, PutMetricDataResult>() { @Override public void onError(Exception exception) { if (exception instanceof AbortedException) { logger.warn("sending metric data was aborted: {}", exception.getMessage()); } else { logger.error("error sending metric data.", exception); } latch.countDown(); } @Override public void onSuccess(PutMetricDataRequest request, PutMetricDataResult result) { logger.debug("published metric with namespace:{}", request.getNamespace()); latch.countDown(); } }); try { @SuppressWarnings("deprecation") long readTimeoutMillis = config.readTimeout().toMillis(); latch.await(readTimeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { logger.warn("metrics push to cloudwatch took longer than expected"); throw e; } }
Example #3
Source File: PutMetricData.java From aws-doc-sdk-examples with Apache License 2.0 | 5 votes |
public static void main(String[] args) { final String USAGE = "To run this example, supply a data point:\n" + "Ex: PutMetricData <data_point>\n"; if (args.length != 1) { System.out.println(USAGE); System.exit(1); } Double data_point = Double.parseDouble(args[0]); final AmazonCloudWatch cw = AmazonCloudWatchClientBuilder.defaultClient(); Dimension dimension = new Dimension() .withName("UNIQUE_PAGES") .withValue("URLS"); MetricDatum datum = new MetricDatum() .withMetricName("PAGES_VISITED") .withUnit(StandardUnit.None) .withValue(data_point) .withDimensions(dimension); PutMetricDataRequest request = new PutMetricDataRequest() .withNamespace("SITE/TRAFFIC") .withMetricData(datum); PutMetricDataResult response = cw.putMetricData(request); System.out.printf("Successfully put data point %f", data_point); }
Example #4
Source File: MockPutCloudWatchMetric.java From nifi with Apache License 2.0 | 5 votes |
protected PutMetricDataResult putMetricData(PutMetricDataRequest metricDataRequest) throws AmazonClientException { putMetricDataCallCount++; actualNamespace = metricDataRequest.getNamespace(); actualMetricData = metricDataRequest.getMetricData(); if (throwException != null) { throw throwException; } return result; }
Example #5
Source File: PutCloudWatchMetric.java From localization_nifi with Apache License 2.0 | 4 votes |
protected PutMetricDataResult putMetricData(PutMetricDataRequest metricDataRequest) throws AmazonClientException { final AmazonCloudWatchClient client = getClient(); final PutMetricDataResult result = client.putMetricData(metricDataRequest); return result; }
Example #6
Source File: NoopCloudWatch.java From dynamodb-cross-region-library with Apache License 2.0 | 4 votes |
@Override public PutMetricDataResult putMetricData(PutMetricDataRequest putMetricDataRequest) { return null; }
Example #7
Source File: PutCloudWatchMetric.java From nifi with Apache License 2.0 | 4 votes |
protected PutMetricDataResult putMetricData(PutMetricDataRequest metricDataRequest) throws AmazonClientException { final AmazonCloudWatchClient client = getClient(); final PutMetricDataResult result = client.putMetricData(metricDataRequest); return result; }