feat: instrument Spanner client with OpenCensus metrics #54
This file contains 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
gopherbot pushed a commit to googleapis/google-cloud-go that referenced this issue
Mar 31, 2020
This change addes five metrics for session management: * in_use_sessions: the current number of sessions that are checked out from the session pool. * max_in_use_sessions: the maximum number of in_use_sessions in last 10 minutes. This is based on tumbling windows, instead of sliding windows. * max_allowed_sessions: the maximum number of sessions that is configured by the user. * get_sessions_timeout: the cumulative number of get sessions timeouts when pool exhaustion happens. * num_acquired_sessions: the cumulative number of sessions that are checked out from the session pool. * num_released_sessions: the cumulative number of sessions that are released back to the session pool. All metrics are tagged by: * client_id: each database has its own increasing ID sequence. For two different databases, their client IDs all start from "client-1". * database: the database ID. * instance_id: the instance ID. * library_version: the library version from google-cloud-go/internal/version which is a date in YYYYMMDD format. Notes: There are three ways to check out a session from the pool: 1) take(): get a read session called by a user 2) takeWriteSession(): get a read/write session by a user 3) getNextForTx() in healthchecker's worker (session.go:1336): healthchecker's workers convert read sessions to r/w sessions. E.g., when initializing the pool, workers check out 20 read sessions from the pool, turn them into r/w sessions, and put them back to the pool , assume that MinOpended=100 and WriteSessions=0.2. So some metrics are also emitted by case 3. This might confuse users if they are not aware of this behaviour. Related Java PRs: * googleapis/java-spanner#54 * googleapis/java-spanner#65 * googleapis/java-spanner#67 Change-Id: Ie163b08ef18ac2a47e1669fefab92d61fe8f2a82 Reviewed-on: https://code-review.googlesource.com/c/gocloud/+/52953 Reviewed-by: kokoro <email@example.com> Reviewed-by: Knut Olav Løite <firstname.lastname@example.org>
This human has signed the Contributor License Agreement.
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.