com.google.cloud.bigtable.metrics
Class BigtableClientMetrics
- java.lang.Object
-
- com.google.cloud.bigtable.metrics.BigtableClientMetrics
-
public final class BigtableClientMetrics extends Object
Singleton Container for aMetricRegistry
. The default behavior is to return implementations that do nothing. Exporting of metrics can be turned on by either adding TRACE level logging for this class, which will write out all metrics to a log file. Alternatively, callsetMetricRegistry(MetricRegistry)
.We provide a
DropwizardMetricRegistry
which can be configured with a variety ofReporter
s as per the instructions on the Dropwizards Metrics Getting Started docs.setMetricRegistry(MetricRegistry)
must be called before any Cloud Bigtable connections are created.- Version:
- $Id: $Id
- Author:
- sduskis
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
BigtableClientMetrics.MetricLevel
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static Counter
counter(BigtableClientMetrics.MetricLevel level, String name)
Creates a namedCounter
.static BigtableClientMetrics.MetricLevel
getLevelToLog()
static MetricRegistry
getMetricRegistry(BigtableClientMetrics.MetricLevel level)
static boolean
isEnabled(BigtableClientMetrics.MetricLevel level)
Checks if aBigtableClientMetrics.MetricLevel
is enabled;static Meter
meter(BigtableClientMetrics.MetricLevel level, String name)
Creates a namedMeter
.static void
setLevelToLog(BigtableClientMetrics.MetricLevel levelToLog)
Set a level at which to log.static void
setMetricRegistry(MetricRegistry registry)
Sets aMetricRegistry
to be used in all Bigtable connection created after the call.static Timer
timer(BigtableClientMetrics.MetricLevel level, String name)
Creates a namedTimer
.
-
-
-
Method Detail
-
setMetricRegistry
public static void setMetricRegistry(MetricRegistry registry)
Sets aMetricRegistry
to be used in all Bigtable connection created after the call. NOTE: this will not update any existing connections.- Parameters:
registry
-
-
getMetricRegistry
public static MetricRegistry getMetricRegistry(BigtableClientMetrics.MetricLevel level)
-
counter
public static Counter counter(BigtableClientMetrics.MetricLevel level, String name)
Creates a namedCounter
. This is a shortcut forgetMetricRegistry(MetricLevel)
.MetricRegistry.counter(String)
.- Returns:
- a
Counter
-
timer
public static Timer timer(BigtableClientMetrics.MetricLevel level, String name)
Creates a namedTimer
. This is a shortcut forgetMetricRegistry(MetricLevel)
.MetricRegistry.timer(String)
.- Returns:
- a
Timer
-
meter
public static Meter meter(BigtableClientMetrics.MetricLevel level, String name)
Creates a namedMeter
. This is a shortcut forgetMetricRegistry(MetricLevel)
.MetricRegistry.meter(String)
.- Returns:
- a
Meter
-
setLevelToLog
public static void setLevelToLog(BigtableClientMetrics.MetricLevel levelToLog)
Set a level at which to log. By default, the value isBigtableClientMetrics.MetricLevel.Info
.- Parameters:
levelToLog
-
-
getLevelToLog
public static BigtableClientMetrics.MetricLevel getLevelToLog()
- Returns:
- the levelToLog
-
isEnabled
public static boolean isEnabled(BigtableClientMetrics.MetricLevel level)
Checks if aBigtableClientMetrics.MetricLevel
is enabled;- Parameters:
level
- theBigtableClientMetrics.MetricLevel
to check- Returns:
- true if the level is enabled.
-
-