From 2dc65447405c0c11a40bc51aa5e230056194c527 Mon Sep 17 00:00:00 2001 From: Mayur Kale Date: Thu, 6 Feb 2020 17:20:09 -0800 Subject: [PATCH 1/9] feat: add session timeout metric --- .../spanner/MetricRegistryConstants.java | 4 ++ .../com/google/cloud/spanner/SessionPool.java | 24 ++++++++++++ .../spanner/MetricRegistryTestUtils.java | 28 +++++++++++++- .../google/cloud/spanner/SessionPoolTest.java | 38 +++++++++++++++++-- 4 files changed, 90 insertions(+), 4 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java index a79fe550d70..542c1ec0da4 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java @@ -45,9 +45,13 @@ class MetricRegistryConstants { static final String MAX_IN_USE_SESSIONS = "cloud.google.com/java/spanner/max_in_use_session"; 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"; + static final String SESSIONS_TIMEOUT = "cloud.google.com/java/spanner/sessions_timeout"; + static final String MAX_IN_USE_SESSIONS_DESCRIPTION = "The maximum number of sessions in use during the last 10 minute interval."; static final String MAX_ALLOWED_SESSIONS_DESCRIPTION = "The maximum number of sessions allowed. Configurable by the user."; static final String IN_USE_SESSIONS_DESCRIPTION = "The number of sessions currently in use."; + static final String SESSIONS_TIMEOUT_DESCRIPTION = + "The count of number of sessions timeout due to pool exhaustion"; } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java index 76953713eec..d9dc0073ac7 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java @@ -23,6 +23,8 @@ import static com.google.cloud.spanner.MetricRegistryConstants.MAX_ALLOWED_SESSIONS_DESCRIPTION; import static com.google.cloud.spanner.MetricRegistryConstants.MAX_IN_USE_SESSIONS; import static com.google.cloud.spanner.MetricRegistryConstants.MAX_IN_USE_SESSIONS_DESCRIPTION; +import static com.google.cloud.spanner.MetricRegistryConstants.SESSIONS_TIMEOUT; +import static com.google.cloud.spanner.MetricRegistryConstants.SESSIONS_TIMEOUT_DESCRIPTION; import static com.google.cloud.spanner.MetricRegistryConstants.SPANNER_DEFAULT_LABEL_VALUES; import static com.google.cloud.spanner.MetricRegistryConstants.SPANNER_LABEL_KEYS; import static com.google.cloud.spanner.SpannerExceptionFactory.newSpannerException; @@ -50,6 +52,7 @@ import com.google.protobuf.Empty; import io.opencensus.common.Scope; import io.opencensus.common.ToLongFunction; +import io.opencensus.metrics.DerivedLongCumulative; import io.opencensus.metrics.DerivedLongGauge; import io.opencensus.metrics.LabelValue; import io.opencensus.metrics.MetricOptions; @@ -1845,6 +1848,15 @@ private void initMetricsCollection(MetricRegistry metricRegistry, List() { + @Override + public long applyAsLong(SessionPool sessionPool) { + return sessionPool.getNumWaiterTimeouts(); + } + }); } } diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MetricRegistryTestUtils.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MetricRegistryTestUtils.java index fe9252d1f91..a3444baac7e 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MetricRegistryTestUtils.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MetricRegistryTestUtils.java @@ -96,6 +96,32 @@ public void removeTimeSeries(List list) {} public void clear() {} } + public static final class FakeDerivedLongCumulative extends DerivedLongCumulative { + private final MetricsRecord record; + private final String name; + private final List labelKeys; + + private FakeDerivedLongCumulative( + FakeMetricRegistry metricRegistry, String name, List labelKeys) { + this.record = metricRegistry.record; + this.labelKeys = labelKeys; + this.name = name; + } + + @Override + public void createTimeSeries( + List labelValues, T t, ToLongFunction toLongFunction) { + this.record.metrics.put(this.name, new PointWithFunction(t, toLongFunction)); + this.record.labels.put(this.labelKeys, labelValues); + } + + @Override + public void removeTimeSeries(List list) {} + + @Override + public void clear() {} + } + /** * A {@link MetricRegistry} implementation that saves metrics records to be accessible from {@link * #pollRecord()}. @@ -144,7 +170,7 @@ public DoubleCumulative addDoubleCumulative(String s, MetricOptions metricOption @Override public DerivedLongCumulative addDerivedLongCumulative(String s, MetricOptions metricOptions) { - throw new UnsupportedOperationException(); + return new FakeDerivedLongCumulative(this, s, metricOptions.getLabelKeys()); } @Override diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java index 507d94b12aa..033cb7e5326 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java @@ -1561,12 +1561,14 @@ public void run() { } @Test - public void testSessionMetrics() { + public void testSessionMetrics() throws Exception { + // Create a session pool with max 2 session and a low timeout for waiting for a session. options = SessionPoolOptions.newBuilder() .setMinSessions(1) - .setMaxSessions(3) + .setMaxSessions(2) .setMaxIdleSessions(0) + .setInitialWaitForSessionTimeoutMillis(20L) .build(); FakeClock clock = new FakeClock(); clock.currentTimeMillis = System.currentTimeMillis(); @@ -1583,16 +1585,46 @@ public void testSessionMetrics() { Session session2 = pool.getReadSession(); MetricsRecord record = metricRegistry.pollRecord(); + assertThat(record.getMetrics().size()).isEqualTo(4); assertThat(record.getMetrics()).containsEntry(MetricRegistryConstants.IN_USE_SESSIONS, 2L); assertThat(record.getMetrics()).containsEntry(MetricRegistryConstants.MAX_IN_USE_SESSIONS, 2L); + assertThat(record.getMetrics()).containsEntry(MetricRegistryConstants.SESSIONS_TIMEOUT, 0L); assertThat(record.getMetrics()) .containsEntry( MetricRegistryConstants.MAX_ALLOWED_SESSIONS, (long) options.getMaxSessions()); assertThat(record.getLabels()).containsEntry(SPANNER_LABEL_KEYS, labelValues); + final CountDownLatch latch = new CountDownLatch(1); + // Then try asynchronously to take another session. This attempt should time out. + Future fut = + executor.submit( + new Callable() { + @Override + public Void call() throws Exception { + Session session; + latch.countDown(); + session = pool.getReadSession(); + session.close(); + return null; + } + }); + // Wait until the background thread is actually waiting for a session. + latch.await(); + // Wait until the request has timed out. + int waitCount = 0; + while (pool.getNumWaiterTimeouts() == 0L && waitCount < 1000) { + Thread.sleep(5L); + waitCount++; + } + // Return the checked out session to the pool so the async request will get a session and + // finish. session2.close(); - session1.close(); + // Verify that the async request also succeeds. + fut.get(10L, TimeUnit.SECONDS); + executor.shutdown(); + session1.close(); + assertThat(record.getMetrics()).containsEntry(MetricRegistryConstants.SESSIONS_TIMEOUT, 1L); assertThat(record.getMetrics()).containsEntry(MetricRegistryConstants.IN_USE_SESSIONS, 0L); assertThat(record.getMetrics()).containsEntry(MetricRegistryConstants.MAX_IN_USE_SESSIONS, 2L); } From d2a2e975c1fc25f4315f215b20e84dae96081703 Mon Sep 17 00:00:00 2001 From: Mayur Kale Date: Thu, 6 Feb 2020 17:31:05 -0800 Subject: [PATCH 2/9] minor patch --- .../java/com/google/cloud/spanner/SessionPoolTest.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java index 033cb7e5326..72f782739df 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java @@ -1595,15 +1595,14 @@ public void testSessionMetrics() throws Exception { assertThat(record.getLabels()).containsEntry(SPANNER_LABEL_KEYS, labelValues); final CountDownLatch latch = new CountDownLatch(1); - // Then try asynchronously to take another session. This attempt should time out. + // Try asynchronously to take another session. This attempt should time out. Future fut = executor.submit( new Callable() { @Override - public Void call() throws Exception { - Session session; + public Void call() { latch.countDown(); - session = pool.getReadSession(); + Session session = pool.getReadSession(); session.close(); return null; } From 608004f78abad4f4968a1b9450fdcbd35b92147f Mon Sep 17 00:00:00 2001 From: Mayur Kale Date: Fri, 7 Feb 2020 11:24:23 -0800 Subject: [PATCH 3/9] rename metric name and description --- .../com/google/cloud/spanner/MetricRegistryConstants.java | 4 ++-- .../src/main/java/com/google/cloud/spanner/SessionPool.java | 4 ++-- .../test/java/com/google/cloud/spanner/SessionPoolTest.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java index 542c1ec0da4..e97549c843e 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java @@ -45,7 +45,7 @@ class MetricRegistryConstants { static final String MAX_IN_USE_SESSIONS = "cloud.google.com/java/spanner/max_in_use_session"; 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"; - static final String SESSIONS_TIMEOUT = "cloud.google.com/java/spanner/sessions_timeout"; + static final String GET_SESSION_TIMEOUT = "cloud.google.com/java/spanner/get_sessions_timeout"; static final String MAX_IN_USE_SESSIONS_DESCRIPTION = "The maximum number of sessions in use during the last 10 minute interval."; @@ -53,5 +53,5 @@ class MetricRegistryConstants { "The maximum number of sessions allowed. Configurable by the user."; static final String IN_USE_SESSIONS_DESCRIPTION = "The number of sessions currently in use."; static final String SESSIONS_TIMEOUT_DESCRIPTION = - "The count of number of sessions timeout due to pool exhaustion"; + "The number of get session timeouts due to pool exhaustion"; } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java index d9dc0073ac7..28e0c7eba7f 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java @@ -17,13 +17,13 @@ package com.google.cloud.spanner; import static com.google.cloud.spanner.MetricRegistryConstants.COUNT; +import static com.google.cloud.spanner.MetricRegistryConstants.GET_SESSION_TIMEOUT; import static com.google.cloud.spanner.MetricRegistryConstants.IN_USE_SESSIONS; import static com.google.cloud.spanner.MetricRegistryConstants.IN_USE_SESSIONS_DESCRIPTION; import static com.google.cloud.spanner.MetricRegistryConstants.MAX_ALLOWED_SESSIONS; import static com.google.cloud.spanner.MetricRegistryConstants.MAX_ALLOWED_SESSIONS_DESCRIPTION; import static com.google.cloud.spanner.MetricRegistryConstants.MAX_IN_USE_SESSIONS; import static com.google.cloud.spanner.MetricRegistryConstants.MAX_IN_USE_SESSIONS_DESCRIPTION; -import static com.google.cloud.spanner.MetricRegistryConstants.SESSIONS_TIMEOUT; import static com.google.cloud.spanner.MetricRegistryConstants.SESSIONS_TIMEOUT_DESCRIPTION; import static com.google.cloud.spanner.MetricRegistryConstants.SPANNER_DEFAULT_LABEL_VALUES; import static com.google.cloud.spanner.MetricRegistryConstants.SPANNER_LABEL_KEYS; @@ -1850,7 +1850,7 @@ private void initMetricsCollection(MetricRegistry metricRegistry, List Date: Fri, 7 Feb 2020 13:20:15 -0800 Subject: [PATCH 4/9] fix potential flaky test --- .../src/test/java/com/google/cloud/spanner/SessionPoolTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java index daf1c5b79ff..e7cc8cf6a0a 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java @@ -1623,7 +1623,7 @@ public Void call() { executor.shutdown(); session1.close(); - assertThat(record.getMetrics()).containsEntry(MetricRegistryConstants.GET_SESSION_TIMEOUT, 1L); + assertThat(record.getMetrics().get(MetricRegistryConstants.GET_SESSION_TIMEOUT).longValue()).isAtLeast(1L); assertThat(record.getMetrics()).containsEntry(MetricRegistryConstants.IN_USE_SESSIONS, 0L); assertThat(record.getMetrics()).containsEntry(MetricRegistryConstants.MAX_IN_USE_SESSIONS, 2L); } From 581460117209c9bb0ec545e39d0bd09d8bf1b9f3 Mon Sep 17 00:00:00 2001 From: Mayur Kale Date: Fri, 7 Feb 2020 13:24:58 -0800 Subject: [PATCH 5/9] fix code format --- .../test/java/com/google/cloud/spanner/SessionPoolTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java index e7cc8cf6a0a..a00542c9269 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java @@ -1623,7 +1623,8 @@ public Void call() { executor.shutdown(); session1.close(); - assertThat(record.getMetrics().get(MetricRegistryConstants.GET_SESSION_TIMEOUT).longValue()).isAtLeast(1L); + assertThat(record.getMetrics().get(MetricRegistryConstants.GET_SESSION_TIMEOUT).longValue()) + .isAtLeast(1L); assertThat(record.getMetrics()).containsEntry(MetricRegistryConstants.IN_USE_SESSIONS, 0L); assertThat(record.getMetrics()).containsEntry(MetricRegistryConstants.MAX_IN_USE_SESSIONS, 2L); } From d2ffc9f28415055c1e37148b5408920fcf5c7e71 Mon Sep 17 00:00:00 2001 From: Mayur Kale Date: Mon, 10 Feb 2020 14:42:55 -0800 Subject: [PATCH 6/9] update metric name --- .../com/google/cloud/spanner/MetricRegistryConstants.java | 4 ++-- .../main/java/com/google/cloud/spanner/SessionPool.java | 8 ++++---- .../java/com/google/cloud/spanner/SessionPoolTest.java | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java index e97549c843e..0dca41d46ba 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java @@ -45,13 +45,13 @@ class MetricRegistryConstants { static final String MAX_IN_USE_SESSIONS = "cloud.google.com/java/spanner/max_in_use_session"; 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"; - static final String GET_SESSION_TIMEOUT = "cloud.google.com/java/spanner/get_sessions_timeout"; + static final String GET_SESSION_TIMEOUTS = "cloud.google.com/java/spanner/get_sessions_timeouts"; static final String MAX_IN_USE_SESSIONS_DESCRIPTION = "The maximum number of sessions in use during the last 10 minute interval."; static final String MAX_ALLOWED_SESSIONS_DESCRIPTION = "The maximum number of sessions allowed. Configurable by the user."; static final String IN_USE_SESSIONS_DESCRIPTION = "The number of sessions currently in use."; - static final String SESSIONS_TIMEOUT_DESCRIPTION = + static final String SESSIONS_TIMEOUTS_DESCRIPTION = "The number of get session timeouts due to pool exhaustion"; } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java index 28e0c7eba7f..1d5b2cddb07 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java @@ -17,14 +17,14 @@ package com.google.cloud.spanner; import static com.google.cloud.spanner.MetricRegistryConstants.COUNT; -import static com.google.cloud.spanner.MetricRegistryConstants.GET_SESSION_TIMEOUT; +import static com.google.cloud.spanner.MetricRegistryConstants.GET_SESSION_TIMEOUTS; import static com.google.cloud.spanner.MetricRegistryConstants.IN_USE_SESSIONS; import static com.google.cloud.spanner.MetricRegistryConstants.IN_USE_SESSIONS_DESCRIPTION; import static com.google.cloud.spanner.MetricRegistryConstants.MAX_ALLOWED_SESSIONS; import static com.google.cloud.spanner.MetricRegistryConstants.MAX_ALLOWED_SESSIONS_DESCRIPTION; import static com.google.cloud.spanner.MetricRegistryConstants.MAX_IN_USE_SESSIONS; import static com.google.cloud.spanner.MetricRegistryConstants.MAX_IN_USE_SESSIONS_DESCRIPTION; -import static com.google.cloud.spanner.MetricRegistryConstants.SESSIONS_TIMEOUT_DESCRIPTION; +import static com.google.cloud.spanner.MetricRegistryConstants.SESSIONS_TIMEOUTS_DESCRIPTION; import static com.google.cloud.spanner.MetricRegistryConstants.SPANNER_DEFAULT_LABEL_VALUES; import static com.google.cloud.spanner.MetricRegistryConstants.SPANNER_LABEL_KEYS; import static com.google.cloud.spanner.SpannerExceptionFactory.newSpannerException; @@ -1850,9 +1850,9 @@ private void initMetricsCollection(MetricRegistry metricRegistry, List Date: Mon, 10 Feb 2020 14:55:53 -0800 Subject: [PATCH 7/9] minor nit --- .../com/google/cloud/spanner/MetricRegistryConstants.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java index 0dca41d46ba..e5c58cb2983 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java @@ -42,7 +42,7 @@ class MetricRegistryConstants { static final String COUNT = "1"; // The Metric name and description - static final String MAX_IN_USE_SESSIONS = "cloud.google.com/java/spanner/max_in_use_session"; + 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"; static final String GET_SESSION_TIMEOUTS = "cloud.google.com/java/spanner/get_sessions_timeouts"; @@ -53,5 +53,5 @@ class MetricRegistryConstants { "The maximum number of sessions allowed. Configurable by the user."; static final String IN_USE_SESSIONS_DESCRIPTION = "The number of sessions currently in use."; static final String SESSIONS_TIMEOUTS_DESCRIPTION = - "The number of get session timeouts due to pool exhaustion"; + "The number of get sessions timeouts due to pool exhaustion"; } From f3799554dc9207771c4b664f55360330dcc5ff3f Mon Sep 17 00:00:00 2001 From: Mayur Kale Date: Wed, 12 Feb 2020 20:42:08 -0800 Subject: [PATCH 8/9] fix review comment --- .../com/google/cloud/spanner/MetricRegistryConstants.java | 2 +- .../src/main/java/com/google/cloud/spanner/SessionPool.java | 4 ++-- .../test/java/com/google/cloud/spanner/SessionPoolTest.java | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java index e5c58cb2983..fb8ba28db6c 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java @@ -45,7 +45,7 @@ class MetricRegistryConstants { 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"; - static final String GET_SESSION_TIMEOUTS = "cloud.google.com/java/spanner/get_sessions_timeouts"; + static final String GET_SESSIONS_TIMEOUTS = "cloud.google.com/java/spanner/get_sessions_timeouts"; static final String MAX_IN_USE_SESSIONS_DESCRIPTION = "The maximum number of sessions in use during the last 10 minute interval."; diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java index 1d5b2cddb07..03041c14423 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java @@ -17,7 +17,7 @@ package com.google.cloud.spanner; import static com.google.cloud.spanner.MetricRegistryConstants.COUNT; -import static com.google.cloud.spanner.MetricRegistryConstants.GET_SESSION_TIMEOUTS; +import static com.google.cloud.spanner.MetricRegistryConstants.GET_SESSIONS_TIMEOUTS; import static com.google.cloud.spanner.MetricRegistryConstants.IN_USE_SESSIONS; import static com.google.cloud.spanner.MetricRegistryConstants.IN_USE_SESSIONS_DESCRIPTION; import static com.google.cloud.spanner.MetricRegistryConstants.MAX_ALLOWED_SESSIONS; @@ -1850,7 +1850,7 @@ private void initMetricsCollection(MetricRegistry metricRegistry, List Date: Thu, 13 Feb 2020 19:24:16 -0800 Subject: [PATCH 9/9] rename get_sessions_timeouts to get_session_timeouts --- .../com/google/cloud/spanner/MetricRegistryConstants.java | 2 +- .../src/main/java/com/google/cloud/spanner/SessionPool.java | 4 ++-- .../test/java/com/google/cloud/spanner/SessionPoolTest.java | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java index fb8ba28db6c..2c63072b134 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MetricRegistryConstants.java @@ -45,7 +45,7 @@ class MetricRegistryConstants { 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"; - static final String GET_SESSIONS_TIMEOUTS = "cloud.google.com/java/spanner/get_sessions_timeouts"; + static final String GET_SESSION_TIMEOUTS = "cloud.google.com/java/spanner/get_session_timeouts"; static final String MAX_IN_USE_SESSIONS_DESCRIPTION = "The maximum number of sessions in use during the last 10 minute interval."; diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java index 03041c14423..1d5b2cddb07 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPool.java @@ -17,7 +17,7 @@ package com.google.cloud.spanner; import static com.google.cloud.spanner.MetricRegistryConstants.COUNT; -import static com.google.cloud.spanner.MetricRegistryConstants.GET_SESSIONS_TIMEOUTS; +import static com.google.cloud.spanner.MetricRegistryConstants.GET_SESSION_TIMEOUTS; import static com.google.cloud.spanner.MetricRegistryConstants.IN_USE_SESSIONS; import static com.google.cloud.spanner.MetricRegistryConstants.IN_USE_SESSIONS_DESCRIPTION; import static com.google.cloud.spanner.MetricRegistryConstants.MAX_ALLOWED_SESSIONS; @@ -1850,7 +1850,7 @@ private void initMetricsCollection(MetricRegistry metricRegistry, List