newrelic_rpm 6.0.0.351 → 6.1.0.352
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/lib/new_relic/agent.rb +5 -1
- data/lib/new_relic/agent/agent.rb +4 -2
- data/lib/new_relic/agent/configuration/default_source.rb +7 -0
- data/lib/new_relic/agent/configuration/server_source.rb +2 -1
- data/lib/new_relic/agent/distributed_trace_payload.rb +7 -11
- data/lib/new_relic/agent/hostname.rb +8 -0
- data/lib/new_relic/agent/instrumentation/bunny.rb +15 -11
- data/lib/new_relic/agent/instrumentation/curb.rb +18 -5
- data/lib/new_relic/agent/new_relic_service.rb +69 -25
- data/lib/new_relic/agent/new_relic_service/marshaller.rb +5 -26
- data/lib/new_relic/agent/system_info.rb +5 -0
- data/lib/new_relic/agent/utilization_data.rb +36 -1
- data/lib/new_relic/version.rb +1 -1
- data/newrelic_rpm.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73929ba01fea0db2f54b9977a41dfc7b710d51f38b9d07a8f0d96e8525a8574a
|
4
|
+
data.tar.gz: cb28508e22221fe2c0869a247ee9796ea9a07f595ca51679eee9fd5b75027d1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e8c015d61f300f5460a8c2a4e38d8baf74917529d4f17bc8218114e2a71b6b8cb9cdc520b68e301f2a6733b8026f6bf4815709374ba6c7de6fc60ec622d9775
|
7
|
+
data.tar.gz: d61094c98597fe88fb0d947b9ab6ea68f450e89dc592ab29116a000f06ca2acea7958a7d130619eecad1e94b908fd201e811cd6a27e5936db65876dcaaa489cf
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# New Relic Ruby Agent Release Notes #
|
2
2
|
|
3
|
+
## v6.1.0
|
4
|
+
|
5
|
+
* Performance monitoring on Kubernetes
|
6
|
+
|
7
|
+
This release adds Transaction event attributes that provide
|
8
|
+
context between your Kubernetes cluster and services. For details
|
9
|
+
on the benefits, see this [blog
|
10
|
+
post](https://blog.newrelic.com/engineering/monitoring-application-performance-in-kubernetes/).
|
11
|
+
|
12
|
+
* Bugfix for Bunny instrumentation when popping empty queues
|
13
|
+
|
14
|
+
When a customer calls `Bunny::Queue#pop` on an empty queue, Bunny
|
15
|
+
returns a `nil` value. Previous Ruby Agent versions raised a
|
16
|
+
`NoMethodError` when trying to process this result. Now, the
|
17
|
+
agent correctly skips processing for `nil` values. Thanks to
|
18
|
+
Matt Campbell for the contribution.
|
19
|
+
|
3
20
|
## v6.0.0
|
4
21
|
|
5
22
|
* Tracer API for flexible custom instrumentation
|
data/lib/new_relic/agent.rb
CHANGED
@@ -76,7 +76,11 @@ module NewRelic
|
|
76
76
|
class ForceDisconnectException < StandardError; end
|
77
77
|
|
78
78
|
# An exception that forces an agent to restart.
|
79
|
-
class ForceRestartException < StandardError
|
79
|
+
class ForceRestartException < StandardError
|
80
|
+
def message
|
81
|
+
"#{super}, restarting."
|
82
|
+
end
|
83
|
+
end
|
80
84
|
|
81
85
|
# Used to blow out of a periodic task without logging a an error, such as for routine
|
82
86
|
# failures.
|
@@ -624,7 +624,7 @@ module NewRelic
|
|
624
624
|
# is the worker thread that gathers data and talks to the
|
625
625
|
# server.
|
626
626
|
def handle_force_disconnect(error)
|
627
|
-
::NewRelic::Agent.logger.warn "
|
627
|
+
::NewRelic::Agent.logger.warn "Agent received a ForceDisconnectException from the server, disconnecting. (#{error.message})"
|
628
628
|
disconnect
|
629
629
|
end
|
630
630
|
|
@@ -632,7 +632,7 @@ module NewRelic
|
|
632
632
|
# it and disconnecting the agent, since we are now in an
|
633
633
|
# unknown state.
|
634
634
|
def handle_other_error(error)
|
635
|
-
::NewRelic::Agent.logger.error "Unhandled error in worker thread, disconnecting
|
635
|
+
::NewRelic::Agent.logger.error "Unhandled error in worker thread, disconnecting."
|
636
636
|
# These errors are fatal (that is, they will prevent the agent from
|
637
637
|
# reporting entirely), so we really want backtraces when they happen
|
638
638
|
::NewRelic::Agent.logger.log_exception(:error, error)
|
@@ -1119,6 +1119,8 @@ module NewRelic
|
|
1119
1119
|
@agent_command_router.check_for_and_handle_agent_commands
|
1120
1120
|
rescue ForceRestartException, ForceDisconnectException
|
1121
1121
|
raise
|
1122
|
+
rescue UnrecoverableServerException => e
|
1123
|
+
NewRelic::Agent.logger.warn("get_agent_commands message was rejected by remote service, discarding. Error: ", e)
|
1122
1124
|
rescue ServerConnectionException => e
|
1123
1125
|
log_remote_unavailable(:get_agent_commands, e)
|
1124
1126
|
rescue => e
|
@@ -1694,6 +1694,13 @@ module NewRelic
|
|
1694
1694
|
:allowed_from_server => false,
|
1695
1695
|
:description => 'If <code>true</code>, the agent automatically detects that it is running in Docker.'
|
1696
1696
|
},
|
1697
|
+
:'utilization.detect_kubernetes' => {
|
1698
|
+
:default => true,
|
1699
|
+
:public => true,
|
1700
|
+
:type => Boolean,
|
1701
|
+
:allowed_from_server => false,
|
1702
|
+
:description => 'If <code>true</code>, the agent automatically detects that it is running in Kubernetes.'
|
1703
|
+
},
|
1697
1704
|
:'utilization.billing_hostname' => {
|
1698
1705
|
:default => nil,
|
1699
1706
|
:allow_nil => true,
|
@@ -103,7 +103,8 @@ module NewRelic
|
|
103
103
|
'error_collector.enabled' => 'collect_errors',
|
104
104
|
'analytics_events.enabled' => 'collect_analytics_events',
|
105
105
|
'custom_insights_events.enabled' => 'collect_custom_events',
|
106
|
-
'error_collector.capture_events' => 'collect_error_events'
|
106
|
+
'error_collector.capture_events' => 'collect_error_events',
|
107
|
+
'span_events.enabled' => 'collect_span_events'
|
107
108
|
}
|
108
109
|
gated_features.each do |config_key, gate_key|
|
109
110
|
if connect_reply.has_key?(gate_key)
|
@@ -168,7 +168,12 @@ module NewRelic
|
|
168
168
|
@caller_transport_type = PARENT_TRANSPORT_TYPE_UNKNOWN
|
169
169
|
end
|
170
170
|
|
171
|
-
|
171
|
+
# Represent this payload as a raw JSON string.
|
172
|
+
#
|
173
|
+
# @return [String] Payload translated to JSON
|
174
|
+
#
|
175
|
+
# @api public
|
176
|
+
def text
|
172
177
|
result = {
|
173
178
|
VERSION_KEY => version
|
174
179
|
}
|
@@ -198,16 +203,7 @@ module NewRelic
|
|
198
203
|
#
|
199
204
|
# @api public
|
200
205
|
def http_safe
|
201
|
-
Base64.strict_encode64
|
202
|
-
end
|
203
|
-
|
204
|
-
# Represent this payload as a raw JSON string.
|
205
|
-
#
|
206
|
-
# @return [String] Payload translated to JSON
|
207
|
-
#
|
208
|
-
# @api public
|
209
|
-
def text
|
210
|
-
to_json
|
206
|
+
Base64.strict_encode64 text
|
211
207
|
end
|
212
208
|
|
213
209
|
def assign_intrinsics transaction, transaction_payload
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# This file is distributed under New Relic's license terms.
|
3
3
|
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
|
4
|
+
require 'socket'
|
4
5
|
|
5
6
|
module NewRelic
|
6
7
|
module Agent
|
@@ -16,6 +17,13 @@ module NewRelic
|
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
20
|
+
def self.get_fqdn
|
21
|
+
%x[hostname -f].chomp!
|
22
|
+
rescue => e
|
23
|
+
NewRelic::Agent.logger.debug "Unable to determine fqdn #{e}"
|
24
|
+
nil
|
25
|
+
end
|
26
|
+
|
19
27
|
def self.heroku_dyno_name_prefix(dyno_name)
|
20
28
|
get_dyno_prefixes.find do |dyno_prefix|
|
21
29
|
dyno_name.start_with?(dyno_prefix + ".")
|
@@ -57,19 +57,23 @@ DependencyDetection.defer do
|
|
57
57
|
def pop(opts = {:manual_ack => false}, &block)
|
58
58
|
t0 = Time.now
|
59
59
|
msg = pop_without_new_relic opts, &block
|
60
|
+
delivery_info, message_properties, _payload = msg
|
60
61
|
|
61
62
|
begin
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
63
|
+
if delivery_info
|
64
|
+
exchange_name = NewRelic::Agent::Instrumentation::Bunny.exchange_name(delivery_info.exchange)
|
65
|
+
exchange_type = NewRelic::Agent::Instrumentation::Bunny.exchange_type(delivery_info, channel)
|
66
|
+
|
67
|
+
segment = NewRelic::Agent::Messaging.start_amqp_consume_segment(
|
68
|
+
library: NewRelic::Agent::Instrumentation::Bunny::LIBRARY,
|
69
|
+
destination_name: exchange_name,
|
70
|
+
delivery_info: delivery_info,
|
71
|
+
message_properties: message_properties,
|
72
|
+
exchange_type: exchange_type,
|
73
|
+
queue_name: name,
|
74
|
+
start_time: t0
|
75
|
+
)
|
76
|
+
end
|
73
77
|
|
74
78
|
rescue => e
|
75
79
|
NewRelic::Agent.logger.error "Error starting message broker segment in Bunny::Queue#pop", e
|
@@ -112,13 +112,9 @@ DependencyDetection.defer do
|
|
112
112
|
alias_method :add_without_newrelic, :add
|
113
113
|
alias_method :add, :add_with_newrelic
|
114
114
|
|
115
|
-
|
116
115
|
# Trace as an External/Multiple call if the first request isn't serial.
|
117
116
|
def perform_with_newrelic(&blk)
|
118
|
-
return perform_without_newrelic if
|
119
|
-
self.requests.first &&
|
120
|
-
self.requests.first.respond_to?(:_nr_serial) &&
|
121
|
-
self.requests.first._nr_serial
|
117
|
+
return perform_without_newrelic if first_request_is_serial?
|
122
118
|
|
123
119
|
trace_execution_scoped("External/Multiple/Curb::Multi/perform") do
|
124
120
|
perform_without_newrelic(&blk)
|
@@ -198,6 +194,23 @@ DependencyDetection.defer do
|
|
198
194
|
request._nr_instrumented = false
|
199
195
|
end
|
200
196
|
|
197
|
+
private
|
198
|
+
|
199
|
+
def first_request_is_serial?
|
200
|
+
return false unless (first = self.requests.first)
|
201
|
+
|
202
|
+
# Before curb 0.9.8, requests was an array of Curl::Easy
|
203
|
+
# instances. Starting with 0.9.8, it's a Hash where the
|
204
|
+
# values are Curl::Easy instances.
|
205
|
+
#
|
206
|
+
# So, requests.first will either be an_obj or [a_key, an_obj].
|
207
|
+
# We need to handle either case.
|
208
|
+
#
|
209
|
+
first = first[-1] if first.is_a?(Array)
|
210
|
+
|
211
|
+
first.respond_to?(:_nr_serial) && first._nr_serial
|
212
|
+
end
|
213
|
+
|
201
214
|
end # class Curl::Multi
|
202
215
|
|
203
216
|
end
|
@@ -16,7 +16,7 @@ module NewRelic
|
|
16
16
|
# Specifies the version of the agent's communication protocol with
|
17
17
|
# the NewRelic hosted site.
|
18
18
|
|
19
|
-
PROTOCOL_VERSION =
|
19
|
+
PROTOCOL_VERSION = 17
|
20
20
|
|
21
21
|
# 1f147a42: v10 (tag 3.5.3.17)
|
22
22
|
# cf0d1ff1: v9 (tag 3.5.0)
|
@@ -43,6 +43,7 @@ module NewRelic
|
|
43
43
|
@in_session = nil
|
44
44
|
@agent_id = nil
|
45
45
|
@shared_tcp_connection = nil
|
46
|
+
@request_headers_map = nil
|
46
47
|
reset_remote_method_uris
|
47
48
|
|
48
49
|
@audit_logger = ::NewRelic::Agent::AuditLogger.new
|
@@ -69,6 +70,7 @@ module NewRelic
|
|
69
70
|
end
|
70
71
|
|
71
72
|
def connect(settings={})
|
73
|
+
@request_headers_map = nil
|
72
74
|
security_policies = nil
|
73
75
|
if response = preconnect
|
74
76
|
if host = response['redirect_host']
|
@@ -80,6 +82,7 @@ module NewRelic
|
|
80
82
|
end
|
81
83
|
end
|
82
84
|
response = invoke_remote(:connect, [settings])
|
85
|
+
@request_headers_map = response['request_headers_map']
|
83
86
|
self.agent_id = response['agent_run_id']
|
84
87
|
response.merge!(security_policies) if security_policies
|
85
88
|
response
|
@@ -404,7 +407,7 @@ module NewRelic
|
|
404
407
|
def invoke_remote(method, payload = [], options = {})
|
405
408
|
start_ts = Time.now
|
406
409
|
|
407
|
-
data, size, serialize_finish_ts = nil
|
410
|
+
data, size, serialize_finish_ts, request_send_ts, response_check_ts = nil
|
408
411
|
begin
|
409
412
|
data = @marshaller.dump(payload, options)
|
410
413
|
rescue StandardError, SystemStackError => e
|
@@ -419,13 +422,16 @@ module NewRelic
|
|
419
422
|
full_uri = "#{@collector}#{uri}"
|
420
423
|
|
421
424
|
@audit_logger.log_request(full_uri, payload, @marshaller)
|
425
|
+
request_send_ts = Time.now
|
422
426
|
response = send_request(:data => data,
|
423
427
|
:uri => uri,
|
424
428
|
:encoding => encoding,
|
425
|
-
:collector => @collector
|
429
|
+
:collector => @collector,
|
430
|
+
:endpoint => method)
|
431
|
+
response_check_ts = Time.now
|
426
432
|
@marshaller.load(decompress_response(response))
|
427
433
|
ensure
|
428
|
-
record_timing_supportability_metrics(method, start_ts, serialize_finish_ts)
|
434
|
+
record_timing_supportability_metrics(method, start_ts, serialize_finish_ts, request_send_ts, response_check_ts)
|
429
435
|
if size
|
430
436
|
record_size_supportability_metrics(method, size, options[:item_count])
|
431
437
|
end
|
@@ -440,11 +446,12 @@ module NewRelic
|
|
440
446
|
raise error
|
441
447
|
end
|
442
448
|
|
443
|
-
def record_timing_supportability_metrics(method, start_ts, serialize_finish_ts)
|
449
|
+
def record_timing_supportability_metrics(method, start_ts, serialize_finish_ts, request_send_ts, response_check_ts)
|
444
450
|
serialize_time = serialize_finish_ts && (serialize_finish_ts - start_ts)
|
445
|
-
|
446
|
-
|
447
|
-
|
451
|
+
request_duration = response_check_ts && (response_check_ts - request_send_ts).to_f
|
452
|
+
if request_duration
|
453
|
+
NewRelic::Agent.record_metric("Supportability/Agent/Collector/#{method.to_s}/Duration", request_duration)
|
454
|
+
end
|
448
455
|
if serialize_time
|
449
456
|
NewRelic::Agent.record_metric("Supportability/invoke_remote_serialize", serialize_time)
|
450
457
|
NewRelic::Agent.record_metric("Supportability/invoke_remote_serialize/#{method.to_s}", serialize_time)
|
@@ -489,10 +496,16 @@ module NewRelic
|
|
489
496
|
# contact
|
490
497
|
# - :data => the data to send as the body of the request
|
491
498
|
def send_request(opts)
|
499
|
+
headers = {
|
500
|
+
'Content-Encoding' => opts[:encoding],
|
501
|
+
'Host' => opts[:collector].name
|
502
|
+
}
|
503
|
+
headers.merge!(@request_headers_map) if @request_headers_map
|
504
|
+
|
492
505
|
if Agent.config[:put_for_data_send]
|
493
|
-
request = Net::HTTP::Put.new(opts[:uri],
|
506
|
+
request = Net::HTTP::Put.new(opts[:uri], headers)
|
494
507
|
else
|
495
|
-
request = Net::HTTP::Post.new(opts[:uri],
|
508
|
+
request = Net::HTTP::Post.new(opts[:uri], headers)
|
496
509
|
end
|
497
510
|
request['user-agent'] = user_agent
|
498
511
|
request.content_type = "application/octet-stream"
|
@@ -501,6 +514,7 @@ module NewRelic
|
|
501
514
|
response = nil
|
502
515
|
attempts = 0
|
503
516
|
max_attempts = 2
|
517
|
+
endpoint = opts[:endpoint]
|
504
518
|
|
505
519
|
begin
|
506
520
|
attempts += 1
|
@@ -522,20 +536,43 @@ module NewRelic
|
|
522
536
|
log_response(response)
|
523
537
|
|
524
538
|
case response
|
525
|
-
when Net::HTTPSuccess
|
539
|
+
when Net::HTTPSuccess,
|
540
|
+
Net::HTTPAccepted
|
526
541
|
true # do nothing
|
527
|
-
when Net::
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
raise ServerConnectionException, "
|
533
|
-
when Net::
|
534
|
-
|
535
|
-
|
536
|
-
|
542
|
+
when Net::HTTPRequestTimeOut,
|
543
|
+
Net::HTTPTooManyRequests,
|
544
|
+
Net::HTTPInternalServerError,
|
545
|
+
Net::HTTPServiceUnavailable
|
546
|
+
record_endpoint_attempts_supportability_metrics(endpoint)
|
547
|
+
raise ServerConnectionException, "#{response.code}: #{response.message}"
|
548
|
+
when Net::HTTPBadRequest,
|
549
|
+
Net::HTTPForbidden,
|
550
|
+
Net::HTTPNotFound,
|
551
|
+
Net::HTTPMethodNotAllowed,
|
552
|
+
Net::HTTPProxyAuthenticationRequired,
|
553
|
+
Net::HTTPLengthRequired,
|
554
|
+
Net::HTTPRequestEntityTooLarge,
|
555
|
+
Net::HTTPRequestURITooLong,
|
556
|
+
Net::HTTPUnsupportedMediaType,
|
557
|
+
Net::HTTPExpectationFailed,
|
558
|
+
Net::HTTPUnsupportedMediaType,
|
559
|
+
Net::HTTPRequestHeaderFieldsTooLarge
|
560
|
+
record_endpoint_attempts_supportability_metrics(endpoint)
|
561
|
+
record_error_response_supportability_metrics(response.code)
|
562
|
+
raise UnrecoverableServerException, "#{response.code}: #{response.message}"
|
563
|
+
when Net::HTTPConflict,
|
564
|
+
Net::HTTPUnauthorized
|
565
|
+
record_endpoint_attempts_supportability_metrics(endpoint)
|
566
|
+
record_error_response_supportability_metrics(response.code)
|
567
|
+
raise ForceRestartException, "#{response.code}: #{response.message}"
|
568
|
+
when Net::HTTPGone
|
569
|
+
record_endpoint_attempts_supportability_metrics(endpoint)
|
570
|
+
record_error_response_supportability_metrics(response.code)
|
571
|
+
raise ForceDisconnectException, "#{response.code}: #{response.message}"
|
537
572
|
else
|
538
|
-
|
573
|
+
record_endpoint_attempts_supportability_metrics(endpoint)
|
574
|
+
record_error_response_supportability_metrics(response.code)
|
575
|
+
raise UnrecoverableServerException, "#{response.code}: #{response.message}"
|
539
576
|
end
|
540
577
|
response
|
541
578
|
end
|
@@ -544,6 +581,16 @@ module NewRelic
|
|
544
581
|
::NewRelic::Agent.logger.debug "Received response, status: #{response.code}, encoding: '#{response['content-encoding']}'"
|
545
582
|
end
|
546
583
|
|
584
|
+
# Per protocol 17, this metric should be recorded for all error response codes
|
585
|
+
# that cause data to be discarded.
|
586
|
+
def record_error_response_supportability_metrics(response_code)
|
587
|
+
::NewRelic::Agent.increment_metric("Supportability/Agent/Collector/HTTPError/#{response_code}")
|
588
|
+
end
|
589
|
+
|
590
|
+
def record_endpoint_attempts_supportability_metrics(endpoint)
|
591
|
+
::NewRelic::Agent.increment_metric("Supportability/Agent/Collector/#{endpoint}/Attempts")
|
592
|
+
end
|
593
|
+
|
547
594
|
# Decompresses the response from the server, if it is gzip
|
548
595
|
# encoded, otherwise returns it verbatim
|
549
596
|
def decompress_response(response)
|
@@ -566,9 +613,6 @@ module NewRelic
|
|
566
613
|
zlib_version << "zlib/#{Zlib.zlib_version}" if defined?(::Zlib) && Zlib.respond_to?(:zlib_version)
|
567
614
|
"NewRelic-RubyAgent/#{NewRelic::VERSION::STRING} #{ruby_description}#{zlib_version}"
|
568
615
|
end
|
569
|
-
|
570
|
-
# Used to wrap errors reported to agent by the collector
|
571
|
-
class CollectorError < StandardError; end
|
572
616
|
end
|
573
617
|
end
|
574
618
|
end
|
@@ -6,24 +6,6 @@ module NewRelic
|
|
6
6
|
module Agent
|
7
7
|
class NewRelicService
|
8
8
|
class Marshaller
|
9
|
-
def parsed_error(error)
|
10
|
-
error_type = error['error_type']
|
11
|
-
error_message = error['message']
|
12
|
-
|
13
|
-
exception = case error_type
|
14
|
-
when 'NewRelic::Agent::LicenseException'
|
15
|
-
LicenseException.new(error_message)
|
16
|
-
when 'NewRelic::Agent::ForceRestartException'
|
17
|
-
ForceRestartException.new(error_message)
|
18
|
-
when 'NewRelic::Agent::ForceDisconnectException'
|
19
|
-
ForceDisconnectException.new(error_message)
|
20
|
-
else
|
21
|
-
CollectorError.new("#{error['error_type']}: #{error['message']}")
|
22
|
-
end
|
23
|
-
|
24
|
-
exception
|
25
|
-
end
|
26
|
-
|
27
9
|
def prepare(data, options={})
|
28
10
|
encoder = options[:encoder] || default_encoder
|
29
11
|
if data.respond_to?(:to_collector_array)
|
@@ -46,15 +28,12 @@ module NewRelic
|
|
46
28
|
protected
|
47
29
|
|
48
30
|
def return_value(data)
|
49
|
-
if data.respond_to?(:has_key?)
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
end
|
31
|
+
if data.respond_to?(:has_key?) && data.has_key?('return_value')
|
32
|
+
data['return_value']
|
33
|
+
else
|
34
|
+
::NewRelic::Agent.logger.debug("Unexpected response from collector: #{data}")
|
35
|
+
nil
|
55
36
|
end
|
56
|
-
::NewRelic::Agent.logger.debug("Unexpected response from collector: #{data}")
|
57
|
-
nil
|
58
37
|
end
|
59
38
|
end
|
60
39
|
end
|
@@ -8,6 +8,7 @@
|
|
8
8
|
# the requested information is unavailable.
|
9
9
|
|
10
10
|
require 'rbconfig'
|
11
|
+
require 'socket'
|
11
12
|
|
12
13
|
module NewRelic
|
13
14
|
module Agent
|
@@ -30,6 +31,10 @@ module NewRelic
|
|
30
31
|
|
31
32
|
@processor_info = nil
|
32
33
|
|
34
|
+
def self.ip_addresses
|
35
|
+
Socket.ip_address_list.map(&:ip_address)
|
36
|
+
end
|
37
|
+
|
33
38
|
def self.clear_processor_info
|
34
39
|
@processor_info = nil
|
35
40
|
end
|
@@ -7,10 +7,11 @@ require 'new_relic/agent/utilization/gcp'
|
|
7
7
|
require 'new_relic/agent/utilization/azure'
|
8
8
|
require 'new_relic/agent/utilization/pcf'
|
9
9
|
|
10
|
+
|
10
11
|
module NewRelic
|
11
12
|
module Agent
|
12
13
|
class UtilizationData
|
13
|
-
METADATA_VERSION =
|
14
|
+
METADATA_VERSION = 5
|
14
15
|
|
15
16
|
VENDORS = {
|
16
17
|
Utilization::AWS => :'utilization.detect_aws',
|
@@ -23,6 +24,14 @@ module NewRelic
|
|
23
24
|
NewRelic::Agent::Hostname.get
|
24
25
|
end
|
25
26
|
|
27
|
+
def fqdn
|
28
|
+
NewRelic::Agent::Hostname.get_fqdn
|
29
|
+
end
|
30
|
+
|
31
|
+
def ip_addresses
|
32
|
+
::NewRelic::Agent::SystemInfo.ip_addresses
|
33
|
+
end
|
34
|
+
|
26
35
|
def container_id
|
27
36
|
::NewRelic::Agent::SystemInfo.docker_container_id
|
28
37
|
end
|
@@ -69,6 +78,9 @@ module NewRelic
|
|
69
78
|
append_docker_info(result)
|
70
79
|
append_configured_values(result)
|
71
80
|
append_boot_id(result)
|
81
|
+
append_ip_address(result)
|
82
|
+
append_full_hostname(result)
|
83
|
+
append_kubernetes_info(result)
|
72
84
|
|
73
85
|
result
|
74
86
|
end
|
@@ -105,6 +117,29 @@ module NewRelic
|
|
105
117
|
end
|
106
118
|
end
|
107
119
|
|
120
|
+
def append_ip_address(collector_hash)
|
121
|
+
ips = ip_addresses
|
122
|
+
collector_hash[:ip_address] = ips unless ips.empty?
|
123
|
+
end
|
124
|
+
|
125
|
+
KUBERNETES_SERVICE_HOST = 'KUBERNETES_SERVICE_HOST'.freeze
|
126
|
+
|
127
|
+
def append_kubernetes_info(collector_hash)
|
128
|
+
return unless Agent.config[:'utilization.detect_kubernetes']
|
129
|
+
if host = ENV[KUBERNETES_SERVICE_HOST]
|
130
|
+
collector_hash[:vendors] ||= {}
|
131
|
+
collector_hash[:vendors][:kubernetes] = {
|
132
|
+
kubernetes_service_host: host
|
133
|
+
}
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def append_full_hostname(collector_hash)
|
138
|
+
full_hostname = fqdn
|
139
|
+
return if full_hostname.nil? || full_hostname.empty?
|
140
|
+
collector_hash[:full_hostname] = full_hostname
|
141
|
+
end
|
142
|
+
|
108
143
|
def config_hash
|
109
144
|
config_hash = {}
|
110
145
|
|
data/lib/new_relic/version.rb
CHANGED
data/newrelic_rpm.gemspec
CHANGED
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: 6.
|
4
|
+
version: 6.1.0.352
|
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: 2019-
|
14
|
+
date: 2019-02-21 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|
@@ -143,16 +143,16 @@ dependencies:
|
|
143
143
|
name: sqlite3
|
144
144
|
requirement: !ruby/object:Gem::Requirement
|
145
145
|
requirements:
|
146
|
-
- - "
|
146
|
+
- - "~>"
|
147
147
|
- !ruby/object:Gem::Version
|
148
|
-
version:
|
148
|
+
version: 1.3.13
|
149
149
|
type: :development
|
150
150
|
prerelease: false
|
151
151
|
version_requirements: !ruby/object:Gem::Requirement
|
152
152
|
requirements:
|
153
|
-
- - "
|
153
|
+
- - "~>"
|
154
154
|
- !ruby/object:Gem::Version
|
155
|
-
version:
|
155
|
+
version: 1.3.13
|
156
156
|
description: |
|
157
157
|
New Relic is a performance management system, developed by New Relic,
|
158
158
|
Inc (http://www.newrelic.com). New Relic provides you with deep
|