Esempio n. 1
0
  /**
   * Pushes metrics to CloudWatch.
   *
   * @param cloudWatchApi the {@link CloudWatchApi} to use for the request
   * @param region the region to put the metrics in
   * @param metrics the metrics to publish
   * @param namespace the namespace to publish the metrics in
   */
  public static void putMetricData(
      CloudWatchApi cloudWatchApi, String region, Iterable<MetricDatum> metrics, String namespace) {
    MetricApi metricApi = cloudWatchApi.getMetricApiForRegion(region);

    for (List<MetricDatum> slice : Iterables.partition(metrics, 10)) {
      metricApi.putMetricsInNamespace(slice, namespace);
    }
  }
Esempio n. 2
0
 /**
  * List metrics based on the criteria in the {@link ListMetricsOptions} passed in.
  *
  * @param cloudWatchApi the {@link CloudWatchApi} to use for the request
  * @param region the region to list metrics in
  * @param options the options describing the ListMetrics request
  * @return iterable of metrics fitting the criteria
  */
 public static Iterable<Metric> listMetrics(
     CloudWatchApi cloudWatchApi, String region, final ListMetricsOptions options) {
   return listMetrics(cloudWatchApi.getMetricApiForRegion(region), options);
 }