module ElasticAPM
def self.add_filter(key, callback = nil, &block)
-
(Bool)
- true
Other tags:
- Yield: - A filter. Will be used if provided. Otherwise using `callback`
Parameters:
-
callback
(Object, Proc
) -- A filter that responds to #call(payload) -
key
(Symbol
) -- Unique filter key
def self.add_filter(key, callback = nil, &block) if callback.nil? && !block_given? raise ArgumentError, '#add_filter needs either `callback\' or a block' end agent && agent.add_filter(key, block || callback) end
def self.agent
-
(Agent)
- Currently running [Agent] if any
def self.agent Agent.instance end
def self.build_context(rack_env)
-
(Context)
- The built context
Parameters:
-
rack_env
(Rack::Env
) -- A Rack env
def self.build_context(rack_env) agent && agent.build_context(rack_env) end
def self.current_transaction
-
(Transaction)
- if any
def self.current_transaction agent && agent.current_transaction end
def self.report(exception, handled: true)
-
(Error)
- The generated [Error]
Parameters:
-
handled
(Boolean
) -- Whether the exception was rescued -
exception
(Exception
) -- The exception
def self.report(exception, handled: true) agent && agent.report(exception, handled: handled) end
def self.report_message(message, **attrs)
-
(Error)
- The generated [Error]
Parameters:
-
message
(String
) -- The message
def self.report_message(message, **attrs) agent && agent.report_message(message, backtrace: caller, **attrs) end
def self.running?
-
(Boolean)
- Whether there's an [Agent] running
def self.running? Agent.running? end
def self.set_custom_context(custom)
-
(Hash)
- The current custom context
Parameters:
-
custom
(Hash
) -- A hash with custom information. Can be nested.
def self.set_custom_context(custom) agent && agent.set_custom_context(custom) end
def self.set_tag(key, value)
-
(Object)
- The given value
Parameters:
-
value
(Object
) -- A value (will be converted to string) -
key
(String, Symbol
) -- A key
def self.set_tag(key, value) agent && agent.set_tag(key, value) end
def self.set_user(user)
-
(Object)
- Given user
Parameters:
-
user
(Object
) -- An object representing a user
def self.set_user(user) agent && agent.set_user(user) end
def self.span(name, type = nil, context: nil, include_stacktrace: true,
-
(Span)
- Unless block given
Other tags:
- Yield: - Optional block encapsulating span
Parameters:
-
context
(Span::Context
) -- Context information about the span -
type
(String
) -- The kind of span, eq `db.mysql2.query` -
name
(String
) -- A description of the span, eq `SELECT FROM "users"`
def self.span(name, type = nil, context: nil, include_stacktrace: true, &block) return (block_given? ? yield : nil) unless agent agent.span( name, type, context: context, backtrace: include_stacktrace ? caller : nil, &block ) end
def self.start(config = {})
-
(Agent)
- The resulting [Agent]
Parameters:
-
config
(Config
) -- An instance of Config
def self.start(config = {}) Agent.start config end
def self.stop
def self.stop Agent.stop end
def self.transaction(name = nil, type = nil, context: nil, &block)
-
(Transaction)
- Unless block given
Other tags:
- Yield: - Optional block encapsulating transaction
Parameters:
-
context
(Context
) -- An optional [Context] -
type
(String
) -- The kind of the transaction, eg `app.request.get` or -
name
(String
) -- A description of the transaction, eg
def self.transaction(name = nil, type = nil, context: nil, &block) return (block_given? ? yield : nil) unless agent agent.transaction(name, type, context: context, &block) end