New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: remove time series before adding it #766
Conversation
Adding the same time series multiple times will cause an error in OpenCensus. A time series could be added multiple times for the same Database client id if a database client was invalidated, for example because if was created for a database that did not exist. Fixes #202
Codecov Report
@@ Coverage Diff @@
## master #766 +/- ##
=========================================
Coverage 85.00% 85.00%
Complexity 2562 2562
=========================================
Files 143 143
Lines 14007 14016 +9
Branches 1338 1338
=========================================
+ Hits 11906 11915 +9
Misses 1538 1538
Partials 563 563
Continue to review full report at Codecov.
|
@olavloite Thanks for fixing issue #202! I tested this PR with my application, and it worked with OpenCensus 0.26.0 as well as 0.28.0. |
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 I understand correctly, the issue with increasing client IDs could still occur if a different exception were thrown from
java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerImpl.java
Line 225 in c99294b
SessionPool.createPool( |
That is correct.
I'm somewhat reluctant to do that. As I see it, the real problem here is not that the client IDs are increasing, but the fact that |
That makes sense. I didn't realize that createPool was designed to not throw exceptions. |
@olavloite Just for my understanding, won't this remove historical data (time series data) if the user redeploys their application? |
Good question. It won't be a problem after a redeploy, as these time-series are all in-memory on the local client, so these data structures will be all empty after a redeploy. But I'll take an extra look to check that it won't be a problem if a |
I've been stepping through the OpenCensus implementation, and my conclusion based on that is:
It is however important to realize that any in-mem sampling data will only be lost in the case that:
|
Thanks for the analysis @olavloite. LGTM |
Adding the same time series multiple times will cause an error in OpenCensus. A time series could be added multiple times for the same Database client id if a database client was invalidated, for example because if was created for a database that did not exist. Fixes #202
This is an auto-generated regeneration of the .pb.go files by cloud.google.com/go/internal/gapicgen. Once this PR is submitted, genbot will update the corresponding PR to depend on the newer version of go-genproto, and assign reviewers. Whilst this or any regen PR is open in go-genproto, genbot will not create any more regeneration PRs. If all regen PRs are closed, gapicgen will create a new set of regeneration PRs once per night. If you have been assigned to review this PR, please: - Ensure that CI is passing. If it's failing, it requires your manual attention. - Approve and submit this PR if you believe it's ready to ship. That will prompt genbot to assign reviewers to the google-cloud-go PR. Corresponding google-cloud-go PR: googleapis/google-cloud-go#5699 Changes: chore: use gapic-generator-python 0.63.4 chore: fix snippet region tag format chore: fix docstring code block formatting PiperOrigin-RevId: 430730865 Source-Link: googleapis/googleapis@ea58002 feat(gkehub): added support for k8s_version field docs: k8s_version field is not part of resource_options struct Clients now generate the V1 or V1beta1 CRD based on Kubernetes server version. PiperOrigin-RevId: 430569173 Source-Link: googleapis/googleapis@3c17193 chore: new versions of Ruby and PHP generators with rebuilt runtimes PiperOrigin-RevId: 430539125 Source-Link: googleapis/googleapis@9e18f9c feat: added support for k8s_version field docs: k8s_version field is not part of resource_options struct Clients now generate the V1 or V1beta1 CRD based on Kubernetes server version. PiperOrigin-RevId: 430496281 Source-Link: googleapis/googleapis@97cf70e chore: regenerate API index Source-Link: googleapis/googleapis@5a1add9 refactor: use updated protos for DeliveryService PiperOrigin-RevId: 430330814 Source-Link: googleapis/googleapis@948c8fd Synchronize new proto/yaml changes. PiperOrigin-RevId: 430323776 Source-Link: googleapis/googleapis@88075ae chore(bigquery/migration): move gRPC service config for BigQuery Migration API to the proper place PiperOrigin-RevId: 430291802 Source-Link: googleapis/googleapis@026165e feat(aiplatform): add TPU_V2 & TPU_V3 values to AcceleratorType in aiplatform v1/v1beta1 accelerator_type.proto PiperOrigin-RevId: 430259767 Source-Link: googleapis/googleapis@f873e7f build: update artifact name for npm PiperOrigin-RevId: 430257044 Source-Link: googleapis/googleapis@3e5d2ea chore: regenerate API index Source-Link: googleapis/googleapis@7af9c68 feat(logging): KMS configuration in settings chore: formatting changes PiperOrigin-RevId: 430243637 Source-Link: googleapis/googleapis@95da686 chore: regenerate API index Source-Link: googleapis/googleapis@fec96b7 fix(dataflow): Use http binding with location field as primary http bindings Changing HTTP bindings and/or their order might be a breaking change for libraries. PiperOrigin-RevId: 430239565 Source-Link: googleapis/googleapis@71fe7ff
…jdbc to v2.6.0 (googleapis#766) [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:google-cloud-spanner-jdbc](https://togithub.com/googleapis/java-spanner-jdbc) | `2.5.11` -> `2.6.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-jdbc/2.6.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-jdbc/2.6.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-jdbc/2.6.0/compatibility-slim/2.5.11)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:google-cloud-spanner-jdbc/2.6.0/confidence-slim/2.5.11)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>googleapis/java-spanner-jdbc</summary> ### [`v2.6.0`](https://togithub.com/googleapis/java-spanner-jdbc/blob/HEAD/CHANGELOG.md#​260-httpsgithubcomgoogleapisjava-spanner-jdbccomparev2511v260-2022-02-24) [Compare Source](https://togithub.com/googleapis/java-spanner-jdbc/compare/v2.5.11...v2.6.0) ##### Features - add support for PostgreSQL dialect ([#​739](https://togithub.com/googleapis/java-spanner-jdbc/issues/739)) ([f9daa19](https://togithub.com/googleapis/java-spanner-jdbc/commit/f9daa19453b33252bf61160ff9cde1c37284ca2b)) ##### Bug Fixes - create specific metadata queries for PG ([#​759](https://togithub.com/googleapis/java-spanner-jdbc/issues/759)) ([caffda0](https://togithub.com/googleapis/java-spanner-jdbc/commit/caffda03e528da6a3c2c17b7058eb5d29f5086f9)) ##### Dependencies - update dependency com.google.cloud:google-cloud-spanner-bom to v6.20.0 ([#​758](https://togithub.com/googleapis/java-spanner-jdbc/issues/758)) ([311d1ca](https://togithub.com/googleapis/java-spanner-jdbc/commit/311d1cabff7e7e2f5cf2cdcdda90ba536eadfa68)) ##### [2.5.11](https://togithub.com/googleapis/java-spanner-jdbc/compare/v2.5.10...v2.5.11) (2022-02-11) ##### Dependencies - update actions/github-script action to v6 ([#​745](https://togithub.com/googleapis/java-spanner-jdbc/issues/745)) ([2ccd5b8](https://togithub.com/googleapis/java-spanner-jdbc/commit/2ccd5b8ac878c81535c14e404aeaf67e6e41a464)) ##### [2.5.10](https://togithub.com/googleapis/java-spanner-jdbc/compare/v2.5.9...v2.5.10) (2022-02-09) ##### Dependencies - update dependency com.google.cloud:google-cloud-spanner-bom to v6.18.0 ([#​734](https://togithub.com/googleapis/java-spanner-jdbc/issues/734)) ([52f407a](https://togithub.com/googleapis/java-spanner-jdbc/commit/52f407a5e73d13fdeb9b5438d6e5cbd026cb3942)) ##### [2.5.9](https://togithub.com/googleapis/java-spanner-jdbc/compare/v2.5.8...v2.5.9) (2022-02-03) ##### Bug Fixes - **java:** replace excludedGroup with exclude ([#​720](https://togithub.com/googleapis/java-spanner-jdbc/issues/720)) ([7f13c88](https://togithub.com/googleapis/java-spanner-jdbc/commit/7f13c88f8c9e509de8c82cb788ab9b4964806381)) ##### Dependencies - **java:** update actions/github-script action to v5 ([#​1339](https://togithub.com/googleapis/java-spanner-jdbc/issues/1339)) ([#​725](https://togithub.com/googleapis/java-spanner-jdbc/issues/725)) ([4f96ec1](https://togithub.com/googleapis/java-spanner-jdbc/commit/4f96ec1c864b176564ac3200565b5ea524d8adfb)) - update actions/github-script action to v5 ([#​724](https://togithub.com/googleapis/java-spanner-jdbc/issues/724)) ([5c1d6ff](https://togithub.com/googleapis/java-spanner-jdbc/commit/5c1d6ff72ba81dac101904f1ebd63e4a09b47c64)) - update dependency com.google.cloud:google-cloud-shared-dependencies to v2.7.0 ([#​728](https://togithub.com/googleapis/java-spanner-jdbc/issues/728)) ([b0a32d8](https://togithub.com/googleapis/java-spanner-jdbc/commit/b0a32d807cdf2458b60437ade38fa46511254701)) - update opencensus.version to v0.31.0 ([#​727](https://togithub.com/googleapis/java-spanner-jdbc/issues/727)) ([fce0770](https://togithub.com/googleapis/java-spanner-jdbc/commit/fce077056fbf55395a736dc1f58f8ecbc89eb10d)) ##### [2.5.8](https://www.github.com/googleapis/java-spanner-jdbc/compare/v2.5.7...v2.5.8) (2022-01-07) ##### Dependencies - update dependency com.google.cloud:google-cloud-spanner-bom to v6.17.4 ([#​709](https://www.togithub.com/googleapis/java-spanner-jdbc/issues/709)) ([bd12d7c](https://www.github.com/googleapis/java-spanner-jdbc/commit/bd12d7c33b18ceb1df417df8e275ffa745b195b2)) ##### [2.5.7](https://www.github.com/googleapis/java-spanner-jdbc/compare/v2.5.6...v2.5.7) (2022-01-07) ##### Dependencies - update dependency com.google.cloud:google-cloud-shared-dependencies to v2.6.0 ([#​704](https://www.togithub.com/googleapis/java-spanner-jdbc/issues/704)) ([bae659c](https://www.github.com/googleapis/java-spanner-jdbc/commit/bae659cac5a010c17767cdf4b3569e654efb605c)) ##### [2.5.6](https://www.github.com/googleapis/java-spanner-jdbc/compare/v2.5.5...v2.5.6) (2021-12-17) ##### Bug Fixes - **java:** add -ntp flag to native image testing command ([#​1299](https://www.togithub.com/googleapis/java-spanner-jdbc/issues/1299)) ([#​688](https://www.togithub.com/googleapis/java-spanner-jdbc/issues/688)) ([4438aca](https://www.github.com/googleapis/java-spanner-jdbc/commit/4438aca73b9c8b33fa1edd23f823d87a093a6d59)) ##### Dependencies - update OpenCensus API to 0.30.0 ([#​694](https://www.togithub.com/googleapis/java-spanner-jdbc/issues/694)) ([345f136](https://www.github.com/googleapis/java-spanner-jdbc/commit/345f1366a7dd96f3b28afd353c5c23ebeff60c6b)) ##### [2.5.5](https://www.github.com/googleapis/java-spanner-jdbc/compare/v2.5.4...v2.5.5) (2021-12-03) ##### Dependencies - update dependency com.google.cloud:google-cloud-shared-dependencies to v2.5.1 ([#​684](https://www.togithub.com/googleapis/java-spanner-jdbc/issues/684)) ([a2582d3](https://www.github.com/googleapis/java-spanner-jdbc/commit/a2582d3fbd3f0ea093477914e3a09af235e76595)) ##### [2.5.4](https://www.github.com/googleapis/java-spanner-jdbc/compare/v2.5.3...v2.5.4) (2021-11-17) ##### Dependencies - update dependency com.google.cloud:google-cloud-spanner-bom to v6.16.0 ([#​673](https://www.togithub.com/googleapis/java-spanner-jdbc/issues/673)) ([b4cc056](https://www.github.com/googleapis/java-spanner-jdbc/commit/b4cc0568e440b6a377cb4d8224c46057cd3ce1ee)) ##### [2.5.3](https://www.github.com/googleapis/java-spanner-jdbc/compare/v2.5.2...v2.5.3) (2021-11-15) ##### Dependencies - update dependency com.google.cloud:google-cloud-shared-dependencies to v2.5.0 ([#​668](https://www.togithub.com/googleapis/java-spanner-jdbc/issues/668)) ([d453234](https://www.github.com/googleapis/java-spanner-jdbc/commit/d45323445d3e4a0753bed6cfe858fa891bca468e)) ##### [2.5.2](https://www.github.com/googleapis/java-spanner-jdbc/compare/v2.5.1...v2.5.2) (2021-11-11) ##### Dependencies - update dependency com.google.cloud:google-cloud-spanner-bom to v6.15.2 ([#​664](https://www.togithub.com/googleapis/java-spanner-jdbc/issues/664)) ([9f22c33](https://www.github.com/googleapis/java-spanner-jdbc/commit/9f22c331ee4c7340ed6f1b9f91a44ce1e4c5b792)) ##### [2.5.1](https://www.github.com/googleapis/java-spanner-jdbc/compare/v2.5.0...v2.5.1) (2021-10-27) ##### Dependencies - update dependency com.google.cloud:google-cloud-spanner-bom to v6.15.1 ([#​652](https://www.togithub.com/googleapis/java-spanner-jdbc/issues/652)) ([37d42d9](https://www.github.com/googleapis/java-spanner-jdbc/commit/37d42d91e49da9d30ca0d06b6a01bbe918fc3ab6)) </details> --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-spanner-jdbc).
Adding the same time series multiple times will cause an error in OpenCensus. A time series could be added multiple times for the same Database client id if a database client was invalidated, for example because if was created for a database that did
not exist.
This works for OpenCensusImpl 0.26 but not for 0.24, but that seems to be the case both with and without this change. With this change the problem is solved for 0.26. In version 0.24 OpenCensusImpl will always throw an error if you try to add a metric with the same name twice.
Fixes #202