Package com.google.cloud.grpc
Class GcpManagedChannelOptions.Builder
java.lang.Object
com.google.cloud.grpc.GcpManagedChannelOptions.Builder
- Enclosing class:
- GcpManagedChannelOptions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()withChannelPoolOptions(GcpManagedChannelOptions.GcpChannelPoolOptions channelPoolOptions) Sets the channel pool configuration for theGcpManagedChannel.withMetricsOptions(GcpManagedChannelOptions.GcpMetricsOptions metricsOptions) Sets the metrics configuration for theGcpManagedChannel.withResiliencyOptions(GcpManagedChannelOptions.GcpResiliencyOptions resiliencyOptions) Sets the resiliency configuration for theGcpManagedChannel.
-
Constructor Details
-
Builder
public Builder() -
Builder
-
-
Method Details
-
build
-
withChannelPoolOptions
public GcpManagedChannelOptions.Builder withChannelPoolOptions(GcpManagedChannelOptions.GcpChannelPoolOptions channelPoolOptions) Sets the channel pool configuration for theGcpManagedChannel.- Parameters:
channelPoolOptions- aGcpManagedChannelOptions.GcpChannelPoolOptionsto use as a channel pool configuration.
-
withMetricsOptions
public GcpManagedChannelOptions.Builder withMetricsOptions(GcpManagedChannelOptions.GcpMetricsOptions metricsOptions) Sets the metrics configuration for theGcpManagedChannel.If a
MetricRegistryis provided inGcpManagedChannelOptions.GcpMetricsOptionsthen the GcpManagedChannel will emit metrics using that registry. The metrics options also allow to set up labels (tags) and a prefix for metrics names. The GcpManagedChannel will add its own label "pool_index" with values "pool-0", "pool-1", etc. for each instance of GcpManagedChannel created.Example usage (e. g. with export to Cloud Monitoring)
// Enable Cloud Monitoring exporter. StackdriverStatsExporter.createAndRegister(); // Configure metrics options. GcpMetricsOptions metricsOptions = GcpMetricsOptions.newBuilder(Metrics.getMetricRegistry()) .withNamePrefix("myapp/gcp-pool/") .build()); final GcpManagedChannel pool = (GcpManagedChannel) GcpManagedChannelBuilder.forDelegateBuilder(builder) .withOptions( GcpManagedChannelOptions.newBuilder() .withMetricsOptions(metricsOptions) .build()) .build(); // Use the pool that will emit metrics which will be exported to Cloud Monitoring.- Parameters:
metricsOptions- aGcpManagedChannelOptions.GcpMetricsOptionsto use as metrics configuration.
-
withResiliencyOptions
public GcpManagedChannelOptions.Builder withResiliencyOptions(GcpManagedChannelOptions.GcpResiliencyOptions resiliencyOptions) Sets the resiliency configuration for theGcpManagedChannel.- Parameters:
resiliencyOptions- aGcpManagedChannelOptions.GcpResiliencyOptionsto use as resiliency configuration.
-