lib/new_relic/agent/instrumentation/memcache/dalli.rb in newrelic_rpm-3.17.1.326 vs lib/new_relic/agent/instrumentation/memcache/dalli.rb in newrelic_rpm-3.17.2.327

- old
+ new

@@ -13,10 +13,11 @@ METHODS = [:get, :set, :add, :incr, :decr, :delete, :replace, :append, :prepend, :cas] SEND_MULTIGET_METRIC_NAME = "get_multi_request".freeze DATASTORE_INSTANCES_SUPPORTED_VERSION = ::NewRelic::VersionNumber.new '2.6.4' SLASH = '/'.freeze UNKNOWN = 'unknown'.freeze + LOCALHOST = 'localhost'.freeze def supports_datastore_instances? DATASTORE_INSTANCES_SUPPORTED_VERSION <= ::Dalli::VERSION end @@ -93,20 +94,21 @@ __send__ visibility, method_name_without end end def assign_instance_to segment, server + host = port_path_or_id = nil if server.hostname.start_with? SLASH - segment.host = ::NewRelic::Agent::Hostname.get - segment.port_path_or_id = server.hostname + host = LOCALHOST + port_path_or_id = server.hostname else - segment.host = ::NewRelic::Agent::Hostname.get_external server.hostname - segment.port_path_or_id = server.port + host = server.hostname + port_path_or_id = server.port end + segment.set_instance_info host, port_path_or_id rescue => e ::NewRelic::Agent.logger.debug "Failed to retrieve memcached instance info: #{e.message}" - segment.host = UNKNOWN - segment.port_path_or_id = UNKNOWN + segment.set_instance_info UNKNOWN, UNKNOWN end end end end