Class MetricsClient
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource,AutoCloseable
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MetricsClient metricsClient = MetricsClient.create()) {
LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
LogMetric response = metricsClient.getLogMetric(metricName);
}
Note: close() needs to be called on the MetricsClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
ListLogMetrics |
Lists logs-based metrics. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLogMetric |
Gets a logs-based metric. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateLogMetric |
Creates a logs-based metric. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateLogMetric |
Creates or updates a logs-based metric. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteLogMetric |
Deletes a logs-based metric. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of MetricsSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
MetricsSettings metricsSettings =
MetricsSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
MetricsClient metricsClient = MetricsClient.create(metricsSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
MetricsSettings metricsSettings = MetricsSettings.newBuilder().setEndpoint(myEndpoint).build();
MetricsClient metricsClient = MetricsClient.create(metricsSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMetricsClient(MetricsSettings settings) Constructs an instance of MetricsClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final MetricsClientcreate()Constructs an instance of MetricsClient with default settings.static final MetricsClientcreate(MetricsSettings settings) Constructs an instance of MetricsClient, using the given settings.static final MetricsClientcreate(MetricsServiceV2Stub stub) Constructs an instance of MetricsClient, using the given stub for making calls.final LogMetriccreateLogMetric(CreateLogMetricRequest request) Creates a logs-based metric.final LogMetriccreateLogMetric(ProjectName parent, LogMetric metric) Creates a logs-based metric.final LogMetriccreateLogMetric(String parent, LogMetric metric) Creates a logs-based metric.final com.google.api.gax.rpc.UnaryCallable<CreateLogMetricRequest,LogMetric> Creates a logs-based metric.final voiddeleteLogMetric(DeleteLogMetricRequest request) Deletes a logs-based metric.final voiddeleteLogMetric(LogMetricName metricName) Deletes a logs-based metric.final voiddeleteLogMetric(String metricName) Deletes a logs-based metric.final com.google.api.gax.rpc.UnaryCallable<DeleteLogMetricRequest,com.google.protobuf.Empty> Deletes a logs-based metric.final LogMetricgetLogMetric(GetLogMetricRequest request) Gets a logs-based metric.final LogMetricgetLogMetric(LogMetricName metricName) Gets a logs-based metric.final LogMetricgetLogMetric(String metricName) Gets a logs-based metric.final com.google.api.gax.rpc.UnaryCallable<GetLogMetricRequest,LogMetric> Gets a logs-based metric.final MetricsSettingsgetStub()booleanbooleanlistLogMetrics(ListLogMetricsRequest request) Lists logs-based metrics.listLogMetrics(ProjectName parent) Lists logs-based metrics.listLogMetrics(String parent) Lists logs-based metrics.final com.google.api.gax.rpc.UnaryCallable<ListLogMetricsRequest,ListLogMetricsResponse> Lists logs-based metrics.final com.google.api.gax.rpc.UnaryCallable<ListLogMetricsRequest,MetricsClient.ListLogMetricsPagedResponse> Lists logs-based metrics.voidshutdown()voidfinal LogMetricupdateLogMetric(LogMetricName metricName, LogMetric metric) Creates or updates a logs-based metric.final LogMetricupdateLogMetric(UpdateLogMetricRequest request) Creates or updates a logs-based metric.final LogMetricupdateLogMetric(String metricName, LogMetric metric) Creates or updates a logs-based metric.final com.google.api.gax.rpc.UnaryCallable<UpdateLogMetricRequest,LogMetric> Creates or updates a logs-based metric.
-
Constructor Details
-
MetricsClient
Constructs an instance of MetricsClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.- Throws:
IOException
-
MetricsClient
-
-
Method Details
-
create
Constructs an instance of MetricsClient with default settings.- Throws:
IOException
-
create
Constructs an instance of MetricsClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
Constructs an instance of MetricsClient, using the given stub for making calls. This is for advanced usage - prefer using create(MetricsSettings). -
getSettings
-
getStub
-
listLogMetrics
Lists logs-based metrics.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); for (LogMetric element : metricsClient.listLogMetrics(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The name of the project containing the metrics:"projects/[PROJECT_ID]"
- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listLogMetrics
Lists logs-based metrics.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { String parent = ProjectName.of("[PROJECT]").toString(); for (LogMetric element : metricsClient.listLogMetrics(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The name of the project containing the metrics:"projects/[PROJECT_ID]"
- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listLogMetrics
public final MetricsClient.ListLogMetricsPagedResponse listLogMetrics(ListLogMetricsRequest request) Lists logs-based metrics.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); for (LogMetric element : metricsClient.listLogMetrics(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
listLogMetricsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListLogMetricsRequest,MetricsClient.ListLogMetricsPagedResponse> listLogMetricsPagedCallable()Lists logs-based metrics.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); ApiFuture<LogMetric> future = metricsClient.listLogMetricsPagedCallable().futureCall(request); // Do something. for (LogMetric element : future.get().iterateAll()) { // doThingsWith(element); } } -
listLogMetricsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListLogMetricsRequest,ListLogMetricsResponse> listLogMetricsCallable()Lists logs-based metrics.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { ListLogMetricsRequest request = ListLogMetricsRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); while (true) { ListLogMetricsResponse response = metricsClient.listLogMetricsCallable().call(request); for (LogMetric element : response.getMetricsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getLogMetric
Gets a logs-based metric.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]"); LogMetric response = metricsClient.getLogMetric(metricName); }- Parameters:
metricName- Required. The resource name of the desired metric:"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getLogMetric
Gets a logs-based metric.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString(); LogMetric response = metricsClient.getLogMetric(metricName); }- Parameters:
metricName- Required. The resource name of the desired metric:"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getLogMetric
Gets a logs-based metric.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { GetLogMetricRequest request = GetLogMetricRequest.newBuilder() .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString()) .build(); LogMetric response = metricsClient.getLogMetric(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
getLogMetricCallable
public final com.google.api.gax.rpc.UnaryCallable<GetLogMetricRequest,LogMetric> getLogMetricCallable()Gets a logs-based metric.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { GetLogMetricRequest request = GetLogMetricRequest.newBuilder() .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString()) .build(); ApiFuture<LogMetric> future = metricsClient.getLogMetricCallable().futureCall(request); // Do something. LogMetric response = future.get(); } -
createLogMetric
Creates a logs-based metric.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); LogMetric metric = LogMetric.newBuilder().build(); LogMetric response = metricsClient.createLogMetric(parent, metric); }- Parameters:
parent- Required. The resource name of the project in which to create the metric:"projects/[PROJECT_ID]"
The new metric must be provided in the request.
metric- Required. The new logs-based metric, which must not have an identifier that already exists.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createLogMetric
Creates a logs-based metric.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { String parent = ProjectName.of("[PROJECT]").toString(); LogMetric metric = LogMetric.newBuilder().build(); LogMetric response = metricsClient.createLogMetric(parent, metric); }- Parameters:
parent- Required. The resource name of the project in which to create the metric:"projects/[PROJECT_ID]"
The new metric must be provided in the request.
metric- Required. The new logs-based metric, which must not have an identifier that already exists.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createLogMetric
Creates a logs-based metric.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { CreateLogMetricRequest request = CreateLogMetricRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setMetric(LogMetric.newBuilder().build()) .build(); LogMetric response = metricsClient.createLogMetric(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
createLogMetricCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateLogMetricRequest,LogMetric> createLogMetricCallable()Creates a logs-based metric.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { CreateLogMetricRequest request = CreateLogMetricRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setMetric(LogMetric.newBuilder().build()) .build(); ApiFuture<LogMetric> future = metricsClient.createLogMetricCallable().futureCall(request); // Do something. LogMetric response = future.get(); } -
updateLogMetric
Creates or updates a logs-based metric.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]"); LogMetric metric = LogMetric.newBuilder().build(); LogMetric response = metricsClient.updateLogMetric(metricName, metric); }- Parameters:
metricName- Required. The resource name of the metric to update:"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
The updated metric must be provided in the request and it's `name` field must be the same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is created.
metric- Required. The updated metric.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
updateLogMetric
Creates or updates a logs-based metric.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString(); LogMetric metric = LogMetric.newBuilder().build(); LogMetric response = metricsClient.updateLogMetric(metricName, metric); }- Parameters:
metricName- Required. The resource name of the metric to update:"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
The updated metric must be provided in the request and it's `name` field must be the same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is created.
metric- Required. The updated metric.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
updateLogMetric
Creates or updates a logs-based metric.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder() .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString()) .setMetric(LogMetric.newBuilder().build()) .build(); LogMetric response = metricsClient.updateLogMetric(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
updateLogMetricCallable
public final com.google.api.gax.rpc.UnaryCallable<UpdateLogMetricRequest,LogMetric> updateLogMetricCallable()Creates or updates a logs-based metric.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder() .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString()) .setMetric(LogMetric.newBuilder().build()) .build(); ApiFuture<LogMetric> future = metricsClient.updateLogMetricCallable().futureCall(request); // Do something. LogMetric response = future.get(); } -
deleteLogMetric
Deletes a logs-based metric.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]"); metricsClient.deleteLogMetric(metricName); }- Parameters:
metricName- Required. The resource name of the metric to delete:"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
deleteLogMetric
Deletes a logs-based metric.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { String metricName = LogMetricName.of("[PROJECT]", "[METRIC]").toString(); metricsClient.deleteLogMetric(metricName); }- Parameters:
metricName- Required. The resource name of the metric to delete:"projects/[PROJECT_ID]/metrics/[METRIC_ID]"
- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
deleteLogMetric
Deletes a logs-based metric.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder() .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString()) .build(); metricsClient.deleteLogMetric(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException- if the remote call fails
-
deleteLogMetricCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteLogMetricRequest,com.google.protobuf.Empty> deleteLogMetricCallable()Deletes a logs-based metric.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (MetricsClient metricsClient = MetricsClient.create()) { DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder() .setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString()) .build(); ApiFuture<Empty> future = metricsClient.deleteLogMetricCallable().futureCall(request); // Do something. future.get(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfacecom.google.api.gax.core.BackgroundResource- Throws:
InterruptedException
-