当前位置: 首页>>代码示例>>Java>>正文


Java PutMetricDataRequest.setMetricData方法代码示例

本文整理汇总了Java中com.amazonaws.services.cloudwatch.model.PutMetricDataRequest.setMetricData方法的典型用法代码示例。如果您正苦于以下问题:Java PutMetricDataRequest.setMetricData方法的具体用法?Java PutMetricDataRequest.setMetricData怎么用?Java PutMetricDataRequest.setMetricData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazonaws.services.cloudwatch.model.PutMetricDataRequest的用法示例。


在下文中一共展示了PutMetricDataRequest.setMetricData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: postToCloudwatch

import com.amazonaws.services.cloudwatch.model.PutMetricDataRequest; //导入方法依赖的package包/类
private void postToCloudwatch(String namespace, List<CloudwatchStatistic> statistics) {
    List<MetricDatum> metricDatumList = statistics.stream()
            .map(CloudwatchStatistic::toMetricsDatum)
            .collect(toList());

    PutMetricDataRequest request = new PutMetricDataRequest();
    request.setNamespace(namespace);
    request.setMetricData(metricDatumList);

    amazonCloudWatch.putMetricData(request);
}
 
开发者ID:Espenhh,项目名称:panopticon,代码行数:12,代码来源:CloudwatchClient.java

示例2: sendCloudWatchConsistencyAlert

import com.amazonaws.services.cloudwatch.model.PutMetricDataRequest; //导入方法依赖的package包/类
private void sendCloudWatchConsistencyAlert() {
    MetricDatum datum = new MetricDatum();
    datum.setMetricName(cloudWatchConsistencyMetric);
    datum.setUnit(StandardUnit.Count);
    datum.setValue(1.0);
    
    PutMetricDataRequest request = new PutMetricDataRequest();
    request.setNamespace(namespace);
    request.setMetricData(Collections.singleton(datum));
    
    cloudWatch.putMetricData(request);
}
 
开发者ID:Netflix,项目名称:s3mper,代码行数:13,代码来源:CloudWatchAlertDispatcher.java

示例3: sendCloudWatchTimeoutAlert

import com.amazonaws.services.cloudwatch.model.PutMetricDataRequest; //导入方法依赖的package包/类
private void sendCloudWatchTimeoutAlert() {
    MetricDatum datum = new MetricDatum();
    datum.setMetricName(cloudWatchTimeoutMetric);
    datum.setUnit(StandardUnit.Count);
    datum.setValue(1.0);
    
    PutMetricDataRequest request = new PutMetricDataRequest();
    request.setNamespace(namespace);
    request.setMetricData(Collections.singleton(datum));
    
    cloudWatch.putMetricData(request);
}
 
开发者ID:Netflix,项目名称:s3mper,代码行数:13,代码来源:CloudWatchAlertDispatcher.java

示例4: sendData

import com.amazonaws.services.cloudwatch.model.PutMetricDataRequest; //导入方法依赖的package包/类
private void sendData( Collection<MetricDatum> metricData ) {
    PutMetricDataRequest request = new PutMetricDataRequest();
    request.setNamespace( namespace );
    request.setMetricData( metricData );
    metricsClient.putMetricData( request );
}
 
开发者ID:awslabs,项目名称:swage,代码行数:7,代码来源:CloudWatchRecorder.java

示例5: report

import com.amazonaws.services.cloudwatch.model.PutMetricDataRequest; //导入方法依赖的package包/类
@Override
public void report(SortedMap<String, Gauge> gauges,
                   SortedMap<String, Counter> counters,
                   SortedMap<String, Histogram> histograms,
                   SortedMap<String, Meter> meters,
                   SortedMap<String, Timer> timers) {
    Collection<MetricDatum> data = new ArrayList<>();
    for (Map.Entry<String, Gauge> meg : gauges.entrySet()) {
        if (meg.getValue().getValue() instanceof Number) {
            Number num = (Number)meg.getValue().getValue();
            double val = num.doubleValue();
            if (LOG.isDebugEnabled()) {
                LOG.debug("gauge {} val {}", meg.getKey(), val);
            }
            data.add(new MetricDatum().withMetricName(meg.getKey()).withValue(val).withDimensions(dimensions));
        }
    }
    for (Map.Entry<String, Counter> mec : counters.entrySet()) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("counter {} val {}", mec.getKey(), mec.getValue().getCount());
        }
        data.add(new MetricDatum().withMetricName(mec.getKey()).withValue((double) mec.getValue().getCount())
                 .withDimensions(dimensions));
    }
    for (Map.Entry<String, Histogram> meh : histograms.entrySet()) {
        reportHistogram(data, meh);
    }
    for (Map.Entry<String, Timer> met : timers.entrySet()) {
        reportTimer(met.getKey(), data, met);
    }

    if (!data.isEmpty()) {
        PutMetricDataRequest put = new PutMetricDataRequest();
        put.setNamespace(namespace);
        put.setMetricData(data);
        try {
            client.putMetricData(put);
        } catch (Throwable t) {
            LOG.error("Failed to put metrics", t);
        }
    }
}
 
开发者ID:basis-technology-corp,项目名称:metrics-cloudwatch-reporter,代码行数:43,代码来源:CloudWatchReporter.java


注:本文中的com.amazonaws.services.cloudwatch.model.PutMetricDataRequest.setMetricData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。