Method Timing Metrics
Unlike the rest of the Metrician suite, method timing is a utility you need to configure per-use inside your codebase. It allows you to report timing and rate metrics about methods inside your application.
Configuration and Metrics
Metrician requires 1 configuration option be enabled in your copy of metrician.yaml
, and at least one instance of configuration inside your application itself. Method timing is disabled by default.
:method_timer: :enabled: false
In your code, you need to add a call to add_metrician_method_timer
as in the following example.
class AddUser < Service def call # do some work in an instance method end add_metrician_method_timer :call def self.calculate(user) # do some work in a class method end add_metrician_method_timer :calculate end
app.timer.add_user.call | average time taken to execute the method call |
---|---|
app.timer.add_user.self.calculate_something | average time taken to execute the class method calculate |
Method Timing Query Language Expressions
How often does my AddUser#call
method get executed?
gauge_count(app.timer.add_user.call)