Database Metrics

Metrician can automatically report metrics about an application's database queries made via Active Record. This allows you to track database speed and query load.

Configuration

Metrician requires 2 configuration options be set in your copy of metrician.yaml to report database metrics. Database metrics are enabled by default. For each query, Metrician can be configured to report the table name and query type (SELECT, INSERT, etc.). The following are the default settings.

:database:
  :enabled: true
  :query:
    :enabled: true
  :command:
    :enabled: false
  :table:
    :enabled: false
  :command_and_table:
    :enabled: false

Metrics

Metrician can report the following metrics. Other than app.database.query, the related configuration options must be enabled.
app.database.query average query execution time (ms)
app.database.query.<command> avg. query execution time (ms), including command issued
app.database.query.<table> avg. query execution time (ms), including table against which query was executed
app.database.query.<command>.<table> avg. query execution time (ms), including command issued and table against which query was executed

Database Metrics Query Language Expressions

Add the following expression to a graph to measure your database query rate (QPM, CPM, QPH, etc.):

gauge_count(app.database.query)

Add the following expression to a graph (if you have command reporting enabled) to measure your read-write ratio:

gauge_count(app.database.query.select) / (gauge_count(app.database.query.insert) + gauge_count(app.database.query.update) + gauge_count(app.database.query.delete))
Questions? We can help!