use of com.google.cloud.logging.MetricInfo in project google-cloud-java by GoogleCloudPlatform.
the class LoggingSnippets method updateMetricAsync.
/**
* Example of asynchronously updating a metric.
*/
// [TARGET updateAsync(MetricInfo)]
// [VARIABLE "my_metric_name"]
public Metric updateMetricAsync(String metricName) throws ExecutionException, InterruptedException {
// [START updateMetricAsync]
MetricInfo metricInfo = MetricInfo.newBuilder(metricName, "severity>=ERROR").setDescription("new description").build();
Future<Metric> future = logging.updateAsync(metricInfo);
// ...
Metric metric = future.get();
// [END updateMetricAsync]
return metric;
}
Aggregations