module Traces
Nested
Definitions
def self.trace_context
This is a default implementation, which can be replaced by the backend.
Signature
-
returns
Object
The current trace context.
Implementation
def self.trace_context
nil
end
def self.active?
This is a default implementation, which can be replaced by the backend.
Signature
-
returns
Boolean
Whether there is an active trace.
Implementation
def self.active?
!!self.trace_context
end
def self.enabled?
Signature
-
returns
Boolean
Whether there is an active backend.
Implementation
def self.enabled?
Backend.const_defined?(:Interface)
end
def self.Provider(klass, &block)
Extend the specified class in order to emit traces.
Implementation
def self.Provider(klass, &block)
klass.extend(Singleton)
provider = klass.traces_provider
klass.prepend(provider)
provider.module_exec(&block) if block_given?
return provider
end