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


Java MetricDatum.setValue方法代码示例

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


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

示例1: sendValue

import com.amazonaws.services.cloudwatch.model.MetricDatum; //导入方法依赖的package包/类
/**
 * Send a datum object to this metric.
 *
 * @param value the measurement to record
 */
public void sendValue(double value) {
    MetricDatum datum = new MetricDatum();
    datum.setMetricName(name);
    datum.setUnit(unit);
    datum.setValue(value);

    PutMetricDataRequest request = new PutMetricDataRequest();
    request.setNamespace(namespace);
    request.withMetricData(datum);

    logger.info(String.format("logging %.2f to cloudwatch metric %s/%s", value, namespace, name));
    client.putMetricData(request);
}
 
开发者ID:zachpendleton,项目名称:sidekiq-reporter,代码行数:19,代码来源:CloudwatchMetric.java

示例2: toMetricsDatum

import com.amazonaws.services.cloudwatch.model.MetricDatum; //导入方法依赖的package包/类
public MetricDatum toMetricsDatum() {
    MetricDatum metricDatum = new MetricDatum();
    metricDatum.setMetricName(key);
    metricDatum.setTimestamp(new Date());
    metricDatum.setUnit(unit);
    metricDatum.setValue(value);
    return metricDatum;
}
 
开发者ID:Espenhh,项目名称:panopticon,代码行数:9,代码来源:CloudwatchClient.java

示例3: write

import com.amazonaws.services.cloudwatch.model.MetricDatum; //导入方法依赖的package包/类
public void write(Query query) {
    PutMetricDataRequest metricDataRequest = new PutMetricDataRequest();
    metricDataRequest.setNamespace(namespace);

    MetricDatum metricDatum = new MetricDatum();

    // Converts the Objects to Double-values for CloudWatch

    metricDatum.setMetricName(query.getKey());
    metricDatum.setValue(convertToDouble(query.getValue()));
    metricDatum.setTimestamp(new Date());

    metricDataRequest.withMetricData(metricDatum);
    cloudWatchClient.putMetricData(metricDataRequest);
}
 
开发者ID:awin,项目名称:docker-stats-cloudwatch,代码行数:16,代码来源:CloudWatchWriter.java

示例4: getMetricDatumCollection

import com.amazonaws.services.cloudwatch.model.MetricDatum; //导入方法依赖的package包/类
@Override
public Collection<MetricDatum> getMetricDatumCollection() {
 	  Collection<MetricDatum> cmd = new HashSet<MetricDatum>(2);
 	  MetricDatum md2 = new MetricDatum();
 	  md2.setUnit(StandardUnit.Count);
 	  md2.setMetricName("qm-servers-functional");  	  
 	  
  try{
  Client bc = new ClientImpl(beanstalkdip, beanstalkdport, true);
 	  List<String> lt = bc.listTubes();
 	  double tot = 0.0;
 	  for (String tube : lt) {
		Map<String,String> st = bc.statsTube(tube);
		tot += Integer.parseInt(st.get("current-jobs-ready"));
 	  }
 	  MetricDatum md1 = new MetricDatum();
 	  md1.setUnit(StandardUnit.Count);
 	  md1.setValue(tot);
 	  md1.setMetricName("queues-all-jobs-ready");
 	  
 	  md2.setValue(1.0);
 	  
 	  cmd.add(md1);
 	  } catch (Exception e){
 	  	  md2.setValue(0.0);
 	  }
  cmd.add(md2);
  
  return cmd;
}
 
开发者ID:emanuelecasadio,项目名称:CliDispatcher,代码行数:31,代码来源:BeanstalkdMetricDatumProvider.java

示例5: getMetricDatumCollection

import com.amazonaws.services.cloudwatch.model.MetricDatum; //导入方法依赖的package包/类
@Override
public Collection<MetricDatum> getMetricDatumCollection() {
  	  Collection<MetricDatum> cmd = new HashSet<MetricDatum>(2);
  	  MetricDatum md = new MetricDatum();
  	  md.setUnit(StandardUnit.Count);
  	  md.setMetricName(metricname);
  	  if(ping()){
  		  md.setValue(1.0);
  	  } else {
  		  md.setValue(0.0);
  	  }
  	  cmd.add(md);
  	  return cmd;
}
 
开发者ID:emanuelecasadio,项目名称:CliDispatcher,代码行数:15,代码来源:HTTPAliveMetricDatumProvider.java

示例6: sendCloudWatchConsistencyAlert

import com.amazonaws.services.cloudwatch.model.MetricDatum; //导入方法依赖的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

示例7: sendCloudWatchTimeoutAlert

import com.amazonaws.services.cloudwatch.model.MetricDatum; //导入方法依赖的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

示例8: write

import com.amazonaws.services.cloudwatch.model.MetricDatum; //导入方法依赖的package包/类
@Override
public void write(ArrayList<Stat> stats, long invokeTimeMs, Set<Tag> tags) {
  Date dt = new Date();
  dt.setTime(invokeTimeMs);

  Collection<Dimension> parentDims = tagsToDimensions(tags);
  List<MetricDatum> metrics = new ArrayList<MetricDatum>();

  /*
   * Create CW metric objects from bender internal Stat objects
   */
  for (Stat stat : stats) {
    /*
     * Dimension are CW's version of metric tags. A conversion must be done.
     */
    Collection<Dimension> metricDims = tagsToDimensions(stat.getTags());
    metricDims.addAll(parentDims);

    MetricDatum metric = new MetricDatum();
    metric.setMetricName(stat.getName());
    // TODO: add units to Stat object SYSTEMS-870
    metric.setUnit(StandardUnit.None);
    metric.setTimestamp(dt);
    metric.setDimensions(metricDims);
    metric.setValue((double) stat.getValue());

    metrics.add(metric);
  }

  /*
   * Not very well documented in java docs but CW only allows 20 metrics at a time.
   */
  List<List<MetricDatum>> chunks = ListUtils.partition(metrics, 20);
  for (List<MetricDatum> chunk : chunks) {
    PutMetricDataRequest req = new PutMetricDataRequest();
    req.withMetricData(chunk);
    req.setNamespace(namespace);

    this.client.putMetricData(req);
  }
}
 
开发者ID:Nextdoor,项目名称:bender,代码行数:42,代码来源:CloudwatchReporter.java


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