Skip to content

Instrument Spanner client (session pool) with OpenCensus metrics #53

@mayurkale22

Description

@mayurkale22

Is your feature request related to a problem? Please describe.
Customers run into the Cloud Spanner session pool tuning issues for their specific workload on a regular basis. Improved visibility into the state of the session pool (or client side metrics) maintained by each client can provide actionable insight and help users take informed decisions.

This will also help customers in identifying a session leaks.

Describe the solution you'd like
Instrument Spanner client (session pool) with OpenCensus metrics. we need to capture things including - number of max sessions, number of sessions in use, leaked sessions, count of active spanner requests, count of released and acquired sessions.

Describe alternatives you've considered
N/A

Additional context
N/A

===================================================================
Edit1: Agreed list of useful metrics:

All the metrics will be prefixed by “cloud.google.com/java/spanner/”.

Metric Description Type Labels
max_in_use_sessions The maximum number of sessions in use during the last 10 minute interval Gauge database, instance_id, library_version
max_allowed_sessions The maximum number of sessions allowed. Configurable by the user Gauge database, instance_id, library_version
in_use_sessions The number of sessions currently in use Gauge database, instance_id, library_version
get_session_timeouts The number of get sessions timeouts due to pool exhaustion Counter database, instance_id, library_version
num_acquired_sessions The number of sessions acquired from the session pool Counter database, instance_id, library_version
num_released_sessions The number of sessions released by the user and pool maintainer Counter database, instance_id, library_version
num_sessions_in_pool The number of sessions in the pool. Gauge database, instance_id, library_version, Type
  • Type : num_in_use_sessions | num_sessions_being_prepared | num_read_sessions | num_write_prepared_sessions

/cc @skuruppu

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the googleapis/java-spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions