skylight 0.4.0 → 0.4.1

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: f41a143e4cf033132f7bc8eb4dc0b9a11c362b90
4
- data.tar.gz: 8aa8c73c68d6e05289efed9773f38f8b9e63befd
3
+ metadata.gz: 766b35710e2c5cc91f17df574ceb6ae2d99c476a
4
+ data.tar.gz: 9145a148d2b08e8d4c74e283d57cb922664d72b2
5
5
  SHA512:
6
- metadata.gz: 1f54a122a8affaf55194c093792eadaa34d02cc5b850c5297845f80fdae9645581413463b159852cbaacdd88fc38d6da75a5d4f881f7266d44131d4e430d0a7d
7
- data.tar.gz: 5d42410b700fd20f4dc17c9b728ce37b2635df0482794f7eb6b3f6cc76c205429df32e3225608e28d56eb80d7320ba5a3016815312ef89d7afacf7d1127ab2d3
6
+ metadata.gz: 29c0ae3e1fea0b3e180fdbf6a1db5e9818783f4ea46241101afa0e8d601c9dee6100f7432e89b03f0c6318f981227f160da197f2a17108683919301f95a295c0
7
+ data.tar.gz: fb823dc8938a5db2292a9ab10aedb2269f00bb180605a55dee8844d12dfbda4f7b722e5b79f1e8d53e34eca641875433efd669f03eb5a6b4bf95749ccd6ac49d
@@ -1,3 +1,14 @@
1
+ ## 0.4.1 (November 7, 2014)
2
+
3
+ * [BUGFIX] Fix downloading native agent on 32bit systems
4
+ * [BUGFIX] Support legacy config settings
5
+ * [FEATURE] Check FS permissions on instrumenter start
6
+
7
+ ## 0.4.0 (November 3, 2014)
8
+
9
+ * Featherweight Agent: lowered CPU and memory overhead
10
+ * [IMPROVEMENT] Add support for ignoring an endpoint by name
11
+
1
12
  ## 0.3.20 (September 3, 2014)
2
13
 
3
14
  * [BUGFIX] Fix app name fetching on Windows for `skylight setup`
@@ -70,15 +70,26 @@ repository and deploy from there. You can learn more about the process at:
70
70
  begin
71
71
  namefile = Tempfile.new('skylight-app-name')
72
72
  # Windows appears to need double quotes for `rails runner`
73
- `rails runner "File.open('#{namefile.path}', 'w') {|f| f.write(Rails.application.class.name) }"`
73
+ `rails runner "File.open('#{namefile.path}', 'w') {|f| f.write(Rails.application.class.name) rescue '' }"`
74
74
  name = namefile.read.split("::").first.underscore.titleize
75
+ name = nil if name.empty?
76
+ rescue => e
77
+ if ENV['DEBUG']
78
+ puts e.class.name
79
+ puts e.to_s
80
+ puts e.backtrace.join("\n")
81
+ end
75
82
  ensure
76
83
  namefile.close
77
84
  namefile.unlink
78
85
  end
86
+
87
+ unless name
88
+ warn "Unable to determine Rails application name. Using directory name."
89
+ end
79
90
  end
80
91
 
81
- if !name || name.strip.empty?
92
+ unless name
82
93
  name = File.basename(File.expand_path('.')).titleize
83
94
  end
84
95
 
@@ -71,12 +71,11 @@ module Skylight
71
71
  "SSL_CERT_PATH" => :'daemon.ssl_cert_path',
72
72
  "SSL_CERT_DIR" => :'daemon.ssl_cert_dir',
73
73
 
74
- # == Legacy settings ==
74
+ # == Legacy env vars ==
75
75
  #
76
- 'AGENT_MAX_MEMORY' => :'agent.max_memory',
77
- 'ME_AUTHENTICATION' => :'me.authentication',
78
- 'ME_CREDENTIALS_PATH' => :'me.credentials_path',
79
- 'TEST_IGNORE_TOKEN' => :'test.ignore_token' }
76
+ 'AGENT_LOCKFILE' => :'agent.lockfile',
77
+ 'AGENT_SOCKFILE_PATH' => :'agent.sockfile_path',
78
+ }
80
79
 
81
80
  # Default values for Skylight configuration keys
82
81
  DEFAULTS = {
@@ -130,6 +129,12 @@ module Skylight
130
129
  :'daemon.ssl_cert_dir',
131
130
  :'daemon.ssl_cert_path' ]
132
131
 
132
+ # Maps legacy config keys to new config keys
133
+ LEGACY = {
134
+ :'agent.sockfile_path' => :'daemon.sockdir_path',
135
+ :'agent.pidfile_path' => :'agent.lockfile',
136
+ }
137
+
133
138
  VALIDATORS = {
134
139
  :'agent.interval' => [lambda { |v, c| Integer === v && v > 0 }, "must be an integer greater than 0"]
135
140
  }
@@ -161,7 +166,7 @@ module Skylight
161
166
 
162
167
  if p
163
168
  p.each do |k, v|
164
- @priority[k.to_sym] = v
169
+ @priority[Config.remap_key(k)] = v
165
170
  end
166
171
  end
167
172
  end
@@ -196,6 +201,11 @@ module Skylight
196
201
  self.load(nil, nil, env)
197
202
  end
198
203
 
204
+ def self.remap_key(key)
205
+ key = key.to_sym
206
+ LEGACY[key] || key
207
+ end
208
+
199
209
  # @api private
200
210
  def self.remap_env(env)
201
211
  ret = {}
@@ -246,16 +256,42 @@ module Skylight
246
256
  end
247
257
  end
248
258
 
259
+ sockdir_path = self[:'daemon.sockdir_path'] || File.expand_path('.')
260
+ pidfile_path = self[:'daemon.pidfile_path'] || File.expand_path('skylight.pid', sockdir_path)
261
+
262
+ check_permissions(pidfile_path, sockdir_path)
263
+
249
264
  true
250
265
  end
251
266
 
267
+ def check_permissions(pidfile, sockdir_path)
268
+ pidfile_root = File.dirname(pidfile)
269
+
270
+ FileUtils.mkdir_p pidfile_root
271
+ FileUtils.mkdir_p sockdir_path
272
+
273
+ if File.exist?(pidfile)
274
+ if !FileTest.writable?(pidfile)
275
+ raise "`#{pidfile}` not writable. Please set daemon.pidfile_path or daemon.sockdir_path in your config to a writable path."
276
+ end
277
+ else
278
+ if !FileTest.writable?(pidfile_root)
279
+ raise "`#{pidfile_root}` not writable. Please set daemon.pidfile_path or daemon.sockdir_path in your config to a writable path."
280
+ end
281
+ end
282
+
283
+ unless FileTest.writable?(sockdir_path)
284
+ raise "`#{sockdir_path}` not writable. Please set daemon.sockdir_path in your config to a writable path."
285
+ end
286
+ end
287
+
252
288
  def key?(key)
253
- key = key.to_sym
289
+ key = Config.remap_key(key)
254
290
  @priority.key?(key) || @values.key?(key)
255
291
  end
256
292
 
257
293
  def get(key, default = nil, &blk)
258
- key = key.to_sym
294
+ key = Config.remap_key(key)
259
295
 
260
296
  return @priority[key] if @priority.key?(key)
261
297
  return @values[key] if @values.key?(key)
@@ -282,7 +318,7 @@ module Skylight
282
318
  set(k, v, key)
283
319
  end
284
320
  else
285
- k = key.to_sym
321
+ k = Config.remap_key(key)
286
322
 
287
323
  if validator = VALIDATORS[k]
288
324
  blk, msg = validator
@@ -294,7 +330,7 @@ module Skylight
294
330
  end
295
331
  end
296
332
 
297
- if @regexp && key =~ @regexp
333
+ if @regexp && k =~ @regexp
298
334
  @priority[$1.to_sym] = val
299
335
  end
300
336
 
@@ -326,6 +362,7 @@ module Skylight
326
362
  ret = []
327
363
 
328
364
  ENV_TO_KEY.each do |k, v|
365
+ next if LEGACY[v]
329
366
  c = get(v)
330
367
  # Always need to pass daemon lib_path config even when default
331
368
  if c != DEFAULTS[v] || ALWAYS_INCLUDE_IN_ENV.include?(v)
@@ -29,7 +29,7 @@ module Skylight
29
29
  when /amd64|x86_64/
30
30
  "x86_64"
31
31
  when /i?86|x86|i86pc/
32
- "i386"
32
+ "x86"
33
33
  when /ppc|powerpc/
34
34
  "powerpc"
35
35
  when /^arm/
@@ -1,4 +1,4 @@
1
1
  module Skylight
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
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.4.0
4
+ version: 0.4.1
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-11-04 00:00:00.000000000 Z
11
+ date: 2014-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport