GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: add num_sessions_in_pool metric by mayurkale22 · Pull Request #128 · googleapis/java-spanner

This repository was archived by the owner on Aug 30, 2026. It is now read-only.

Conversation

@mayurkale22

@mayurkale22 mayurkale22 commented Mar 25, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Updates #53, this is based on the last discussion in the thread: #53 (comment)

This is how it looks in Stackdriver UI:
Screen Shot 2020-03-25 at 1 42 39 PM

Breaking Note:
The cloud.google.com/java/spanner/in_use_sessions metric has been deprecated since v1.55.2, use cloud.google.com/java/spanner/num_sessions_in_pool instead.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 25, 2020
@mayurkale22
mayurkale22 requested review from olavloite, rghetia and skuruppu and removed request for skuruppu March 25, 2020 23:44
@mayurkale22 mayurkale22 changed the title add num_sessions_in_pool metric feat: add num_sessions_in_pool metric Mar 25, 2020
skuruppu
skuruppu approved these changes Mar 26, 2020
View reviewed changes

@skuruppu skuruppu left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

My one concern is about removing metrics. Since we haven't had any metrics before, we don't have a process for it right now but open to hearing suggestions on how people do this in other products.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java
// The Metric name and description
static final String MAX_IN_USE_SESSIONS = "cloud.google.com/java/spanner/max_in_use_sessions";
static final String MAX_ALLOWED_SESSIONS = "cloud.google.com/java/spanner/max_allowed_sessions";
static final String IN_USE_SESSIONS = "cloud.google.com/java/spanner/in_use_sessions";

@skuruppu skuruppu Mar 26, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worried for anyone relying on this metric already in their monitoring? What is the process for deprecating metrics in OpenCensus? Is there some monitoring to figure out if someone is exporting it?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mayurkale22 mayurkale22 May 27, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the process for deprecating metrics in OpenCensus?

In OC, (usually) we first mark the existing API as deprecated and keep it for 18 months before removing it. I think the feature is fairly new and looks safe to remove it with a note in the Changelog.

Is there some monitoring to figure out if someone is exporting it?

I think it is feasible to see the ingested metrics in stackdriver, but I haven't done it personally.

I'm worried for anyone relying on this metric already in their monitoring?

Another option is keep existing(IN_USE_SESSIONS) metric along with new metric. In this case, in_use_sessions data will be accounted/exported twice.

WDYT?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@skuruppu skuruppu May 29, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think you're right that this is relatively new. We will mark this in the Changelog.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@skuruppu skuruppu May 29, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can include something about this in the PR description, that would be great. Then we can copy it in when doing the release.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mayurkale22 mayurkale22 May 29, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
olavloite
olavloite approved these changes Mar 26, 2020
View reviewed changes

@olavloite olavloite left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
One thing we should keep in the back of our heads is that sum of these new metrics could vary a little bit, even in a situation where the actual number of sessions in the pool is steady. Each individual value is read independently of each other, and it is possible that a session is counted twice or not at all, for example when it is transferred from numSessionsBeingPrepared to numWritePreparedSessions. That could cause some confusion for users, especially when they have configured the session pool with MinSessions=MaxSessions. In that case you would expect the number of sessions in the pool to always be constant.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
rghetia
rghetia reviewed Mar 27, 2020
View reviewed changes
Comment thread google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java
.containsEntry(MetricRegistryConstants.NUM_ACQUIRED_SESSIONS, 3L);
assertThat(record.getMetrics())
.containsEntry(MetricRegistryConstants.NUM_RELEASED_SESSIONS, 3L);
assertThat(record.getMetrics()).containsEntry(MetricRegistryConstants.IN_USE_SESSIONS, 0L);

@rghetia rghetia Mar 27, 2020

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No test for new Gauges?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mayurkale22 mayurkale22 May 27, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added test to validate newly added Metric. I had to modify MetricRegistryTestUtils to support and test multiple timeseries entries. PTAL when you get a chance.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rghetia reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@hengfengli

hengfengli commented May 26, 2020

Copy link
Copy Markdown
Contributor

@mayurkale22 I just want to check what is latest status of this PR? any progress?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mayurkale22

mayurkale22 commented May 26, 2020

Copy link
Copy Markdown
Contributor Author

@mayurkale22 I just want to check what is latest status of this PR? any progress?

Oops! This went off my radar due to other priorities. I'm going to rebase the PR and fix unresolved comments soon.

Thanks for bringing this to my attention.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mayurkale22 mayurkale22 mentioned this pull request May 27, 2020
chore: document OpenCensus Metrics #244
Merged
rghetia
rghetia approved these changes May 29, 2020
View reviewed changes
@mayurkale22

mayurkale22 commented Jun 1, 2020

Copy link
Copy Markdown
Contributor Author

@skuruppu @olavloite do you know why build is failing (Kokoro - Test: Integration), looks unrelated to my change.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@olavloite olavloite added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 2, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 2, 2020
@olavloite

olavloite commented Jun 2, 2020

Copy link
Copy Markdown
Contributor

@mayurkale22 That is unfortunately an (infrastructure) problem that we are running into on a semi-regular basis. It has nothing to do with your change, and the only way to circumvent it at the moment is triggering a new build, for example by adding the kokoro:force-run label to the PR.

mayurkale22 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mayurkale22 mayurkale22 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 2, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 2, 2020
@hengfengli hengfengli added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 3, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 3, 2020
@mayurkale22 mayurkale22 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 4, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 4, 2020
mayurkale22 added 2 commits June 4, 2020 00:20
@mayurkale22
feat: add num_sessions_in_pool metric
cf3981b
@mayurkale22
add tests
b5ac645
@codecov

codecov Bot commented Jun 4, 2020

Copy link
Copy Markdown

Codecov Report

❗ No coverage uploaded for pull request base (master@1ec0f34). Click here to learn what that means.
The diff coverage is n/a.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@skuruppu

skuruppu commented Jun 4, 2020

Copy link
Copy Markdown
Contributor

@olavloite, the latest failure is interesting:

com.google.cloud.spanner.SpannerException: INVALID_ARGUMENT: com.google.api.gax.rpc.InvalidArgumentException: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Query optimizer version: 10000 is not supported

would you be able to take a quick look?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@olavloite

olavloite commented Jun 4, 2020

Copy link
Copy Markdown
Contributor

@olavloite, the latest failure is interesting:

com.google.cloud.spanner.SpannerException: INVALID_ARGUMENT: com.google.api.gax.rpc.InvalidArgumentException: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Query optimizer version: 10000 is not supported

would you be able to take a quick look?

Hmmm... That's strange. There has been no changes to the test case lately, so my initial guess would be that the backend is now reacting differently. Up until now the backend accepted query options to be specified for DML statements, but seemed to ignore them. Now it seems that they are at least checked for a valid value.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@skuruppu

skuruppu commented Jun 4, 2020

Copy link
Copy Markdown
Contributor

That's interesting. I also wondered why this suddenly came up given that we haven't touched this code in a couple of months.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@olavloite

olavloite commented Jun 4, 2020

Copy link
Copy Markdown
Contributor

That's interesting. I also wondered why this suddenly came up given that we haven't touched this code in a couple of months.

I think we should just remove this specific test case for now, and ask the backend team what the expected behavior of QueryOptions should be for DML statements.

skuruppu reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@skuruppu skuruppu added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 11, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jun 11, 2020
@skuruppu
skuruppu merged commit 3a7a8ad into googleapis:master Jun 11, 2020
@mayurkale22 mayurkale22 mentioned this pull request Aug 31, 2020
chore: fix OpenCensus metrics list #408
Merged
rajatbhatta pushed a commit to rajatbhatta/java-spanner that referenced this pull request Nov 17, 2022
@renovate-bot
deps: update dependency com.google.api.grpc:proto-google-common-proto…
3f00adb
…s to v1.18.0 (googleapis#128)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [com.google.api.grpc:proto-google-common-protos](https://togithub.com/googleapis/java-iam) | minor | `1.17.0` -> `1.18.0` |

---

### Renovate configuration

:date: **Schedule**: At any time (no schedule defined).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/java-spanner-jdbc).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

3 more reviewers
@skuruppu skuruppu skuruppu approved these changes
@olavloite olavloite olavloite approved these changes
@rghetia rghetia rghetia approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@mayurkale22 @hengfengli @olavloite @skuruppu @rghetia @googlebot @yoshi-kokoro
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.