本文整理汇总了Java中com.amazonaws.services.cloudwatch.model.PutMetricDataRequest.getMetricData方法的典型用法代码示例。如果您正苦于以下问题:Java PutMetricDataRequest.getMetricData方法的具体用法?Java PutMetricDataRequest.getMetricData怎么用?Java PutMetricDataRequest.getMetricData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.cloudwatch.model.PutMetricDataRequest
的用法示例。
在下文中一共展示了PutMetricDataRequest.getMetricData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reportMetersCountersGaugesWithZeroValuesOnlyWhenConfigured
import com.amazonaws.services.cloudwatch.model.PutMetricDataRequest; //导入方法依赖的package包/类
@Test
public void reportMetersCountersGaugesWithZeroValuesOnlyWhenConfigured() throws Exception {
metricRegistry.register(ARBITRARY_GAUGE_NAME, (Gauge<Long>) () -> 0L);
metricRegistry.meter(ARBITRARY_METER_NAME).mark(0);
metricRegistry.counter(ARBITRARY_COUNTER_NAME).inc(0);
metricRegistry.timer(ARBITRARY_TIMER_NAME).update(-1L, TimeUnit.NANOSECONDS);
buildReportWithSleep(reporterBuilder
.withArithmeticMean()
.withOneMinuteMeanRate()
.withFiveMinuteMeanRate()
.withFifteenMinuteMeanRate()
.withZeroValuesSubmission()
.withMeanRate());
verify(mockAmazonCloudWatchAsyncClient, times(1)).putMetricDataAsync(metricDataRequestCaptor.capture());
final PutMetricDataRequest putMetricDataRequest = metricDataRequestCaptor.getValue();
final List<MetricDatum> metricData = putMetricDataRequest.getMetricData();
for (final MetricDatum metricDatum : metricData) {
assertThat(metricDatum.getValue()).isEqualTo(0.0);
}
}
开发者ID:azagniotov,项目名称:codahale-aggregated-metrics-cloudwatch-reporter,代码行数:24,代码来源:CloudWatchReporterTest.java
示例2: metricDatumByDimensionFromCapturedRequest
import com.amazonaws.services.cloudwatch.model.PutMetricDataRequest; //导入方法依赖的package包/类
private MetricDatum metricDatumByDimensionFromCapturedRequest(final String dimensionValue) {
final PutMetricDataRequest putMetricDataRequest = metricDataRequestCaptor.getValue();
final List<MetricDatum> metricData = putMetricDataRequest.getMetricData();
final Optional<MetricDatum> metricDatumOptional =
metricData
.stream()
.filter(metricDatum -> metricDatum.getDimensions()
.contains(new Dimension().withName(DIMENSION_NAME_TYPE).withValue(dimensionValue)))
.findFirst();
if (metricDatumOptional.isPresent()) {
return metricDatumOptional.get();
}
throw new IllegalStateException("Could not find MetricDatum for Dimension value: " + dimensionValue);
}
开发者ID:azagniotov,项目名称:codahale-aggregated-metrics-cloudwatch-reporter,代码行数:18,代码来源:CloudWatchReporterTest.java
示例3: allDimensionsFromCapturedRequest
import com.amazonaws.services.cloudwatch.model.PutMetricDataRequest; //导入方法依赖的package包/类
private List<Dimension> allDimensionsFromCapturedRequest() {
final PutMetricDataRequest putMetricDataRequest = metricDataRequestCaptor.getValue();
final List<MetricDatum> metricData = putMetricDataRequest.getMetricData();
final List<Dimension> all = new LinkedList<>();
for (final MetricDatum metricDatum : metricData) {
all.addAll(metricDatum.getDimensions());
}
return all;
}
开发者ID:azagniotov,项目名称:codahale-aggregated-metrics-cloudwatch-reporter,代码行数:10,代码来源:CloudWatchReporterTest.java
示例4: report
import com.amazonaws.services.cloudwatch.model.PutMetricDataRequest; //导入方法依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
public void report(
SortedMap<String, Gauge> gauges,
SortedMap<String, Counter> counters,
SortedMap<String, Histogram> histograms,
SortedMap<String, Meter> meters,
SortedMap<String, Timer> timers) {
logger.info("Starting metrics publishing to AWS CloudWatch.");
LinkedList<PutMetricDataRequest> requests = new LinkedList<>();
addMetricData(gauges, counters, histograms, meters, timers, requests, new Date());
if (requests.isEmpty()) {
logger.debug("No metric data to send to AWS.");
return;
}
for (PutMetricDataRequest request : requests) {
try {
for (MetricDatum datum : request.getMetricData()) {
logger.debug("Sending metric " + datum);
}
cloudWatch.putMetricData(request);
} catch (Exception e) {
logger.error("Failed to log metrics to CloudWatch discarding metrics for this attempt...",e);
return;
}
}
logger.info("Finished metrics publishing to AWS CloudWatch.");
}