1616
1717package com .google .cloud .spanner ;
1818
19- import static com .google .cloud .spanner .MetricRegistryConstants .ACTIVE_SESSIONS ;
20- import static com .google .cloud .spanner .MetricRegistryConstants .ACTIVE_SESSIONS_DESCRIPTION ;
2119import 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 ;
2626import static com .google .cloud .spanner .MetricRegistryConstants .SPANNER_DEFAULT_LABEL_VALUES ;
2727import static com .google .cloud .spanner .MetricRegistryConstants .SPANNER_LABEL_KEYS ;
2828import static com .google .cloud .spanner .SpannerExceptionFactory .newSpannerException ;
@@ -1815,36 +1815,36 @@ public void onSessionCreateFailure(Throwable t, int createFailureForSessionCount
18151815 * allows users to monitor client behavior.
18161816 */
18171817 private void initMetricsCollection (MetricRegistry metricRegistry , List <LabelValue > labelValues ) {
1818- DerivedLongGauge activeSessionsGauge =
1818+ DerivedLongGauge maxInUseSessionsMetric =
18191819 metricRegistry .addDerivedLongGauge (
1820- ACTIVE_SESSIONS ,
1820+ MAX_IN_USE_SESSIONS ,
18211821 MetricOptions .builder ()
1822- .setDescription (ACTIVE_SESSIONS_DESCRIPTION )
1822+ .setDescription (MAX_IN_USE_SESSIONS_DESCRIPTION )
18231823 .setUnit (COUNT )
18241824 .setLabelKeys (SPANNER_LABEL_KEYS )
18251825 .build ());
18261826
1827- DerivedLongGauge maxSessionsGauge =
1827+ DerivedLongGauge maxAllowedSessionsMetric =
18281828 metricRegistry .addDerivedLongGauge (
1829- MAX_SESSIONS ,
1829+ MAX_ALLOWED_SESSIONS ,
18301830 MetricOptions .builder ()
1831- .setDescription (MAX_SESSIONS_DESCRIPTION )
1831+ .setDescription (MAX_ALLOWED_SESSIONS_DESCRIPTION )
18321832 .setUnit (COUNT )
18331833 .setLabelKeys (SPANNER_LABEL_KEYS )
18341834 .build ());
18351835
1836- DerivedLongGauge sessionsInUseGauge =
1836+ DerivedLongGauge numInUseSessionsMetric =
18371837 metricRegistry .addDerivedLongGauge (
1838- SESSIONS_IN_USE ,
1838+ IN_USE_SESSIONS ,
18391839 MetricOptions .builder ()
1840- .setDescription (SESSIONS_IN_USE_DESCRIPTION )
1840+ .setDescription (IN_USE_SESSIONS_DESCRIPTION )
18411841 .setUnit (COUNT )
18421842 .setLabelKeys (SPANNER_LABEL_KEYS )
18431843 .build ());
18441844
18451845 // The value of a maxSessionsInUse is observed from a callback function. This function is
18461846 // invoked whenever metrics are collected.
1847- activeSessionsGauge .createTimeSeries (
1847+ maxInUseSessionsMetric .createTimeSeries (
18481848 labelValues ,
18491849 this ,
18501850 new ToLongFunction <SessionPool >() {
@@ -1856,7 +1856,7 @@ public long applyAsLong(SessionPool sessionPool) {
18561856
18571857 // The value of a maxSessions is observed from a callback function. This function is invoked
18581858 // whenever metrics are collected.
1859- maxSessionsGauge .createTimeSeries (
1859+ maxAllowedSessionsMetric .createTimeSeries (
18601860 labelValues ,
18611861 options ,
18621862 new ToLongFunction <SessionPoolOptions >() {
@@ -1868,7 +1868,7 @@ public long applyAsLong(SessionPoolOptions options) {
18681868
18691869 // The value of a numSessionsInUse is observed from a callback function. This function is
18701870 // invoked whenever metrics are collected.
1871- sessionsInUseGauge .createTimeSeries (
1871+ numInUseSessionsMetric .createTimeSeries (
18721872 labelValues ,
18731873 this ,
18741874 new ToLongFunction <SessionPool >() {
0 commit comments