skylight 2.0.0.beta3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b5dae77c81d35433c8d2da47b0a7a2b82f7730888802cf3ab892815ceba3f5a
4
- data.tar.gz: f8c1649317979a382353b1410e1453e4af12fa025e2d03302860af1673990317
3
+ metadata.gz: 17059168e3e446548088b9b7c407c1bbccb75c23761bcb86cda22a25bf33f1b2
4
+ data.tar.gz: 8e7c71985c76b22fdf0b02055a2ef383941590cb6f1780386611c6a7a83f3b37
5
5
  SHA512:
6
- metadata.gz: 00f7d040355b847525a0c4d1ee6e47a5e64ab8040f9a7cb709fdbd482a912e6fef7d218a181bb9eb655fd3bdabd83a8af7d279527910c2ab783238b17780e519
7
- data.tar.gz: dbe7b6e960a53d0be3f5ea0423b4bad1cb5dc90f0343c9ea7d73a897182537255f7a7d099e1e31d47e672abc24d29317bce511581c0d436f339091affbd8f74a
6
+ metadata.gz: 90d537527078acf4b625b8316fb172f30a5ba262674ccd235e3e1171beda689bbd0dedb6366ec843716c3ff51aa3993e79b03e9127e78a353d6f4cdb64a415ad
7
+ data.tar.gz: fbe5fd2153f0a85c3ae15f25d3aa364400e095743f810a86813e21dc08a510007e6719ef5de43e90a83ea175d3f6e2487c39960f69af5c8c1ef7f80fb67c0247
@@ -1,19 +1,35 @@
1
- ## 2.0.0-beta3 (March 22, 2017)
1
+ ## 2.0.0 (April 25, 2018)
2
2
 
3
+ * [FEATURE] New SQL lexer to support a wider variety of SQL queries.
4
+ * [BREAKING] Drop support for Ruby versions prior to 2.2
5
+ * [BREAKING] Drop support for Rails versions prior to 4.2
6
+ * [BREAKING] Drop support for Tilt versions prior to 1.4.1
7
+ * [BREAKING] Drop support for Sinatra versions prior to 1.4
8
+ * [BREAKING] Drop support for Grape versions prior to 0.13.0
9
+ * [BREAKING] Drop support for Linux with glibc versions prior to 2.15
10
+ * [BREAKING] Remove couch_potato normalizer as it doesn't appear to have ever worked
3
11
  * [BREAKING] `log_sql_parse_errors` config option is now on by default.
12
+ * [IMPROVEMENT] Auto-disable Middleware probe if it appears to be causing issues
13
+ * [IMPROVEMENT] More detailed logging and improved error handling
14
+ * [IMPROVEMENT] Fix Ruby Warnings (Thanks @amatsuda!)
4
15
  * [IMPROVEMENT] Improved handling of errors generated in the Rust agent.
5
- * [IMPROVEMENT] Add a probe method to Instrumentable as a shortcut
6
16
  * [IMRPOVEMENT] Add logging to Instrumentable for easier access
7
17
  * [IMPROVEMENT] Improved logging during startup
8
18
 
9
- ## 2.0.0-beta2 (February 5, 2017)
19
+ ## 1.7.0 (April 24, 2018)
10
20
 
11
- * [BUGFIX] Fix incorrect module path that caused installation issues
21
+ * [FEATURE] New API for loading Probes. Example: `Skylight.probe(:excon')`
22
+ * [FEATURE] New API for enabling non-default Normalizers. Example: `Skylight.enable_normalizer('active_job')`
23
+ * [DEPRECATION] Support for Rails versions prior to 4.2
24
+ * [DEPRECATION] Support for Tilt versions prior to 1.4.1
25
+ * [DEPRECATION] Support for Sinatra versions prior to 1.4
26
+ * [DEPRECATION] Support for Grape versions prior to 0.13.0
12
27
 
13
- ## 2.0.0-beta1 (February 5, 2017)
28
+ ## 1.6.1 (April 12, 2018)
14
29
 
15
- * [FEATURE] New SQL lexer to support a wider variety of SQL queries.
16
- * [BREAKING] Drop support for a number of deprecated libraries, including Rails prior to 4.2, Ruby prior to 2.2, and Sinatra prior to 1.4.
30
+ * [IMPROVEMENT] Include endpoint name in error logging
31
+ * [BUGFIX] Make sure to correctly release broken traces
32
+ * [BUGFIX] Keep the `require` method private when overwriting
17
33
 
18
34
  ## 1.6.0 (March 21, 2018)
19
35
 
@@ -1,8 +1,8 @@
1
1
  ---
2
- version: "2.0.0-5ca78bf"
2
+ version: "2.0.0-b7a5dfb"
3
3
  checksums:
4
- x86-linux: "b919d4bba6cd4998f63115a558229ac4f151b5a2df1acec767a6956650b5dc36"
5
- x86_64-linux: "862f509a9c4b53f4d18d1f41a1fbd6919ac822a7efa3c24a57acbfaf85a450ac"
6
- x86_64-linux-musl: "b1bec2068b32465ae70291f5376f4384bcc09635be678974ee93a3f9a847bfe2"
7
- x86_64-darwin: "4cad72f0b4d7fda8e785b98e4d1523f05216e4b925ab79db02713f463c387011"
8
- x86_64-freebsd: "103bdfb9c47c90855b78f5e7bfa591e935ad6239533c6c3f07a1d82cf5a1528a"
4
+ x86-linux: "9d0f7236869d27c4f3614fa3428271c1d5a1d5cb0a7ac42d6242610b0baa3295"
5
+ x86_64-linux: "12a0ec3c8e74a23e38d4ccaf670a5d167e2d977075b89caf5f3e9b2274b83d4d"
6
+ x86_64-linux-musl: "23c0858b0a8e5aad5fb34f7417f677dadc37c66a874e9a43ffae32f6ed174ce6"
7
+ x86_64-darwin: "0a62e2cca7b13b1663663a84071b1be428556c69f2eee74a2e698c8ada8b4381"
8
+ x86_64-freebsd: "a3f10212dce2dbc4f169dbb1ec18c58ede4bbf324aa0bdbd9ff79fecc37b7423"
@@ -46,8 +46,10 @@ STR2BUF(VALUE str) {
46
46
 
47
47
  #define CHECK_FFI(code, method_name) \
48
48
  do { \
49
- if ((code) != 0 ) { \
50
- VALUE error_class = rb_funcall(rb_eNativeError, rb_intern("for_code"), 1, INT2NUM(code)); \
49
+ /* Ensure single execution if code is function call */ \
50
+ int c = (code); \
51
+ if (c != 0 ) { \
52
+ VALUE error_class = rb_funcall(rb_eNativeError, rb_intern("for_code"), 1, INT2NUM(c)); \
51
53
  rb_raise(error_class, method_name); \
52
54
  return Qnil; \
53
55
  } \
@@ -155,11 +157,12 @@ clock_high_res_time(VALUE self) {
155
157
  */
156
158
 
157
159
  static VALUE
158
- instrumenter_new(VALUE klass, VALUE rb_env) {
160
+ instrumenter_new(VALUE klass, VALUE rb_uuid, VALUE rb_env) {
159
161
  sky_instrumenter_t* instrumenter;
160
162
  sky_buf_t env[256];
161
163
  int i, envc;
162
164
 
165
+ CHECK_TYPE(rb_uuid, T_STRING);
163
166
  CHECK_TYPE(rb_env, T_ARRAY);
164
167
 
165
168
  if (RARRAY_LEN(rb_env) >= 256) {
@@ -179,7 +182,7 @@ instrumenter_new(VALUE klass, VALUE rb_env) {
179
182
  }
180
183
 
181
184
  CHECK_FFI(
182
- sky_instrumenter_new(env, envc, &instrumenter),
185
+ sky_instrumenter_new(STR2BUF(rb_uuid), env, envc, &instrumenter),
183
186
  "Instrumenter#native_new");
184
187
 
185
188
  return Data_Wrap_Struct(klass, NULL, sky_instrumenter_free, instrumenter);
@@ -572,7 +575,7 @@ void Init_skylight_native() {
572
575
  rb_define_method(rb_cTrace, "native_span_get_correlation_header", trace_span_get_correlation_header, 1);
573
576
 
574
577
  rb_cInstrumenter = rb_const_get(rb_mSkylight, rb_intern("Instrumenter"));
575
- rb_define_singleton_method(rb_cInstrumenter, "native_new", instrumenter_new, 1);
578
+ rb_define_singleton_method(rb_cInstrumenter, "native_new", instrumenter_new, 2);
576
579
  rb_define_method(rb_cInstrumenter, "native_start", instrumenter_start, 0);
577
580
  rb_define_method(rb_cInstrumenter, "native_stop", instrumenter_stop, 0);
578
581
  rb_define_method(rb_cInstrumenter, "native_submit_trace", instrumenter_submit_trace, 1);
@@ -29,4 +29,6 @@ module Skylight
29
29
  Config
30
30
  end
31
31
 
32
+ Core::Probes.add_path(File.expand_path("skylight/probes", __dir__))
33
+
32
34
  end
@@ -1,5 +1,5 @@
1
1
  require 'openssl'
2
- require 'skylight/core/util/deploy'
2
+ require 'skylight/util/deploy'
3
3
  require 'skylight/core/util/platform'
4
4
  require 'skylight/util/hostname'
5
5
  require 'skylight/util/ssl'
@@ -25,6 +25,9 @@ module Skylight
25
25
  # == Sql Lexer ==
26
26
  'USE_OLD_SQL_LEXER' => :use_old_sql_lexer,
27
27
 
28
+ # == Max Span Handling ==
29
+ 'REPORT_MAX_SPANS_EXCEEDED' => :report_max_spans_exceeded,
30
+
28
31
  # == Instrumenter ==
29
32
  "IGNORED_ENDPOINT" => :ignored_endpoint,
30
33
  "IGNORED_ENDPOINTS" => :ignored_endpoints,
@@ -80,7 +83,8 @@ module Skylight
80
83
  :validation_url => 'https://auth.skylight.io/agent/config',
81
84
  :'daemon.lazy_start' => true,
82
85
  :hostname => Util::Hostname.default_hostname,
83
- :use_old_sql_lexer => false
86
+ :use_old_sql_lexer => false,
87
+ :report_max_spans_exceeded => false
84
88
  )
85
89
 
86
90
  if Core::Util::Platform::OS != 'darwin'
@@ -113,7 +117,6 @@ module Skylight
113
117
  :version,
114
118
  :root,
115
119
  :hostname,
116
- :deploy_id,
117
120
  :session_token,
118
121
  :auth_url,
119
122
  :auth_http_deflate,
@@ -278,7 +281,7 @@ authentication: #{self[:authentication]}
278
281
  end
279
282
 
280
283
  def deploy
281
- @deploy ||= Core::Util::Deploy.build(self)
284
+ @deploy ||= Util::Deploy.build(self)
282
285
  end
283
286
 
284
287
  private
@@ -15,6 +15,6 @@ module Skylight
15
15
  end
16
16
  end
17
17
 
18
- Skylight::Core::Probes.register("Sinatra::Base", "sinatra/base", Sinatra::Probe.new)
18
+ Skylight::Core::Probes.register(:sinatra_add_middleware, "Sinatra::Base", "sinatra/base", Sinatra::Probe.new)
19
19
  end
20
20
  end
@@ -16,10 +16,10 @@ module Skylight
16
16
  config.skylight.config_path = "config/skylight.yml"
17
17
 
18
18
  # The probes to load
19
- # net_http, action_controller, action_view, middleware, and grape are on by default
19
+ # net_http, action_controller, action_dispatch, action_view, and middleware are on by default
20
20
  # See https://www.skylight.io/support/getting-more-from-skylight#available-instrumentation-options
21
21
  # for a full list.
22
- config.skylight.probes = ['net_http', 'action_controller', 'action_view', 'middleware', 'grape']
22
+ config.skylight.probes = ['net_http', 'action_controller', 'action_dispatch', 'action_view', 'middleware']
23
23
 
24
24
  # The position in the middleware stack to place Skylight
25
25
  # Default is first, but can be `{ after: Middleware::Name }` or `{ before: Middleware::Name }`
@@ -1,3 +1,2 @@
1
1
  require 'skylight'
2
- require 'skylight/probes/sinatra_add_middleware'
3
- Skylight.probe(:sinatra, :tilt, :sequel)
2
+ Skylight.probe(:sinatra_add_middleware, :sinatra, :tilt, :sequel)
@@ -1,4 +1,52 @@
1
1
  module Skylight
2
2
  class Trace < Core::Trace
3
+
4
+ def initialize(*)
5
+ super
6
+ @too_many_spans = false
7
+ end
8
+
9
+ def uuid
10
+ native_get_uuid
11
+ end
12
+
13
+ def uuid=(value)
14
+ # We can't change the UUID so just check to make sure we weren't trying to change
15
+ raise "unable to change uuid" unless value == uuid
16
+ end
17
+
18
+ def too_many_spans!
19
+ @too_many_spans = true
20
+ end
21
+
22
+ def too_many_spans?
23
+ !!@too_many_spans
24
+ end
25
+
26
+ def maybe_broken(e)
27
+ if e.is_a?(Skylight::MaximumTraceSpansError) && config.get(:report_max_spans_exceeded)
28
+ too_many_spans!
29
+ else
30
+ super
31
+ end
32
+ end
33
+
34
+ def traced
35
+ if too_many_spans?
36
+ error("[E%04d] The request exceeded the maximum number of spans allowed. It will still " \
37
+ "be tracked but with reduced information. endpoint=%s", Skylight::MaximumTraceSpansError.code, endpoint)
38
+ end
39
+
40
+ super
41
+ end
42
+
43
+ private
44
+
45
+ def track_gc(*)
46
+ # This attempts to log another span which will fail if we have too many
47
+ return if too_many_spans?
48
+ super
49
+ end
50
+
3
51
  end
4
52
  end
@@ -0,0 +1,134 @@
1
+ require 'json'
2
+ require 'uri'
3
+ require 'skylight/core/util/logging'
4
+
5
+ module Skylight
6
+ module Util
7
+
8
+ module Deploy
9
+
10
+ def self.build(config)
11
+ DEPLOY_TYPES.each do |type|
12
+ deploy = type.new(config)
13
+ return deploy if deploy.id
14
+ end
15
+ nil
16
+ end
17
+
18
+ class EmptyDeploy
19
+
20
+ attr_reader :config
21
+ attr_reader :timestamp
22
+
23
+ def initialize(config)
24
+ @config = config
25
+ @timestamp = Time.now.to_i
26
+ end
27
+
28
+ def id
29
+ git_sha
30
+ end
31
+
32
+ def git_sha
33
+ nil
34
+ end
35
+
36
+ def description
37
+ nil
38
+ end
39
+
40
+ def to_query_string
41
+ hash = {
42
+ timestamp: timestamp,
43
+ deploy_id: id.to_s[0..100] # Keep this sane
44
+ }
45
+ hash[:git_sha] = git_sha[0..40] if git_sha # A valid SHA will never exceed 40
46
+ hash[:description] = description[0..255] if description # Avoid massive descriptions
47
+ URI.encode_www_form(hash)
48
+ end
49
+
50
+ end
51
+
52
+ class DefaultDeploy < EmptyDeploy
53
+ include Core::Util::Logging
54
+
55
+ def initialize(*)
56
+ super
57
+ if description && !id
58
+ warn "The configured deploy will be ignored as an id or git_sha must be provided."
59
+ end
60
+ end
61
+
62
+ def id
63
+ config.get(:'deploy.id') || git_sha
64
+ end
65
+
66
+ def git_sha
67
+ config.get(:'deploy.git_sha')
68
+ end
69
+
70
+ def description
71
+ config.get(:'deploy.description')
72
+ end
73
+
74
+ end
75
+
76
+ class HerokuDeploy < EmptyDeploy
77
+
78
+ def initialize(*)
79
+ super
80
+ @info = get_info
81
+ end
82
+
83
+ def id
84
+ @info ? @info['id'] : nil
85
+ end
86
+
87
+ def git_sha
88
+ @info ? @info['commit'] : nil
89
+ end
90
+
91
+ def description
92
+ @info ? @info['description'] : nil
93
+ end
94
+
95
+ private
96
+
97
+ def get_info
98
+ info_path = config[:'heroku.dyno_info_path']
99
+
100
+ if File.exist?(info_path)
101
+ if info = JSON.parse(File.read(info_path))
102
+ info['release']
103
+ end
104
+ end
105
+ end
106
+
107
+ end
108
+
109
+ class GitDeploy < EmptyDeploy
110
+
111
+ attr_reader :git_sha, :description
112
+
113
+ def initialize(*)
114
+ super
115
+ @git_sha, @description = get_info
116
+ end
117
+
118
+ private
119
+
120
+ def get_info
121
+ Dir.chdir(config.root) do
122
+ info = `git log -1 --pretty="%H %s" 2>&1`
123
+ info.split(" ", 2).map(&:strip) if $?.success?
124
+ end
125
+ end
126
+
127
+ end
128
+
129
+ DEPLOY_TYPES = [DefaultDeploy, HerokuDeploy, GitDeploy]
130
+
131
+ end
132
+
133
+ end
134
+ end
@@ -1,4 +1,4 @@
1
1
  module Skylight
2
- VERSION = '2.0.0-beta3'
2
+ VERSION = '2.0.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: 2.0.0.beta3
4
+ version: 2.0.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: 2018-03-22 00:00:00.000000000 Z
11
+ date: 2018-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: skylight-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.0.beta3
19
+ version: 2.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.0.beta3
26
+ version: 2.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -184,11 +184,11 @@ files:
184
184
  - lib/skylight/middleware.rb
185
185
  - lib/skylight/native.rb
186
186
  - lib/skylight/native_ext_fetcher.rb
187
- - lib/skylight/normalizers/active_job/enqueue_at.rb
188
187
  - lib/skylight/probes/sinatra_add_middleware.rb
189
188
  - lib/skylight/railtie.rb
190
189
  - lib/skylight/sinatra.rb
191
190
  - lib/skylight/trace.rb
191
+ - lib/skylight/util/deploy.rb
192
192
  - lib/skylight/util/hostname.rb
193
193
  - lib/skylight/util/http.rb
194
194
  - lib/skylight/util/ssl.rb
@@ -247,12 +247,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
247
247
  version: 2.2.7
248
248
  required_rubygems_version: !ruby/object:Gem::Requirement
249
249
  requirements:
250
- - - ">"
250
+ - - ">="
251
251
  - !ruby/object:Gem::Version
252
- version: 1.3.1
252
+ version: '0'
253
253
  requirements: []
254
254
  rubyforge_project:
255
- rubygems_version: 2.7.3
255
+ rubygems_version: 2.7.6
256
256
  signing_key:
257
257
  specification_version: 4
258
258
  summary: Skylight is a smart profiler for Rails, Sinatra, and other Ruby apps.
@@ -1,3 +0,0 @@
1
- warn "[DEPRECATED] [SKYLIGHT] [#{Skylight::VERSION}] Require 'skylight/core/normalizers/active_job/enqueue_at' instead of 'skylight/normalizers/active_job/enqueue_at'."
2
-
3
- require 'skylight/core/normalizers/active_job/enqueue_at'