oneapm_rpm 1.2.5 → 1.2.6.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/one_apm/agent/agent/connect.rb +1 -1
- data/lib/one_apm/configuration/default_source.rb +601 -456
- data/lib/one_apm/configuration/yaml_source.rb +22 -1
- data/lib/one_apm/configuration.rb +15 -1
- data/lib/one_apm/support/local_environment.rb +3 -4
- data/lib/one_apm/version.rb +3 -2
- metadata +2 -2
@@ -18,9 +18,14 @@ module OneApm
|
|
18
18
|
return unless @file_path
|
19
19
|
|
20
20
|
OneApm::Manager.logger.info("Reading configuration from #{path} (#{Dir.pwd})")
|
21
|
-
raw_file =
|
21
|
+
raw_file = if RUBY_VERSION >= '1.9.3'
|
22
|
+
File.read(@file_path, :encoding => 'utf-8')
|
23
|
+
else
|
24
|
+
File.read(@file_path)
|
25
|
+
end
|
22
26
|
erb_file = process_erb(raw_file)
|
23
27
|
config = process_yaml(erb_file, env, config, @file_path)
|
28
|
+
add_notified!(config)
|
24
29
|
rescue ScriptError, StandardError => e
|
25
30
|
OneApm::Manager.logger.error("Failed to read or parse configuration file at #{path}", e)
|
26
31
|
end
|
@@ -97,6 +102,22 @@ module OneApm
|
|
97
102
|
config
|
98
103
|
end
|
99
104
|
|
105
|
+
#add notified to key of config
|
106
|
+
#before: {'a' => 1, 'b' => {'c' => 2}}
|
107
|
+
#after: {'a' => 1, 'a.notified' => true, 'b' => {'c' => 1, 'c.notified' => true}}
|
108
|
+
def add_notified! config
|
109
|
+
config.keys.each do |key|
|
110
|
+
if config[key].respond_to?(:has_key?)
|
111
|
+
config[key].keys.each do |inner_key|
|
112
|
+
config[key]["#{inner_key}.notified"] = true unless config[key].has_key?("#{inner_key}.notified")
|
113
|
+
end
|
114
|
+
next
|
115
|
+
end
|
116
|
+
config["#{key}.notified"] = true unless config.has_key?("#{key}.notified")
|
117
|
+
end
|
118
|
+
config
|
119
|
+
end
|
120
|
+
|
100
121
|
def substitute_transaction_threshold(config)
|
101
122
|
if config['transaction_tracer'] &&
|
102
123
|
config['transaction_tracer']['transaction_threshold'] =~ /apdex_f/i
|
@@ -256,6 +256,16 @@ module OneApm
|
|
256
256
|
end
|
257
257
|
end
|
258
258
|
|
259
|
+
def to_notified_hash
|
260
|
+
@notified_hash = {}
|
261
|
+
to_collector_hash.each{|k, v| @notified_hash[k]= v.to_s}
|
262
|
+
return @notified_hash unless OneApm::Manager.config[:'notified.enable']
|
263
|
+
@notified_hash.select do |k, v|
|
264
|
+
default = DEFAULTS[k]
|
265
|
+
OneApm::Manager.config[:"#{k}.notified"] || (default && default.fetch(:notified, false))
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
259
269
|
def app_names
|
260
270
|
case OneApm::Manager.config[:app_name]
|
261
271
|
when Array then OneApm::Manager.config[:app_name]
|
@@ -359,8 +369,12 @@ module OneApm
|
|
359
369
|
grouped_by_type.values.map(&:last)
|
360
370
|
end
|
361
371
|
|
372
|
+
#parse hash of labels
|
373
|
+
#delete key eql 'labels.xxx.notified'
|
362
374
|
def parse_labels_from_dictionary
|
363
|
-
|
375
|
+
labels = OneApm::Manager.config[:labels]
|
376
|
+
labels.delete_if{|k, v| k.include?(".notified")}
|
377
|
+
make_label_hash(labels)
|
364
378
|
end
|
365
379
|
|
366
380
|
# Generally only useful during initial construction and tests
|
@@ -38,7 +38,6 @@ module OneApm
|
|
38
38
|
mod = OneApm::LocalEnvironment.const_get const
|
39
39
|
self.extend mod if mod.instance_of? Module
|
40
40
|
end
|
41
|
-
|
42
41
|
discover_dispatcher
|
43
42
|
end
|
44
43
|
|
@@ -133,13 +132,13 @@ module OneApm
|
|
133
132
|
end
|
134
133
|
|
135
134
|
def check_for_puma
|
136
|
-
if defined?(::Puma) &&
|
135
|
+
if defined?(::Puma) && executable =~ /puma/
|
137
136
|
@discovered_dispatcher = :puma
|
138
137
|
end
|
139
138
|
end
|
140
139
|
|
141
140
|
def check_for_delayed_job
|
142
|
-
if $0 =~ /delayed_job$/ || (
|
141
|
+
if $0 =~ /delayed_job$/ || (executable == 'rake' && ARGV.include?('jobs:work'))
|
143
142
|
@discovered_dispatcher = :delayed_job
|
144
143
|
end
|
145
144
|
end
|
@@ -158,7 +157,7 @@ module OneApm
|
|
158
157
|
end
|
159
158
|
|
160
159
|
def check_for_sidekiq
|
161
|
-
if defined?(::Sidekiq) &&
|
160
|
+
if defined?(::Sidekiq) && executable == 'sidekiq'
|
162
161
|
@discovered_dispatcher = :sidekiq
|
163
162
|
end
|
164
163
|
end
|
data/lib/one_apm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oneapm_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.6.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- oneapm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|