|
16 | 16 |
|
17 | 17 | package com.google.cloud.spanner;
|
18 | 18 |
|
19 |
| -import static com.google.cloud.spanner.MetricRegistryConstants.ACTIVE_SESSIONS; |
20 |
| -import static com.google.cloud.spanner.MetricRegistryConstants.ACTIVE_SESSIONS_DESCRIPTION; |
21 | 19 | import static com.google.cloud.spanner.MetricRegistryConstants.COUNT;
|
22 |
| -import static com.google.cloud.spanner.MetricRegistryConstants.MAX_SESSIONS; |
23 |
| -import static com.google.cloud.spanner.MetricRegistryConstants.MAX_SESSIONS_DESCRIPTION; |
24 |
| -import static com.google.cloud.spanner.MetricRegistryConstants.SESSIONS_IN_USE; |
25 |
| -import static com.google.cloud.spanner.MetricRegistryConstants.SESSIONS_IN_USE_DESCRIPTION; |
| 20 | +import static com.google.cloud.spanner.MetricRegistryConstants.IN_USE_SESSIONS; |
| 21 | +import static com.google.cloud.spanner.MetricRegistryConstants.IN_USE_SESSIONS_DESCRIPTION; |
| 22 | +import static com.google.cloud.spanner.MetricRegistryConstants.MAX_ALLOWED_SESSIONS; |
| 23 | +import static com.google.cloud.spanner.MetricRegistryConstants.MAX_ALLOWED_SESSIONS_DESCRIPTION; |
| 24 | +import static com.google.cloud.spanner.MetricRegistryConstants.MAX_IN_USE_SESSIONS; |
| 25 | +import static com.google.cloud.spanner.MetricRegistryConstants.MAX_IN_USE_SESSIONS_DESCRIPTION; |
26 | 26 | import static com.google.cloud.spanner.MetricRegistryConstants.SPANNER_DEFAULT_LABEL_VALUES;
|
27 | 27 | import static com.google.cloud.spanner.MetricRegistryConstants.SPANNER_LABEL_KEYS;
|
28 | 28 | import static com.google.cloud.spanner.SpannerExceptionFactory.newSpannerException;
|
@@ -1815,36 +1815,36 @@ public void onSessionCreateFailure(Throwable t, int createFailureForSessionCount
|
1815 | 1815 | * allows users to monitor client behavior.
|
1816 | 1816 | */
|
1817 | 1817 | private void initMetricsCollection(MetricRegistry metricRegistry, List<LabelValue> labelValues) {
|
1818 |
| -DerivedLongGauge activeSessionsGauge = |
| 1818 | +DerivedLongGauge maxInUseSessionsMetric = |
1819 | 1819 | metricRegistry.addDerivedLongGauge(
|
1820 |
| -ACTIVE_SESSIONS, |
| 1820 | +MAX_IN_USE_SESSIONS, |
1821 | 1821 | MetricOptions.builder()
|
1822 |
| -.setDescription(ACTIVE_SESSIONS_DESCRIPTION) |
| 1822 | +.setDescription(MAX_IN_USE_SESSIONS_DESCRIPTION) |
1823 | 1823 | .setUnit(COUNT)
|
1824 | 1824 | .setLabelKeys(SPANNER_LABEL_KEYS)
|
1825 | 1825 | .build());
|
1826 | 1826 |
|
1827 |
| -DerivedLongGauge maxSessionsGauge = |
| 1827 | +DerivedLongGauge maxAllowedSessionsMetric = |
1828 | 1828 | metricRegistry.addDerivedLongGauge(
|
1829 |
| -MAX_SESSIONS, |
| 1829 | +MAX_ALLOWED_SESSIONS, |
1830 | 1830 | MetricOptions.builder()
|
1831 |
| -.setDescription(MAX_SESSIONS_DESCRIPTION) |
| 1831 | +.setDescription(MAX_ALLOWED_SESSIONS_DESCRIPTION) |
1832 | 1832 | .setUnit(COUNT)
|
1833 | 1833 | .setLabelKeys(SPANNER_LABEL_KEYS)
|
1834 | 1834 | .build());
|
1835 | 1835 |
|
1836 |
| -DerivedLongGauge sessionsInUseGauge = |
| 1836 | +DerivedLongGauge numInUseSessionsMetric = |
1837 | 1837 | metricRegistry.addDerivedLongGauge(
|
1838 |
| -SESSIONS_IN_USE, |
| 1838 | +IN_USE_SESSIONS, |
1839 | 1839 | MetricOptions.builder()
|
1840 |
| -.setDescription(SESSIONS_IN_USE_DESCRIPTION) |
| 1840 | +.setDescription(IN_USE_SESSIONS_DESCRIPTION) |
1841 | 1841 | .setUnit(COUNT)
|
1842 | 1842 | .setLabelKeys(SPANNER_LABEL_KEYS)
|
1843 | 1843 | .build());
|
1844 | 1844 |
|
1845 | 1845 | // The value of a maxSessionsInUse is observed from a callback function. This function is
|
1846 | 1846 | // invoked whenever metrics are collected.
|
1847 |
| -activeSessionsGauge.createTimeSeries( |
| 1847 | +maxInUseSessionsMetric.createTimeSeries( |
1848 | 1848 | labelValues,
|
1849 | 1849 | this,
|
1850 | 1850 | new ToLongFunction<SessionPool>() {
|
@@ -1856,7 +1856,7 @@ public long applyAsLong(SessionPool sessionPool) {
|
1856 | 1856 |
|
1857 | 1857 | // The value of a maxSessions is observed from a callback function. This function is invoked
|
1858 | 1858 | // whenever metrics are collected.
|
1859 |
| -maxSessionsGauge.createTimeSeries( |
| 1859 | +maxAllowedSessionsMetric.createTimeSeries( |
1860 | 1860 | labelValues,
|
1861 | 1861 | options,
|
1862 | 1862 | new ToLongFunction<SessionPoolOptions>() {
|
@@ -1868,7 +1868,7 @@ public long applyAsLong(SessionPoolOptions options) {
|
1868 | 1868 |
|
1869 | 1869 | // The value of a numSessionsInUse is observed from a callback function. This function is
|
1870 | 1870 | // invoked whenever metrics are collected.
|
1871 |
| -sessionsInUseGauge.createTimeSeries( |
| 1871 | +numInUseSessionsMetric.createTimeSeries( |
1872 | 1872 | labelValues,
|
1873 | 1873 | this,
|
1874 | 1874 | new ToLongFunction<SessionPool>() {
|
|
0 commit comments