skylight 0.5.0.beta1 → 0.5.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: c7eb484b9fcd3852564008f81d9cdbc1da4ddf11
4
- data.tar.gz: 37c8da551cbe8d0b460bfcf8346defe265e5a665
3
+ metadata.gz: e78118dc565426a957d8f55afe082e19b6b342c6
4
+ data.tar.gz: 6486c1af0cc556a30bcc9763df080dcdcc465f94
5
5
  SHA512:
6
- metadata.gz: 8aa90d031fe9903413d71cd4dbb1097fa9566595eadfa288326dd629d98313bd8096547fed9681e49aed8fdbe03b38b1d59621aa8b1f61411e819affebbecafb
7
- data.tar.gz: 89722c481983864f6e1fbfec52885fa3d10a63587ed324f77356f7276c0b6c63f5da63f5862e79c7a496cf42899588bfefbddfb8cc4fe0b87da94a84fd337c3b
6
+ metadata.gz: 70fd431199b0b0b55afa2fad0d0009ac94b0b77458022ac4fd8904b0281ece7353f87c4f2bbbb315a5c7c5330cf240950c6f20491953419b78cfccc3307c9a9c
7
+ data.tar.gz: b518630c1a7adc80873a0b4d415a4312006a51f947ee767e5bd81d1e9232a2cda4e3b7081e0133e830ffd9bbda3ac33cda83515850f4a3250518d8e3b3501832
@@ -1,4 +1,6 @@
1
- ## 0.5.0 (unreleased)
1
+ ## 0.5.0 (December 4, 2014)
2
+ * [IMPROVEMENT] Automatically load configuration from ENV
3
+ * [BUGFIX] Fix Moped integration
2
4
  * [FEATURE] Track object allocations per span
3
5
  * [BUGFIX] Fix exit status in 1.9.2
4
6
  * [IMPROVEMENT] Fix C warnings
@@ -171,10 +171,13 @@ module Skylight
171
171
  end
172
172
  end
173
173
 
174
- def self.load(path = nil, environment = nil, env = ENV)
174
+ def self.load(opts = {}, env = ENV)
175
175
  attrs = {}
176
176
  version = nil
177
177
 
178
+ path = opts.delete(:file)
179
+ environment = opts.delete(:environment)
180
+
178
181
  if path
179
182
  error = nil
180
183
  begin
@@ -194,11 +197,13 @@ module Skylight
194
197
  attrs[:priority] = remap_env(env)
195
198
  end
196
199
 
197
- new(environment, attrs)
198
- end
200
+ config = new(environment, attrs)
201
+
202
+ opts.each do |k, v|
203
+ config[k] = v
204
+ end
199
205
 
200
- def self.load_from_env(env = ENV)
201
- self.load(nil, nil, env)
206
+ config
202
207
  end
203
208
 
204
209
  def self.remap_key(key)
@@ -32,16 +32,13 @@ module Skylight
32
32
  def self.start!(config = nil)
33
33
  return @instance if @instance
34
34
 
35
- # Initialize here so we can catch errors
36
- config ||= Config.new
37
-
38
35
  LOCK.synchronize do
39
36
  return @instance if @instance
40
37
  @instance = new(config).start!
41
38
  end
42
39
  rescue => e
43
40
  message = sprintf("[SKYLIGHT] [#{Skylight::VERSION}] Unable to start Instrumenter; msg=%s; class=%s", e.message, e.class)
44
- if config
41
+ if config && config.respond_to?(:logger)
45
42
  config.logger.warn message
46
43
  else
47
44
  warn message
@@ -72,16 +69,11 @@ module Skylight
72
69
  end
73
70
  end
74
71
 
75
-
76
72
  attr_reader :config, :gc, :trace_info
77
73
 
78
74
  def self.new(config)
79
- if config.nil?
80
- raise ArgumentError, "config is required"
81
- elsif Hash === config
82
- config = Config.new(config)
83
- end
84
-
75
+ config ||= {}
76
+ config = Config.load(config) unless config.is_a?(Config)
85
77
  config.validate!
86
78
 
87
79
  inst = native_new(config.to_env)
@@ -117,18 +117,18 @@ module Skylight
117
117
  end
118
118
 
119
119
  def extract_binds(hash, binds=[])
120
- hash = hash.dup
120
+ ret = {}
121
121
 
122
122
  hash.each do |k,v|
123
123
  if v.is_a?(Hash)
124
- hash[k] = extract_binds(v, binds)[0]
124
+ ret[k] = extract_binds(v, binds)[0]
125
125
  else
126
126
  binds << stringify(hash[k])
127
- hash[k] = '?'
127
+ ret[k] = '?'
128
128
  end
129
129
  end
130
130
 
131
- [hash, binds]
131
+ [ret, binds]
132
132
  end
133
133
 
134
134
  def stringify(value)
@@ -65,7 +65,7 @@ module Skylight
65
65
  return nil
66
66
  end
67
67
 
68
- config = Config.load(path, Rails.env.to_s, ENV)
68
+ config = Config.load(file: path, environment: Rails.env.to_s)
69
69
  config['root'] = Rails.root
70
70
 
71
71
  configure_logging(config, app)
@@ -1,4 +1,4 @@
1
1
  module Skylight
2
- VERSION = '0.5.0-beta1'
2
+ VERSION = '0.5.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.5.0.beta1
4
+ version: 0.5.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: 2014-11-17 00:00:00.000000000 Z
11
+ date: 2014-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -162,9 +162,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
162
  version: 1.9.2
163
163
  required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  requirements:
165
- - - ">"
165
+ - - ">="
166
166
  - !ruby/object:Gem::Version
167
- version: 1.3.1
167
+ version: '0'
168
168
  requirements: []
169
169
  rubyforge_project:
170
170
  rubygems_version: 2.2.2