Module: RailsOtelContext::Frameable
- Defined in:
- lib/rails_otel_context/frame_context.rb
Overview
Include in any class to get a with_otel_frame convenience wrapper that pushes self.class.name + the calling method name automatically.
class InvoiceService
include RailsOtelContext::Frameable
def call
with_otel_frame { do_work }
end
end
Instance Method Summary collapse
Instance Method Details
#with_otel_frame(method_name = nil) ⇒ Object
79 80 81 82 |
# File 'lib/rails_otel_context/frame_context.rb', line 79 def with_otel_frame(method_name = nil, &) name = method_name || caller_locations(1, 1).first&.label || '<unknown>' FrameContext.with_frame(class_name: self.class.name, method_name: name, &) end |