Class DatabaseTableMetrics

    • Constructor Summary

      Constructors 
      Constructor Description
      DatabaseTableMetrics​(javax.sql.DataSource dataSource, java.lang.String dataSourceName, java.lang.String tableName, 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 dataSourceName, java.lang.String tableName, java.lang.Iterable<Tag> tags)
      Record the result based on a query.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void bindTo​(MeterRegistry registry)  
      static void monitor​(MeterRegistry registry, java.lang.String tableName, java.lang.String dataSourceName, javax.sql.DataSource dataSource, java.lang.String... tags)
      Record the row count for an individual database table.
      static void monitor​(MeterRegistry registry, javax.sql.DataSource dataSource, java.lang.String dataSourceName, java.lang.String tableName, java.lang.Iterable<Tag> tags)
      Record the row count for an individual database table.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DatabaseTableMetrics

        public DatabaseTableMetrics​(javax.sql.DataSource dataSource,
                                    java.lang.String dataSourceName,
                                    java.lang.String tableName,
                                    java.lang.Iterable<Tag> tags)
        Record the row count for an individual database table.
        Parameters:
        dataSource - The data source to use to run the row count query.
        dataSourceName - Will be used to tag metrics with "db".
        tableName - The name of the table to report table size for.
        tags - Tags to apply to all recorded metrics.
      • DatabaseTableMetrics

        public DatabaseTableMetrics​(javax.sql.DataSource dataSource,
                                    java.lang.String query,
                                    java.lang.String dataSourceName,
                                    java.lang.String tableName,
                                    java.lang.Iterable<Tag> tags)
        Record the result based on a query.
        Parameters:
        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.
        dataSourceName - The name prefix of the metrics.
        tableName - The name of the table to report table size for.
        tags - Tags to apply to all recorded metrics.
    • Method Detail

      • monitor

        public static void monitor​(MeterRegistry registry,
                                   java.lang.String tableName,
                                   java.lang.String dataSourceName,
                                   javax.sql.DataSource dataSource,
                                   java.lang.String... tags)
        Record the row count for an individual database table.
        Parameters:
        registry - The registry to bind metrics to.
        tableName - The name of the table to report table size for.
        dataSourceName - Will be used to tag metrics with "db".
        dataSource - The data source to use to run the row count query.
        tags - Tags to apply to all recorded metrics. Must be an even number of arguments representing key/value pairs of tags.
      • monitor

        public static void monitor​(MeterRegistry registry,
                                   javax.sql.DataSource dataSource,
                                   java.lang.String dataSourceName,
                                   java.lang.String tableName,
                                   java.lang.Iterable<Tag> tags)
        Record the row count for an individual database table.
        Parameters:
        registry - The registry to bind metrics to.
        dataSource - The data source to use to run the row count query.
        dataSourceName - The name prefix of the metrics.
        tableName - The name of the table to report table size for.
        tags - Tags to apply to all recorded metrics.