You can instrument instance and class method as follows
Option 1:
class App
# TODO: Add span helper
include Atatus::SpanHelpers
def getName
# ...
end
# TODO: Use following method to instrument instance method
span_method :getName # takes optional `name` and `type` and `subtype`
def self.process
# ...
end
# TODO: Use following method to instrument class method
span_class_method :process # takes optional `name` and `type` and `subtype`
end
Option 2: You can also instrument method using start and end span.
class App
def process
Atatus.start_span "Processing Job"
# ...
Atatus.end_span
end
end
Parameter
Parameter | Type | Description |
---|---|---|
name | String (Required) | Span name |
type | String | Span type. eg: db |
subtype | String | Span subtype. eg: mongodb |
Option 3: You can also instrument method using with_span.
class App
def process
@result_of_job = Atatus.with_span "Processing Job" do
do_the_processing
end
end
end