class Wildsight::Context::Context

Public Class Methods

new(name, agent) click to toggle source
# File lib/wildsight/context/context.rb, line 10
def initialize(name, agent)
  @name = name
  @agent = agent
  @data = {}
end
thread_context_id(thread=Thread.current) click to toggle source
# File lib/wildsight/context/context.rb, line 52
def self.thread_context_id(thread=Thread.current)
  thread.thread_variable_get('wildsight.context')
end

Public Instance Methods

bind_thread(thread = Thread.current) click to toggle source
# File lib/wildsight/context/context.rb, line 28
def bind_thread(thread = Thread.current)
  thread.thread_variable_set('wildsight.context', self)
end
data() click to toggle source
# File lib/wildsight/context/context.rb, line 20
def data
  @data
end
event(series, data, values = {}, occurred = DateTime.now, source = Wildsight.source, host = Wildsight.host) click to toggle source
# File lib/wildsight/context/context.rb, line 36
def event(series, data, values = {}, occurred = DateTime.now, source = Wildsight.source, host = Wildsight.host)
  @agent.submit(:events, {
                    host: host,
                    source: source,
                    series: series,
                    context: @name,
                    occurred: occurred,
                    data: data,
                    values: values
                })
end
name() click to toggle source
# File lib/wildsight/context/context.rb, line 16
def name
  @name
end
profiler() click to toggle source
# File lib/wildsight/context/context.rb, line 48
def profiler
  @profiler ||= ::Wildsight::Profiler::Profiler.new(self)
end
release_thread(thread = Thread.current) click to toggle source
# File lib/wildsight/context/context.rb, line 32
def release_thread(thread = Thread.current)
  thread.thread_variable_set('wildsight.context', nil)
end
unregister() click to toggle source
# File lib/wildsight/context/context.rb, line 24
def unregister
  @agent.unregister_context(self)
end