Configuring Metrician
Metrician ships with a default configuration and an example configuration file. The defaults can be overridden by copying the example file into your project as config/metrician.yaml
, or by setting a different location for that file in the environment variable METRICIAN_CONFIG
.
The general way to configure Metrician is to flip enabled
flags in that yaml file. For example, you can disable job reporting entirely by changing the value enabled
to false
in the jobs
section of your configuration. i.e.
# ... # "jobs" settings control reporting metrics when ruby job systems # work through their queues :jobs: # hook into job system middleware when presence detected :enabled: false # ...
Configurable Metrician Options
prefix= |
set a metric prefix to be prepended to all metrics - default: app |
---|
Using those in a Rails application initializer might look something like:
# in config/initializers/instrumental.rb require "instrumental_agent" I = Instrumental::Agent.new("PROJECT_TOKEN") # change "web.request" to "omega.web.request" Metrician.prefix = "omega"
Configurable Metric Options
Metrician's configuration file is broken up into several documented sections:
request_timing
Metrician uses rack middleware (1, 2) to record metrics about the health of your web application, from Apdex to response time to response size.
By default, metrician will report request timing, errors (5xx), and Apdex metrics. Read about configuration and the full set of metrics here.
database
By way of Active Record, Metrician will record metrics about the health of your database queries.
By default, Metrician will report a single query timing stat for all queries. Read about configuration and the full set of metrics here.
external_service
If your application depends on external services accessed via HTTP by way of Net::HTTP
, then Metrician will monitor the timing of those requests to make sure they are not slowing down over time and let you see traffic spikes and patterns during the life of your application.
By default, Metrician will report a single timing metric for external service calls. Read about configuration and the full set of metrics here.
jobs
If you use delayed_job, resque, or sidekiq in your ruby project, Metrician can automatically report metrics about how long your jobs take to execute and how often they are executing, as well as when they produce errors during execution.
By default Metrician will report job timing and job error metrics. Read about configuration and the full set of metrics here.
cache
Applications that use redis or memcached can report metrics about calls to those cache stores using Metrician.
By default Metrician will report a single metric for all calls to redis or memcached. Read about the configuration and full set of metrics here.
exception
Metrician can hook into Honeybadger and report when any exceptions are being reported to that service.
By default, Metrician will not report any exception metrics of this sort, but you can read about configuration and the full set of metrics here.
method_timing
Metrician includes a facility to report the timing and number of executions of any instance or class method.
You can read about configuring method timing here.
Default Metrics
By default, Metrician reports the following metrics:
- gauge
app.web.request
- increment
app.web.error
- gauge
app.web.apdex.satisfied
- gauge
app.web.apdex.tolerated
- gauge
app.web.apdex.frustrated
- gauge
app.database.query
- gauge
app.service.request
- gauge
app.jobs.run
- increment
app.jobs.error
- gauge
app.cache.command