module Slimy::Rails::SLITools
SLITools
concern
This module adds Controller helpers for instrumenting SLIs
Public Class Methods
sli_deadline(deadline, except: nil, only: nil)
click to toggle source
# File lib/slimy/rails/sli_concern.rb, line 33 def self.sli_deadline(deadline, except: nil, only: nil) before_action only: only, except: except do add_sli_deadline(deadline) end end
sli_ignore(except: nil, only: nil)
click to toggle source
# File lib/slimy/rails/sli_concern.rb, line 27 def self.sli_ignore(except: nil, only: nil) before_action only: only, except: except do add_sli_ignore end end
sli_tag(tag, value, except: nil, only: nil)
click to toggle source
class-level meta commands
# File lib/slimy/rails/sli_concern.rb, line 13 def self.sli_tag(tag, value, except: nil, only: nil) before_action only: only, except: except do add_sli_tag(tag, value) end end
Public Instance Methods
add_sli_deadline(deadline)
click to toggle source
# File lib/slimy/rails/sli_concern.rb, line 59 def add_sli_deadline(deadline) ctx = slimy_context ctx.deadline = deadline unless ctx.nil? end
add_sli_ignore()
click to toggle source
# File lib/slimy/rails/sli_concern.rb, line 54 def add_sli_ignore ctx = slimy_context ctx&.do_not_report! end
add_sli_tag(tag, value)
click to toggle source
# File lib/slimy/rails/sli_concern.rb, line 49 def add_sli_tag(tag, value) ctx = slimy_context ctx.tags[tag] = value unless ctx.nil? end
slimy_context()
click to toggle source
helpers
# File lib/slimy/rails/sli_concern.rb, line 45 def slimy_context request.env[Slimy::Rack::SLIMiddleware::MIDDLEWARE_CONTEXT_KEY] end