Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,13 @@ void createMetricDescriptor(String type) throws IOException {
* @param name Name of metric descriptor to delete
*/
void deleteMetricDescriptor(String name) throws IOException {
// [START monitoring_delete_metric]
String projectId = System.getProperty("projectId");
final MetricServiceClient client = MetricServiceClient.create();
MetricDescriptorName metricName = MetricDescriptorName.create(projectId, name);
client.deleteMetricDescriptor(metricName);
System.out.println("Deleted descriptor " + name);
// [END monitoring_delete_metric]
}

/**
Expand Down Expand Up @@ -447,15 +449,15 @@ void listMonitoredResources() throws IOException {
for (MonitoredResourceDescriptor d : descriptors) {
System.out.println(d.getType());
}
// [START monitoring_list_resources]
// [END monitoring_list_resources]
}

/**
* Gets full information for a monitored resource.
* @param The resource type
*/
void describeMonitoredResources(String type) throws IOException {
// [START monitoring_list_resources]
// [START monitoring_get_descriptor]
// Your Google Cloud Platform project ID
String projectId = System.getProperty("projectId");

Expand All @@ -465,8 +467,7 @@ void describeMonitoredResources(String type) throws IOException {

System.out.println("Printing monitored resource descriptor: ");
System.out.println(response);

// [END monitoring_list_resources]
// [END monitoring_get_descriptor]
}


Expand Down