lib/skylight.rb in skylight-0.1.7.alpha1 vs lib/skylight.rb in skylight-0.1.7
- old
+ new
@@ -21,10 +21,11 @@
autoload :Api, 'skylight/api'
autoload :CLI, 'skylight/cli'
autoload :Config, 'skylight/config'
autoload :GC, 'skylight/gc'
+ autoload :Helpers, 'skylight/helpers'
autoload :Instrumenter, 'skylight/instrumenter'
autoload :Messages, 'skylight/messages'
autoload :Middleware, 'skylight/middleware'
autoload :Normalizers, 'skylight/normalizers'
autoload :Subscriber, 'skylight/subscriber'
@@ -57,10 +58,11 @@
noise
other)
TIER_REGEX = /^(?:#{TIERS.join('|')})(?:\.|$)/
CATEGORY_REGEX = /^[a-z0-9_-]+(?:\.[a-z0-9_-]+)*$/i
+ DEFAULT_CATEGORY = "app.block".freeze
def self.start!(*args)
Instrumenter.start!(*args)
end
@@ -75,16 +77,26 @@
end
inst.trace(*args, &blk)
end
- def self.instrument(*args, &blk)
+ def self.instrument(opts = {}, &blk)
unless inst = Instrumenter.instance
return yield if block_given?
return
end
- inst.instrument(*args, &blk)
+ if Hash === opts
+ category = opts.delete(:category) || DEFAULT_CATEGORY
+ title = opts.delete(:title)
+ desc = opts.delete(:description)
+ else
+ category = DEFAULT_CATEGORY
+ title = opts.to_s
+ desc = nil
+ end
+
+ inst.instrument(category, title, desc, &blk)
end
RUBYBIN = File.join(
RbConfig::CONFIG['bindir'],
"#{RbConfig::CONFIG['ruby_install_name']}#{RbConfig::CONFIG['EXEEXT']}")