Repository navigation
feat(spanner): report built-in channel pool metrics - #15019
Open
uditdasari wants to merge 8 commits into
Open
uditdasari wants to merge 8 commits into
uditdasari wants to merge 8 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces built-in metrics for the gRPC-GCP channel pool in the Cloud Spanner Java client, including channel count and channel load metrics, along with corresponding configuration options and metadata attributes. The review feedback correctly identifies a compilation error in SpannerMetadataProvider.java due to missing imports for Cache and CacheBuilder. Additionally, it suggests refactoring the cache to use LoadingCache and CacheLoader, which simplifies the retrieval logic and eliminates the need for manual exception handling via getUnchecked.
…tests and trim comments
…he endpoint configurator directly
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This turns on the two channel pool metrics that grpc-gcp gained in #14947 and #14985 and sends them to Cloud Monitoring as Spanner built-in metrics.
What is reported
channel_pool/channel_count: the number of channels in the data pool per state (active,draining), with the labelslane,pool_modeandpool_index. The instance is reported asunknownbecause one pool serves many databases and instances, the same as the existing eef metrics. The project is the built-in metrics fallback project.channel_pool/channel_load: for each call, the number of calls that are open on the chosen channel, as a histogram with the boundaries 1, 2, 3, 5, 8, 12, 16, 20, 25, 30, 40, 50, 75, 100, 150, 200.project_id,instance_idanddatabasecome from the resource name of the request,laneandpool_modecome from the pool.Which pools report
pool_indexand are told apart bylane.lane, because its channels switch between the two paths.When nothing is reported
SPANNER_DISABLE_CHANNEL_POOL_BUILTIN_METRICS=true.CallContextConfigurators of the application.Cost
channel_countadds nothing per call.channel_loadadds one cached lookup of the resource name per call and carries the labels in the call options. Recording the value was measured in feat(grpc-gcp): add built-in channel_load metric for client library pools #14985 at about 38 ns per call with one thread, and up to about 1 µs per call when 8 threads write the same series at the same time.Testing
GapicSpannerRpcTestandSpannerMetadataProviderTestfor the options and the resource name parsing.ChannelPoolBuiltInMetricsTestruns a client against the mock server and checks that only the data pool reports, the lanes of the DirectPath fallback pools, the fallback recovery layout withoutlane, the switches that turn the metrics off, that application settings cannot change the metrics, and the labels and boundaries ofchannel_load.pool_index1 and 2), two databases, and the long-term series.