Module: Skylight
- Defined in:
- lib/skylight/probes/tilt.rb,
lib/skylight/gc.rb,
lib/skylight/api.rb,
lib/skylight/cli.rb,
lib/skylight/core.rb,
lib/skylight/util.rb,
lib/skylight/trace.rb,
lib/skylight/vm/gc.rb,
lib/skylight/compat.rb,
lib/skylight/config.rb,
lib/skylight/native.rb,
lib/skylight/probes.rb,
lib/skylight/helpers.rb,
lib/skylight/railtie.rb,
lib/skylight/version.rb,
lib/skylight/util/ssl.rb,
lib/skylight/util/gzip.rb,
lib/skylight/util/http.rb,
lib/skylight/middleware.rb,
lib/skylight/subscriber.rb,
lib/skylight/util/clock.rb,
lib/skylight/normalizers.rb,
lib/skylight/instrumenter.rb,
lib/skylight/probes/excon.rb,
lib/skylight/probes/redis.rb,
lib/skylight/util/logging.rb,
lib/skylight/probes/sequel.rb,
lib/skylight/util/hostname.rb,
lib/skylight/util/multi_io.rb,
lib/skylight/util/platform.rb,
lib/skylight/probes/sinatra.rb,
lib/skylight/util/inflector.rb,
lib/skylight/formatters/http.rb,
lib/skylight/probes/net_http.rb,
lib/skylight/normalizers/default.rb,
lib/skylight/util/allocation_free.rb,
lib/skylight/normalizers/moped/query.rb,
lib/skylight/probes/excon/middleware.rb,
lib/skylight/util/native_ext_fetcher.rb,
lib/skylight/normalizers/active_record/sql.rb,
lib/skylight/normalizers/active_support/cache.rb,
lib/skylight/normalizers/active_support/cache_read.rb,
lib/skylight/normalizers/action_view/render_partial.rb,
lib/skylight/normalizers/active_support/cache_clear.rb,
lib/skylight/normalizers/active_support/cache_exist.rb,
lib/skylight/normalizers/active_support/cache_write.rb,
lib/skylight/normalizers/action_controller/send_file.rb,
lib/skylight/normalizers/action_view/render_template.rb,
lib/skylight/normalizers/active_support/cache_delete.rb,
lib/skylight/normalizers/action_view/render_collection.rb,
lib/skylight/normalizers/active_support/cache_generate.rb,
lib/skylight/normalizers/active_support/cache_decrement.rb,
lib/skylight/normalizers/active_support/cache_fetch_hit.rb,
lib/skylight/normalizers/active_support/cache_increment.rb,
lib/skylight/normalizers/active_support/cache_read_multi.rb,
lib/skylight/normalizers/action_controller/process_action.rb,
ext/skylight_native.c
Overview
Used from extconf.rb
Defined Under Namespace
Modules: Formatters, Helpers, Normalizers, Probes, Util, VM Classes: Api, CLI, Config, ConfigError, GC, Instrumenter, Middleware, Railtie, Subscriber, Trace
Constant Summary collapse
- TRACE_ENV_KEY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'SKYLIGHT_ENABLE_TRACE_LOGS'.freeze
- TIERS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%w( api app view db noise other)
- TIER_REGEX =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
/^(?:#{TIERS.join('|')})(?:\.|$)/u
- CATEGORY_REGEX =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
/^[a-z0-9_-]+(?:\.[a-z0-9_-]+)*$/iu
- DEFAULT_CATEGORY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"app.block".freeze
- DEFAULT_OPTIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ category: DEFAULT_CATEGORY }
- VERSION =
'0.6.0'
- @@has_native_ext =
This classvariable is part of a private API. You should avoid using this classvariable if possible, as it may be removed or be changed in the future.
Whether or not the native extension is present
false
Class Method Summary collapse
- .check_install_errors(config) ⇒ Object private
-
.disable ⇒ Object
Temporarily disable.
-
.done(span) ⇒ Object
End a trace.
-
.instrument(opts = DEFAULT_OPTIONS) ⇒ Object
Instrument.
- .libskylight_path ⇒ Object
- .load_libskylight(path) ⇒ Object
- .native? ⇒ Boolean
-
.start!(*args) ⇒ Object
Start instrumenting.
-
.stop!(*args) ⇒ Object
Stop instrumenting.
-
.trace(endpoint = nil, cat = nil, title = nil) ⇒ Object
Start a trace.
- .warn_skylight_native_missing(config) ⇒ Object private
Class Method Details
.check_install_errors(config) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/skylight/native.rb', line 48 def self.check_install_errors(config) # Note: An unsupported arch doesn't count as an error. install_log = File.("../../ext/install.log", __FILE__) if File.exist?(install_log) && File.read(install_log) =~ /ERROR/ config.alert_logger.error \ "[SKYLIGHT] [#{Skylight::VERSION}] The Skylight native extension failed to install. " \ "Please check #{install_log} and notify [email protected]." \ "The missing extension will not affect the functioning of your application." end end |
.disable ⇒ Object
Temporarily disable
114 115 116 117 118 119 120 121 |
# File 'lib/skylight/core.rb', line 114 def self.disable unless inst = Instrumenter.instance return yield if block_given? return end inst.disable { yield } end |
.done(span) ⇒ Object
End a trace
82 83 84 85 |
# File 'lib/skylight/core.rb', line 82 def self.done(span) return unless inst = Instrumenter.instance inst.done(span) end |
.instrument(opts = DEFAULT_OPTIONS) ⇒ Object
Instrument
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/skylight/core.rb', line 88 def self.instrument(opts = DEFAULT_OPTIONS) unless inst = Instrumenter.instance return yield if block_given? return end if Hash === opts category = opts[:category] || DEFAULT_CATEGORY title = opts[:title] desc = opts[:description] annotations = opts[:annotations] else category = DEFAULT_CATEGORY title = opts.to_s desc = nil annotations = nil end if block_given? inst.instrument(category, title, desc, annotations) { yield } else inst.instrument(category, title, desc, annotations) end end |
.libskylight_path ⇒ Object
12 13 14 |
# File 'lib/skylight/native.rb', line 12 def self.libskylight_path ENV['SKYLIGHT_LIB_PATH'] || File.("../native/#{Util::Platform.tuple}", __FILE__) end |
.load_libskylight(path) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'ext/skylight_native.c', line 112
static VALUE
load_libskylight(VALUE klass, VALUE path) {
int res;
UNUSED(klass);
CHECK_TYPE(path, T_STRING);
// Already loaded
if (sky_hrtime != 0) {
return Qnil;
}
res = sky_load_libskylight(StringValueCStr(path));
if (res < 0) {
rb_raise(rb_eRuntimeError, "[SKYLIGHT] dlerror; msg=%s", dlerror());
return Qnil;
}
return Qnil;
}
|
.native? ⇒ Boolean
8 9 10 |
# File 'lib/skylight/native.rb', line 8 def self.native? @@has_native_ext end |
.start!(*args) ⇒ Object
Start instrumenting
58 59 60 |
# File 'lib/skylight/core.rb', line 58 def self.start!(*args) Instrumenter.start!(*args) end |
.stop!(*args) ⇒ Object
Stop instrumenting
63 64 65 |
# File 'lib/skylight/core.rb', line 63 def self.stop!(*args) Instrumenter.stop!(*args) end |
.trace(endpoint = nil, cat = nil, title = nil) ⇒ Object
Start a trace
68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/skylight/core.rb', line 68 def self.trace(endpoint=nil, cat=nil, title=nil) unless inst = Instrumenter.instance return yield if block_given? return end if block_given? inst.trace(endpoint, cat || DEFAULT_CATEGORY, title) { yield } else inst.trace(endpoint, cat || DEFAULT_CATEGORY, title) end end |
.warn_skylight_native_missing(config) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
61 62 63 64 65 66 67 68 |
# File 'lib/skylight/native.rb', line 61 def self.warn_skylight_native_missing(config) config.alert_logger.error \ "[SKYLIGHT] [#{Skylight::VERSION}] The Skylight native extension for " \ "your platform wasn't found. Supported operating systems are " \ "Linux 2.6.18+ and Mac OS X 10.8+. The missing extension will not " \ "affect the functioning of your application. If you are on a " \ "supported platform, please contact support at [email protected]." end |