Java Code Examples for com.amazonaws.services.cloudwatch.model.PutMetricDataRequest#setNamespace()
The following examples show how to use
com.amazonaws.services.cloudwatch.model.PutMetricDataRequest#setNamespace() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CloudWatchAlertDispatcher.java From s3mper with Apache License 2.0 | 5 votes |
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); }
Example 2
Source File: CloudWatchAlertDispatcher.java From s3mper with Apache License 2.0 | 5 votes |
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); }
Example 3
Source File: CloudWatchRecorder.java From swage with Apache License 2.0 | 4 votes |
private void sendData( Collection<MetricDatum> metricData ) { PutMetricDataRequest request = new PutMetricDataRequest(); request.setNamespace( namespace ); request.setMetricData( metricData ); metricsClient.putMetricData( request ); }
Example 4
Source File: CloudwatchReporter.java From bender with Apache License 2.0 | 4 votes |
@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); } }