class Raven::Context

Attributes

extra[RW]
os[RW]
rack_env[RW]
runtime[RW]
tags[RW]
user[RW]

Public Class Methods

clear!() click to toggle source
# File lib/raven/context.rb, line 9
def self.clear!
  Thread.current[:sentry_context] = nil
end
current() click to toggle source
# File lib/raven/context.rb, line 5
def self.current
  Thread.current[:sentry_context] ||= new
end
new() click to toggle source
# File lib/raven/context.rb, line 15
def initialize
  self.extra = {}
  self.os = self.class.os_context
  self.rack_env = nil
  self.runtime = self.class.runtime_context
  self.tags = {}
  self.user = {}
end
os_context() click to toggle source
# File lib/raven/context.rb, line 25
def os_context
  @os_context ||= {
    "name" => Raven.sys_command("uname -s") || RbConfig::CONFIG["host_os"],
    "version" => Raven.sys_command("uname -v"),
    "build" => Raven.sys_command("uname -r"),
    "kernel_version" => Raven.sys_command("uname -a") || Raven.sys_command("ver") # windows
  }
end
runtime_context() click to toggle source
# File lib/raven/context.rb, line 34
def runtime_context
  @runtime_context ||= {
    "name" => RbConfig::CONFIG["ruby_install_name"],
    "version" => Raven.sys_command("ruby -v")
  }
end