skylight 0.3.8 → 0.3.10

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
  SHA1:
3
- metadata.gz: 21e17f0c6b492a15fe9be1823c16121ffa55ffbb
4
- data.tar.gz: 000df33e16f6d5cd9c8e007e96f20d0a7fac89cb
3
+ metadata.gz: 8c2808cf85e0a48a911372e657dcfe99a191bf6e
4
+ data.tar.gz: bda10993e74865cc28f05f5db97a244ddf1af972
5
5
  SHA512:
6
- metadata.gz: 5bc55e53b477093f2239a954aa2892a14b34cf7a49d85d48c83c77a04348b09be58f6529fd6ce0e58a09dc9662f801ba890388390498ddf7045dfd83cb8250aa
7
- data.tar.gz: 8635a462ded00edf9e8cdf8c05919a64201a7f9d7e5b39a4cb107b89454635602cd1ef2a655fe3b2a989c403f90d782423d01cbbed6af202c2c84e72dbfe241a
6
+ metadata.gz: c247a8b0b9cde850ff0aa98cfb4a867fc73ef05539ab5f7fbdfc478e820a160bf0f4a8b22e94a94d2de731cf715fcefc623fc2dba64f1979738ffdb08c0620a0
7
+ data.tar.gz: 7f7893da15b537872e33abe3b670c69ce2ae5b0c62806300dafbed5242fea08edcea068514ed390c4bce5f39da1bdb85641556f115fce7ffcdb39d6e7633fc8c
@@ -1,3 +1,13 @@
1
+ ## 0.3.10 (April 8, 2014)
2
+
3
+ * Don't raise on missing native agent path
4
+
5
+ ## 0.3.9 (April 8, 2014)
6
+
7
+ * Avoid finalizing sockets in the child process
8
+ * Fix non-displaying warnings around native agent
9
+ * Remove HTTP path information from title for better grouping
10
+
1
11
  ## 0.3.8 (April 3, 2014)
2
12
 
3
13
  * Update vendored highline to 1.6.21
@@ -53,7 +53,6 @@ bool skylight_high_res_time(uint64_t*);
53
53
  // Rust skylight_trace prototypes
54
54
  bool skylight_trace_new(uint64_t, RustSlice, RustTrace*);
55
55
  bool skylight_trace_free(RustTrace);
56
- bool skylight_trace_load(RustSlice, RustTrace*);
57
56
  bool skylight_trace_name_from_serialized_into_new_buffer(RustSlice, RustString*);
58
57
  bool skylight_trace_get_started_at(RustTrace, uint64_t*);
59
58
  bool skylight_trace_set_name(RustTrace, RustSlice);
@@ -308,16 +308,6 @@ static VALUE trace_new(VALUE self, VALUE started_at, VALUE uuid) {
308
308
  return Data_Wrap_Struct(rb_cTrace, NULL, skylight_trace_free, trace);
309
309
  }
310
310
 
311
- static VALUE trace_load(VALUE self, VALUE protobuf) {
312
- CHECK_TYPE(protobuf, T_STRING);
313
-
314
- RustTrace trace;
315
-
316
- CHECK_FFI(skylight_trace_load(STR2SLICE(protobuf), &trace), "Could not load Trace");
317
-
318
- return Data_Wrap_Struct(rb_cTrace, NULL, skylight_trace_free, trace);
319
- }
320
-
321
311
  static VALUE trace_name_from_serialized(VALUE self, VALUE protobuf) {
322
312
  CHECK_TYPE(protobuf, T_STRING);
323
313
 
@@ -513,7 +503,6 @@ void Init_skylight_native() {
513
503
 
514
504
  rb_cTrace = rb_define_class_under(rb_mSkylight, "Trace", rb_cObject);
515
505
  rb_define_singleton_method(rb_cTrace, "native_new", trace_new, 2);
516
- rb_define_singleton_method(rb_cTrace, "native_load", trace_load, 1);
517
506
  rb_define_singleton_method(rb_cTrace, "native_name_from_serialized", trace_name_from_serialized, 1);
518
507
  rb_define_method(rb_cTrace, "native_get_started_at", trace_get_started_at, 0);
519
508
  rb_define_method(rb_cTrace, "native_get_name", trace_get_name, 0);
@@ -52,12 +52,13 @@ module Skylight
52
52
 
53
53
  def self.warn_skylight_native_missing
54
54
  # TODO: Dumping the error messages this way is pretty hacky
55
- if defined?(Rails) && !Rails.env.development? && !Rails.env.test?
56
- puts "[SKYLIGHT] [#{Skylight::VERSION}] The Skylight native extension for your platform wasn't found. We currently support monitoring in 32- and 64-bit Linux only. If you are on a supported platform, please contact support at support@skylight.io. The missing extension will not affect the functioning of your application."
57
- elsif defined?(Rails)
58
- puts "[SKYLIGHT] [#{Skylight::VERSION}] Running Skylight in #{Rails.env} mode. No data will be reported until you deploy your app."
55
+ is_rails = defined?(Rails)
56
+ env_name = is_rails ? Rails.env : "development"
57
+
58
+ if env_name == "development" || env_name == "test"
59
+ puts "[SKYLIGHT] [#{Skylight::VERSION}] Running Skylight in #{env_name} mode. No data will be reported until you deploy your app."
59
60
  else
60
- puts "[SKYLIGHT] [#{Skylight::VERSION}] Running Skylight in development mode."
61
+ puts "[SKYLIGHT] [#{Skylight::VERSION}] The Skylight native extension for your platform wasn't found. We currently support monitoring in 32- and 64-bit Linux only. If you are on a supported platform, please contact support at support@skylight.io. The missing extension will not affect the functioning of your application."
61
62
  end
62
63
  end
63
64
 
@@ -157,19 +158,21 @@ module Skylight
157
158
  end
158
159
 
159
160
  if Hash === opts
160
- category = opts.delete(:category) || DEFAULT_CATEGORY
161
- title = opts.delete(:title)
162
- desc = opts.delete(:description)
161
+ category = opts[:category] || DEFAULT_CATEGORY
162
+ title = opts[:title]
163
+ desc = opts[:description]
164
+ annotations = opts[:annotations]
163
165
  else
164
- category = DEFAULT_CATEGORY
165
- title = opts.to_s
166
- desc = nil
166
+ category = DEFAULT_CATEGORY
167
+ title = opts.to_s
168
+ desc = nil
169
+ annotations = nil
167
170
  end
168
171
 
169
172
  if block_given?
170
- inst.instrument(category, title, desc) { yield }
173
+ inst.instrument(category, title, desc, annotations) { yield }
171
174
  else
172
- inst.instrument(category, title, desc)
175
+ inst.instrument(category, title, desc, annotations)
173
176
  end
174
177
  end
175
178
 
@@ -1,31 +1,16 @@
1
1
  module Skylight
2
2
  module Formatters
3
3
  module HTTP
4
-
5
4
  def self.build_opts(method, scheme, host, port, path, query)
6
- category = "api.http.#{method.downcase}"
7
- title = "#{method.upcase} #{host || path}"
8
- description = "#{method.upcase} #{build_url(scheme, host, port, path, query)}"
9
-
10
- { category: category, title: title, description: description }
11
- end
12
-
13
- def self.build_url(scheme, host, port, path, query)
14
- url = ''
15
- if scheme
16
- url << "#{scheme}://"
17
- end
18
- if host
19
- url << host
20
- end
21
- if port
22
- url << ":#{port}"
23
- end
24
- url << path
25
- if query
26
- url << "?#{query}"
27
- end
28
- url
5
+ { category: "api.http.#{method.downcase}",
6
+ title: "#{method.upcase} #{host}",
7
+ annotations: {
8
+ method: method.upcase,
9
+ scheme: scheme,
10
+ host: host,
11
+ port: port ? port.to_i : nil,
12
+ path: path,
13
+ query: query }}
29
14
  end
30
15
  end
31
16
  end
@@ -70,10 +70,6 @@ module Skylight
70
70
 
71
71
  class Trace
72
72
  alias serialize native_serialize
73
-
74
- class << self
75
- alias deserialize native_load
76
- end
77
73
  end
78
74
 
79
75
  class Batch
@@ -15,19 +15,19 @@ module Skylight
15
15
  config.skylight.probes = []
16
16
 
17
17
  initializer 'skylight.configure' do |app|
18
- if Skylight.native?
19
- if activate?
20
- load_probes
18
+ if activate?
19
+ load_probes
21
20
 
22
- if config = load_skylight_config(app)
23
- Instrumenter.start!(config)
21
+ if config = load_skylight_config(app)
22
+ if Instrumenter.start!(config)
24
23
  app.middleware.insert 0, Middleware
25
-
26
24
  puts "[SKYLIGHT] [#{Skylight::VERSION}] Skylight agent enabled"
27
25
  end
28
- elsif !Rails.env.test? && Rails.env.development?
29
- puts "[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."
30
26
  end
27
+ elsif Rails.env.development?
28
+ puts "[SKYLIGHT] [#{Skylight::VERSION}] Running Skylight in development mode. No data will be reported until you deploy your app."
29
+ elsif !Rails.env.test?
30
+ puts "[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."
31
31
  end
32
32
  end
33
33
 
@@ -1,4 +1,4 @@
1
1
  module Skylight
2
- VERSION = '0.3.8'
2
+ VERSION = '0.3.10'
3
3
  end
4
4
 
@@ -15,15 +15,19 @@ module Skylight
15
15
 
16
16
  # Locates skylight_native so that it can be included in the standalone agent startup command
17
17
  def self.locate_skylight_native
18
- $LOADED_FEATURES.each do |feature|
18
+ $LOADED_FEATURES.find do |feature|
19
19
  return feature if feature =~ /skylight_native\.#{RbConfig::CONFIG['DLEXT']}/
20
20
  end
21
21
  end
22
22
 
23
23
  def self.build_subprocess_cmd
24
+ # Native extension location
25
+ native_path = locate_skylight_native
26
+ native_dir = native_path ? File.dirname(native_path) : nil
27
+
24
28
  paths = [
25
29
  File.expand_path('../../..', __FILE__), # Ruby code root
26
- File.dirname(locate_skylight_native) # Native extension location
30
+ native_dir
27
31
  ].uniq.compact
28
32
 
29
33
  ret = [ RUBYBIN ]
@@ -296,12 +300,20 @@ module Skylight
296
300
  # Spawn the worker process.
297
301
  def spawn_worker(f)
298
302
  pid = fork do
299
- Process.setsid
300
- exit if fork
303
+ # Note: By default, Ruby will finalize C objects inside the fork. Because those C objects
304
+ # are shared with the parent, this can cause database connections to disconnect in the
305
+ # parent process. We need to double-fork for proper semantics, so we disable the GC and
306
+ # exit! to avoid finalizing shared handles.
307
+ #
308
+ # We should continue to look for alternate solutions, and to determine whether there is
309
+ # still a possible race between the fork and the GC disabling.
310
+ ::GC.disable
311
+ ::Process.setsid
312
+ exit! if fork
301
313
 
302
314
  # Acquire exclusive file lock, exit otherwise
303
315
  unless f.flock(File::LOCK_EX | File::LOCK_NB)
304
- exit 1
316
+ exit! 1
305
317
  end
306
318
 
307
319
  f.truncate(0)
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.3.8
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tilde, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-04 00:00:00.000000000 Z
11
+ date: 2014-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport