# File lib/new_relic/agent/instrumentation/active_record_helper.rb, line 249
          def port_path_or_id(config)
            return UNKNOWN unless config

            adapter = PRODUCT_SYMBOLS[config[:adapter]]
            if config[:socket]
              config[:socket].empty? ? UNKNOWN : config[:socket]
            elsif postgres_unix_domain_socket_case?(config[:host], adapter) || mysql_default_case?(config, adapter)
              DEFAULT
            elsif config[:port].nil?
              DATASTORE_DEFAULT_PORTS[adapter] || DEFAULT
            elsif config[:port].is_a?(Integer) || config[:port].to_i != 0
              config[:port].to_s
            else
              UNKNOWN
            end

          rescue => e
            NewRelic::Agent.logger.debug "Failed to retrieve ActiveRecord port_path_or_id: #{e}"
            UNKNOWN
          end