public class DatabaseTableMetrics extends java.lang.Object implements MeterBinder
| Constructor and Description |
|---|
DatabaseTableMetrics(javax.sql.DataSource dataSource,
java.lang.String tableName,
java.lang.String name,
java.lang.Iterable<Tag> tags)
Record the row count for an individual database table.
|
DatabaseTableMetrics(javax.sql.DataSource dataSource,
java.lang.String query,
java.lang.String tableName,
java.lang.String name,
java.lang.Iterable<Tag> tags)
Record the result based on a query.
|
| Modifier and Type | Method and Description |
|---|---|
void |
bindTo(MeterRegistry registry) |
static void |
monitor(MeterRegistry registry,
javax.sql.DataSource ds,
java.lang.String tableName,
java.lang.String name,
java.lang.Iterable<Tag> tags)
Record the row count for an individual database table.
|
static void |
monitor(MeterRegistry registry,
javax.sql.DataSource ds,
java.lang.String tableName,
java.lang.String name,
java.lang.String... tags)
Record the row count for an individual database table.
|
public DatabaseTableMetrics(javax.sql.DataSource dataSource,
java.lang.String tableName,
java.lang.String name,
java.lang.Iterable<Tag> tags)
dataSource - The data source to use to run the row count query.tableName - The name of the table to report table size for.name - The name prefix of the metrics.tags - Tags to apply to all recorded metrics.public DatabaseTableMetrics(javax.sql.DataSource dataSource,
java.lang.String query,
java.lang.String tableName,
java.lang.String name,
java.lang.Iterable<Tag> tags)
dataSource - The data source to use to run the row count query.query - The query to be run against the table. The first column of the result will be the metric and
it should return a single row.tableName - The name of the table to report table size for.name - The name prefix of the metrics.tags - Tags to apply to all recorded metrics.public static void monitor(MeterRegistry registry, javax.sql.DataSource ds, java.lang.String tableName, java.lang.String name, java.lang.String... tags)
registry - The registry to bind metrics to.ds - The data source to use to run the row count query.tableName - The name of the table to report table size for.name - The name prefix of the metrics.tags - Tags to apply to all recorded metrics. Must be an even number of arguments representing key/value pairs of tags.public static void monitor(MeterRegistry registry, javax.sql.DataSource ds, java.lang.String tableName, java.lang.String name, java.lang.Iterable<Tag> tags)
registry - The registry to bind metrics to.ds - The data source to use to run the row count query.tableName - The name of the table to report table size for.name - The name prefix of the metrics.tags - Tags to apply to all recorded metrics.public void bindTo(MeterRegistry registry)
bindTo in interface MeterBinder