List of usage examples for com.amazonaws.services.cloudwatch.model MetricDatum getDimensions
public java.util.List<Dimension> getDimensions()
The dimensions associated with the metric.
From source file:com.amazon.kinesis.streaming.agent.metrics.CWMetricKey.java
License:Open Source License
/** * @param datum data point/*w ww. j a v a 2s . com*/ */ public CWMetricKey(MetricDatum datum) { this.dimensions = datum.getDimensions(); this.metricName = datum.getMetricName(); }
From source file:com.github.lpezet.antiope.metrics.aws.BlockingRequestBuilder.java
License:Open Source License
/** * Summarizes the given datum into the statistics of the respective unique metric. *///w ww . ja v a 2 s . c o m private void summarize(MetricDatum pDatum, Map<String, MetricDatum> pUniqueMetrics) { Double pValue = pDatum.getValue(); if (pValue == null) { return; } List<Dimension> oDims = pDatum.getDimensions(); Collections.sort(oDims, DimensionComparator.INSTANCE); String oMetricName = pDatum.getMetricName(); String k = oMetricName + Jackson.toJsonString(oDims); MetricDatum oStatDatum = pUniqueMetrics.get(k); if (oStatDatum == null) { oStatDatum = new MetricDatum().withDimensions(pDatum.getDimensions()).withMetricName(oMetricName) .withUnit(pDatum.getUnit()).withStatisticValues(new StatisticSet().withMaximum(pValue) .withMinimum(pValue).withSampleCount(0.0).withSum(0.0)); pUniqueMetrics.put(k, oStatDatum); } StatisticSet oStat = oStatDatum.getStatisticValues(); oStat.setSampleCount(oStat.getSampleCount() + 1.0); oStat.setSum(oStat.getSum() + pValue); if (pValue > oStat.getMaximum()) { oStat.setMaximum(pValue); } else if (pValue < oStat.getMinimum()) { oStat.setMinimum(pValue); } }
From source file:com.github.lpezet.antiope.metrics.aws.BlockingRequestBuilder.java
License:Open Source License
/** * Returns a metric datum cloned from the given one. * Made package private only for testing purposes. *///www.j a v a2s . com final MetricDatum cloneMetricDatum(MetricDatum pMd) { return new MetricDatum().withDimensions(pMd.getDimensions()) // a new collection is created .withMetricName(pMd.getMetricName()).withStatisticValues(pMd.getStatisticValues()) .withTimestamp(pMd.getTimestamp()).withUnit(pMd.getUnit()).withValue(pMd.getValue()); }
From source file:org.web.online.cloudwatch.tomcat.valve.ElapsedTimeAggregator.java
License:Apache License
/** * @return a string representation of this object *//*from w w w . j a v a2s. c o m*/ @Override public String toString() { StringBuilder sb = new StringBuilder("{ElapsedTimeAggregator: {"); String namespace = putMetricDataRequest.getNamespace(); sb.append("region: ").append(region).append(", "); sb.append("namespace: ").append(namespace).append(", "); sb.append("metrics: ["); String msep = ""; for (MetricDatum metricDatum : putMetricDataRequest.getMetricData()) { sb.append(msep).append("{metricName: ").append(metricDatum.getMetricName()).append(", "); sb.append("dimensions: ["); String dsep = ""; for (Dimension dimension : metricDatum.getDimensions()) { sb.append(dsep).append(dimension); dsep = ", "; } sb.append("]}"); msep = ", "; } sb.append("]}}"); return sb.toString(); }