newrelic_rpm 4.3.0.335 → 4.4.0.336
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/CHANGELOG.md +41 -0
- data/lib/new_relic/agent/agent.rb +5 -3
- data/lib/new_relic/agent/configuration/default_source.rb +32 -0
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +3 -2
- data/lib/new_relic/agent/system_info.rb +34 -0
- data/lib/new_relic/agent/utilization/aws.rb +18 -0
- data/lib/new_relic/agent/utilization/azure.rb +17 -0
- data/lib/new_relic/agent/utilization/gcp.rb +35 -0
- data/lib/new_relic/agent/utilization/pcf.rb +32 -0
- data/lib/new_relic/agent/utilization/vendor.rb +144 -0
- data/lib/new_relic/agent/utilization_data.rb +29 -10
- data/lib/new_relic/version.rb +1 -1
- data/newrelic_rpm.gemspec +1 -1
- data/test/agent_helper.rb +697 -0
- metadata +8 -3
- data/lib/new_relic/agent/aws_info.rb +0 -90
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.4.0.336
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Wear
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2017-
|
14
|
+
date: 2017-08-14 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|
@@ -173,7 +173,6 @@ files:
|
|
173
173
|
- lib/new_relic/agent/attribute_processing.rb
|
174
174
|
- lib/new_relic/agent/audit_logger.rb
|
175
175
|
- lib/new_relic/agent/autostart.rb
|
176
|
-
- lib/new_relic/agent/aws_info.rb
|
177
176
|
- lib/new_relic/agent/busy_calculator.rb
|
178
177
|
- lib/new_relic/agent/chained_call.rb
|
179
178
|
- lib/new_relic/agent/commands/agent_command.rb
|
@@ -353,6 +352,11 @@ files:
|
|
353
352
|
- lib/new_relic/agent/transaction_sampler.rb
|
354
353
|
- lib/new_relic/agent/transaction_state.rb
|
355
354
|
- lib/new_relic/agent/transaction_timings.rb
|
355
|
+
- lib/new_relic/agent/utilization/aws.rb
|
356
|
+
- lib/new_relic/agent/utilization/azure.rb
|
357
|
+
- lib/new_relic/agent/utilization/gcp.rb
|
358
|
+
- lib/new_relic/agent/utilization/pcf.rb
|
359
|
+
- lib/new_relic/agent/utilization/vendor.rb
|
356
360
|
- lib/new_relic/agent/utilization_data.rb
|
357
361
|
- lib/new_relic/agent/vm.rb
|
358
362
|
- lib/new_relic/agent/vm/jruby_vm.rb
|
@@ -419,6 +423,7 @@ files:
|
|
419
423
|
- newrelic.yml
|
420
424
|
- newrelic_rpm.gemspec
|
421
425
|
- recipes/newrelic.rb
|
426
|
+
- test/agent_helper.rb
|
422
427
|
homepage: https://github.com/newrelic/rpm
|
423
428
|
licenses:
|
424
429
|
- New Relic
|
@@ -1,90 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# This file is distributed under New Relic's license terms.
|
3
|
-
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
|
-
|
5
|
-
module NewRelic
|
6
|
-
module Agent
|
7
|
-
class AWSInfo
|
8
|
-
|
9
|
-
class ResponseError < StandardError; end
|
10
|
-
|
11
|
-
attr_reader :instance_type, :instance_id, :availability_zone
|
12
|
-
|
13
|
-
def initialize
|
14
|
-
handle_remote_calls do
|
15
|
-
@instance_type = remote_fetch('instance-type')
|
16
|
-
@instance_id = remote_fetch('instance-id')
|
17
|
-
@availability_zone = remote_fetch('placement/availability-zone')
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def loaded?
|
22
|
-
instance_type && instance_id && availability_zone
|
23
|
-
end
|
24
|
-
|
25
|
-
def to_collector_hash
|
26
|
-
{
|
27
|
-
:id => instance_id,
|
28
|
-
:type => instance_type,
|
29
|
-
:zone => availability_zone
|
30
|
-
}
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def reset
|
36
|
-
@instance_type = @instance_id = @availability_zone = nil
|
37
|
-
end
|
38
|
-
|
39
|
-
REMOTE_DATA_VALID_CHARS = /^[0-9a-zA-Z_ .\/-]$/.freeze
|
40
|
-
INSTANCE_HOST = '169.254.169.254'
|
41
|
-
API_VERSION = '2008-02-01'
|
42
|
-
|
43
|
-
def remote_fetch(remote_key)
|
44
|
-
uri = URI("http://#{INSTANCE_HOST}/#{API_VERSION}/meta-data/#{remote_key}")
|
45
|
-
response = Net::HTTP::get(uri)
|
46
|
-
|
47
|
-
data = filter_remote_data(response)
|
48
|
-
|
49
|
-
unless data
|
50
|
-
NewRelic::Agent.increment_metric('Supportability/utilization/aws/error')
|
51
|
-
raise ResponseError, "Fetching instance metadata for #{remote_key.inspect} returned invalid data: #{response.inspect}"
|
52
|
-
end
|
53
|
-
|
54
|
-
data
|
55
|
-
end
|
56
|
-
|
57
|
-
def handle_remote_calls
|
58
|
-
begin
|
59
|
-
Timeout::timeout(1) do
|
60
|
-
yield
|
61
|
-
end
|
62
|
-
rescue Timeout::Error
|
63
|
-
handle_error "UtilizationData timed out fetching remote keys."
|
64
|
-
rescue StandardError => e
|
65
|
-
handle_error "UtilizationData encountered error fetching remote keys: #{e.message}"
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def handle_error(*messages)
|
70
|
-
NewRelic::Agent.logger.debug(*messages)
|
71
|
-
reset
|
72
|
-
end
|
73
|
-
|
74
|
-
def filter_remote_data(data_str)
|
75
|
-
return nil unless data_str.kind_of?(String)
|
76
|
-
return nil unless data_str.bytesize <= 255
|
77
|
-
|
78
|
-
data_str.each_char do |ch|
|
79
|
-
next if ch =~ REMOTE_DATA_VALID_CHARS
|
80
|
-
code_point = ch[0].ord # this works in Ruby 1.8.7 - 2.1.2
|
81
|
-
next if code_point >= 0x80
|
82
|
-
|
83
|
-
return nil # it's in neither set of valid characters
|
84
|
-
end
|
85
|
-
|
86
|
-
data_str
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|