skylight 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24be9df7072117a45c6e4396a7d164551ca75fc7
4
- data.tar.gz: ca45a492d94fdef72c28a3737c873e30a1e6a735
3
+ metadata.gz: 07ad6f51f16a2685aa613f53a07fdc2f26b7dcb4
4
+ data.tar.gz: c3ace6d10462ad30f3dec91ea151d6c848ba8009
5
5
  SHA512:
6
- metadata.gz: cb70e2c9aeb62bb59df1c1070218cdd18301a8d3280d515969b51751fcf9aedbde0af55b772a96eaa0d0a0b53ab8b38dfe3ef87631721b3545ec4b2270aeeb82
7
- data.tar.gz: 9d9f034c346ff2ae0c1629092ccdc349d08a598f5ad21c4b78d8fe006bf7ddd641a77a0019b902133867ccb8bb1298f22167cd6d734189df904a1cf948e7cb48
6
+ metadata.gz: 09b2818afb8bf45d3f712649d5c5cebfc18fb42c8017c6df8c7507e9e70d4c210fafc6c68275a2b55dca60c5a6e3a900ecbcce51bd948e9ae5a50e32dd8f0198
7
+ data.tar.gz: 3226dd5aba569387393a4e81e3b508135166b45712f894084f13405fffa0060aa669793d8408d7aaf3e406ce7eea4ec8c422f4e6eb33409913a62df8e65c95bb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 0.9.0 (November, 6, 2015)
2
+
3
+ * [FEATURE] Expose Skylight::Helpers.instrument_class_method
4
+ * [BUGFIX] Allow for instrumentation of setters
5
+ * [BUGFIX] Fix an issue where loading some items in the Grape namespace without loading the whole library would cause an exception.
6
+ * [IMPROVEMENT] Switch to Rust SQL lexer by default
7
+ * [IMPROVEMENT] Add support for Redis pipelined and multi
8
+ * [IMPROVEMENT] Updated Rust internals
9
+ * [IMPROVEMENT] Agent should now work on current Rails master
10
+ * [IMPROVEMENT] Better disabling of development mode warning
11
+
1
12
  ## 0.8.1 (October 1, 2015)
2
13
 
3
14
  * [BUGFIX] Fix agent on OS X El Capitan.
data/CONTRIBUTING.md CHANGED
@@ -1 +1,9 @@
1
- Before contributing, please [sign the CLA](https://docs.google.com/spreadsheet/viewform?usp=drive_web&formkey=dHJVY1M5bzNzY0pwN2dRZjMxV0dXSkE6MA#gid=0).
1
+ ## Bug Reports and Feature Requests
2
+
3
+ If you've got a bug report or have a feature you'd like to request, please contact us at support@skylight.io or use the "?" button in the Skylight web interface. We'll be much quicker to respond that way :)
4
+
5
+ ## Pull Requests
6
+
7
+ Before contributing, please [sign the CLA](https://docs.google.com/spreadsheet/viewform?usp=drive_web&formkey=dHJVY1M5bzNzY0pwN2dRZjMxV0dXSkE6MA#gid=0).
8
+
9
+ In general, we recommend that you speak with us about any new features you'd like to add so we can make sure we're on the same page.
data/README.md CHANGED
@@ -5,4 +5,9 @@ servers.
5
5
 
6
6
  Sign up at https://skylight.io.
7
7
 
8
- For more documentation see https://docs.skylight.io/.
8
+ For more documentation see https://docs.skylight.io/.
9
+
10
+
11
+ ## Bug Reports and Feature Requests
12
+
13
+ If you've got a bug report or have a feature you'd like to request, please contact us at support@skylight.io or use the "?" button in the Skylight web interface. We'll be much quicker to respond that way :)
data/ext/libskylight.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
- version: "0.7.0-6aad54d"
2
+ version: "0.7.0-1630bf6"
3
3
  checksums:
4
- x86-linux: "a3a16d2de1070d455dae8e46f95c8fa3621adfb062f7b23d629df870d6d7b385"
5
- x86_64-linux: "c62bcb68c124c5664cf22254c17db68b7f7a3fe6da9148a3f49c546449a9e766"
6
- x86_64-darwin: "bb42c08044a94332a69c7d343273488d44ed7c85d3f1e2f37834f4ed6cdd178d"
4
+ x86-linux: "74692e77f1fbfd7fdf0e948ab9a189a3485e9f65759a59500c73a8dba040980f"
5
+ x86_64-linux: "f18b2f0c872cfc59ad21bee2f490c211fdbe0bde85777228aad16219e9fd0555"
6
+ x86_64-darwin: "466cb1adb917858972f7180b92b0043323a3c905598081746a362869d1c84368"
data/lib/skylight/cli.rb CHANGED
@@ -53,6 +53,14 @@ you should set the `SKYLIGHT_AUTHENTICATION` variable to:
53
53
  rescue Interrupt
54
54
  end
55
55
 
56
+ desc "disable_dev_warning", "Disables warning about running Skylight in development mode for all local apps"
57
+ def disable_dev_warning
58
+ user_config.disable_dev_warning = true
59
+ user_config.save
60
+
61
+ say "Development mode warning disabled", :green
62
+ end
63
+
56
64
  private
57
65
 
58
66
  def app_name
@@ -142,5 +150,9 @@ you should set the `SKYLIGHT_AUTHENTICATION` variable to:
142
150
  @config ||= Config.load
143
151
  end
144
152
 
153
+ def user_config
154
+ UserConfig.instance
155
+ end
156
+
145
157
  end
146
158
  end
@@ -84,7 +84,7 @@ module Skylight
84
84
  DEFAULTS = {
85
85
  :'version' => VERSION,
86
86
  :'auth_url' => 'https://auth.skylight.io/agent',
87
- :'sql_mode' => 'ruby',
87
+ :'sql_mode' => 'rust',
88
88
  :'daemon.lazy_start' => true,
89
89
 
90
90
  # == Legacy ==
@@ -105,7 +105,6 @@ module Skylight
105
105
  :'accounts.port' => 443,
106
106
  :'accounts.ssl' => true,
107
107
  :'accounts.deflate' => false,
108
- :'me.credentials_path' => '~/.skylight',
109
108
  :'metrics.report_interval' => 60
110
109
  }
111
110
 
data/lib/skylight/core.rb CHANGED
@@ -16,6 +16,7 @@ module Skylight
16
16
 
17
17
  # Require VM specific things
18
18
  require 'skylight/config'
19
+ require 'skylight/user_config'
19
20
  require 'skylight/gc'
20
21
  require 'skylight/helpers'
21
22
  require 'skylight/instrumenter'
@@ -15,8 +15,7 @@ module Skylight
15
15
 
16
16
  if opts = @__sk_instrument_next_method
17
17
  @__sk_instrument_next_method = nil
18
- title = "#{to_s}##{name}"
19
- __sk_instrument_method_on(self, name, title, opts)
18
+ instrument_method(name, opts)
20
19
  end
21
20
  end
22
21
 
@@ -26,8 +25,7 @@ module Skylight
26
25
 
27
26
  if opts = @__sk_instrument_next_method
28
27
  @__sk_instrument_next_method = nil
29
- title = "#{to_s}.#{name}"
30
- __sk_instrument_method_on(__sk_singleton_class, name, title, opts)
28
+ instrument_class_method(name, opts)
31
29
  end
32
30
  end
33
31
 
@@ -91,6 +89,46 @@ module Skylight
91
89
  end
92
90
  end
93
91
 
92
+ # @overload instrument_class_method([name], opts={})
93
+ # @param [Symbol|String] [name]
94
+ # @param [Hash] opts
95
+ # @option opts [String] :category ('app.method')
96
+ # @option opts [String] :title (ClassName#method_name)
97
+ # @option opts [String] :description
98
+ #
99
+ # You may also declare the methods to instrument at any time by passing the name
100
+ # of the method as the first argument to `instrument_method`.
101
+ #
102
+ # @example With name
103
+ # class MyClass
104
+ # include Skylight::Helpers
105
+ #
106
+ # def self.my_method
107
+ # do_expensive_stuff
108
+ # end
109
+ #
110
+ # instrument_class_method :my_method
111
+ # end
112
+ #
113
+ # By default, the event will be titled using the name of the class and the
114
+ # method. For example, in our previous example, the event name will be:
115
+ # +MyClass.my_method+. You can customize this by passing using the *:title* option.
116
+ #
117
+ # @example With title
118
+ # class MyClass
119
+ # include Skylight::Helpers
120
+ #
121
+ # def self.my_method
122
+ # do_expensive_stuff
123
+ # end
124
+ #
125
+ # instrument_class_method :my_method, title: 'Expensive work'
126
+ # end
127
+ def instrument_class_method(name, opts = {})
128
+ title = "#{to_s}.#{name}"
129
+ __sk_instrument_method_on(__sk_singleton_class, name, title, opts || {})
130
+ end
131
+
94
132
  private
95
133
 
96
134
  def __sk_instrument_method_on(klass, name, title, opts)
@@ -108,7 +146,7 @@ module Skylight
108
146
  description: #{desc.inspect})
109
147
 
110
148
  begin
111
- before_instrument_#{name}(*args, &blk)
149
+ send(:before_instrument_#{name}, *args, &blk)
112
150
  ensure
113
151
  Skylight.done(span) if span
114
152
  end
@@ -15,7 +15,17 @@ module Skylight
15
15
  alias render_with_layout_without_sk render_with_layout
16
16
 
17
17
  def render_with_layout(path, locals, *args, &block) #:nodoc:
18
- layout = path && find_layout(path, locals.keys)
18
+ layout = nil
19
+
20
+ if path
21
+ if method(:find_layout).arity == 3
22
+ # Rails 5
23
+ layout = find_layout(path, locals.keys, [formats.first])
24
+ else
25
+ # Rails 3, 4
26
+ layout = find_layout(path, locals.keys)
27
+ end
28
+ end
19
29
 
20
30
  if layout
21
31
  instrument(:template, :identifier => layout.identifier) do
@@ -81,6 +81,6 @@ module Skylight
81
81
  end
82
82
  end
83
83
 
84
- register("Grape", "grape", Grape::Probe.new)
84
+ register("Grape::Endpoint", "grape/endpoint", Grape::Probe.new)
85
85
  end
86
86
  end
@@ -3,6 +3,15 @@ module Skylight
3
3
  module Redis
4
4
  class Probe
5
5
  def install
6
+ version = defined?(::Redis::VERSION) ? Gem::Version.new(::Redis::VERSION) : nil
7
+
8
+ if !version || version < Gem::Version.new("3.0.0")
9
+ # Using $stderr here isn't great, but we don't have a logger accessible
10
+ $stderr.puts "[SKYLIGHT] [#{Skylight::VERSION}] The installed version of Redis doesn't " \
11
+ "support Middlewares. At least version 3.0.0 is required."
12
+ return
13
+ end
14
+
6
15
  ::Redis::Client.class_eval do
7
16
  alias call_without_sk call
8
17
 
@@ -22,6 +31,38 @@ module Skylight
22
31
  end
23
32
  end
24
33
  end
34
+
35
+ # Unfortunately, because of the nature of pipelining, there's no way for us to
36
+ # give a time breakdown on the individual items.
37
+
38
+ PIPELINED_OPTS = {
39
+ category: "db.redis.pipelined".freeze,
40
+ title: "PIPELINE".freeze
41
+ }.freeze
42
+
43
+ MULTI_OPTS = {
44
+ category: "db.redis.multi".freeze,
45
+ title: "MULTI".freeze
46
+ }.freeze
47
+
48
+ ::Redis.class_eval do
49
+ alias pipelined_without_sk pipelined
50
+
51
+ def pipelined(&block)
52
+ Skylight.instrument(PIPELINED_OPTS) do
53
+ pipelined_without_sk(&block)
54
+ end
55
+ end
56
+
57
+
58
+ alias multi_without_sk multi
59
+
60
+ def multi(&block)
61
+ Skylight.instrument(MULTI_OPTS) do
62
+ multi_without_sk(&block)
63
+ end
64
+ end
65
+ end
25
66
  end
26
67
  end
27
68
 
@@ -33,8 +33,10 @@ module Skylight
33
33
  end
34
34
  end
35
35
  elsif Rails.env.development?
36
- log_warning config, "[SKYLIGHT] [#{Skylight::VERSION}] Running Skylight in development mode. No data will be reported until you deploy your app.\n" \
37
- "(To disable this message, set `alert_log_file` in your config.)"
36
+ unless UserConfig.instance.disable_dev_warning?
37
+ log_warning config, "[SKYLIGHT] [#{Skylight::VERSION}] Running Skylight in development mode. No data will be reported until you deploy your app.\n" \
38
+ "(To disable this message for all local apps, run `skylight disable_dev_warning`.)"
39
+ end
38
40
  elsif !Rails.env.test?
39
41
  log_warning config, "[SKYLIGHT] [#{Skylight::VERSION}] You are running in the #{Rails.env} environment but haven't added it to config.skylight.environments, so no data will be sent to skylight.io."
40
42
  end
@@ -0,0 +1,43 @@
1
+ require 'yaml'
2
+
3
+ module Skylight
4
+ class UserConfig
5
+
6
+ attr_accessor :disable_dev_warning
7
+
8
+ def self.instance
9
+ @instance ||= new
10
+ end
11
+
12
+ def initialize
13
+ reload
14
+ end
15
+
16
+ def file_path
17
+ File.expand_path("~/.skylight")
18
+ end
19
+
20
+ def disable_dev_warning?
21
+ disable_dev_warning
22
+ end
23
+
24
+ def reload
25
+ config = File.exist?(file_path) ? YAML.load_file(file_path) : {}
26
+ self.disable_dev_warning = !!config['disable_dev_warning']
27
+ end
28
+
29
+ def save
30
+ FileUtils.mkdir_p(File.dirname(file_path))
31
+ File.open(file_path, 'w') do |f|
32
+ f.puts YAML.dump(to_hash)
33
+ end
34
+ end
35
+
36
+ def to_hash
37
+ {
38
+ 'disable_dev_warning' => disable_dev_warning
39
+ }
40
+ end
41
+
42
+ end
43
+ end
@@ -1,4 +1,4 @@
1
1
  module Skylight
2
- VERSION = '0.8.1'
2
+ VERSION = '0.9.0'
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skylight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tilde, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-02 00:00:00.000000000 Z
11
+ date: 2015-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -95,6 +95,7 @@ files:
95
95
  - lib/skylight/sinatra.rb
96
96
  - lib/skylight/subscriber.rb
97
97
  - lib/skylight/trace.rb
98
+ - lib/skylight/user_config.rb
98
99
  - lib/skylight/util.rb
99
100
  - lib/skylight/util/allocation_free.rb
100
101
  - lib/skylight/util/clock.rb
@@ -178,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
179
  version: '0'
179
180
  requirements: []
180
181
  rubyforge_project:
181
- rubygems_version: 2.4.8
182
+ rubygems_version: 2.4.5.1
182
183
  signing_key:
183
184
  specification_version: 4
184
185
  summary: Skylight is a smart profiler for Rails apps