Skip to content

Commit

Permalink
Merge pull request #1860 from ruby-agent/dev
Browse files Browse the repository at this point in the history
Merge dev to release for 6.1 release
  • Loading branch information
rklein authored and GitHub Enterprise committed Mar 12, 2019
2 parents 10d7844 + d2cc4ea commit aa87291
Show file tree
Hide file tree
Showing 24 changed files with 143 additions and 172 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ lib/new_relic/build.rb
.bundle
.yardoc
artifacts/
test/performance/log/
test/performance/script/log/
120 changes: 23 additions & 97 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ sudo: required

before_install:
# RUBY-2072 Prevent Travis setup failure before our test even starts
- jdk_switcher use oraclejdk8
- sudo rm -f /etc/apt/sources.list.d/travis_ci_zeromq3.list
- gem --version
- ./test/script/before_install/update_rubygems.sh
- gem uninstall bundler -a -x
- rvm @global do gem uninstall bundler --all --executables || true
- gem install bundler -v=1.17.3
- ./test/script/before_install/gemstash_mirror.sh
- bundle _1.17.3_ --version
- bundle --version

install: bundle _1.17.3_ install
install: bundle install

addons:
apt:
Expand Down Expand Up @@ -46,9 +47,9 @@ notifications:

rvm:
# Run slowest builds first to try and optimize overall cycle time.
- jruby-9.1.13.0
- 2.6.0
- 2.5.0
- jruby-9.2.6.0
- 2.6.1
- 2.5.3
- 2.4.2
- 2.3.5
- 2.2.8
Expand All @@ -66,11 +67,6 @@ env:
- TESTOPTS="-v"
- VERBOSE = 1
matrix:
# RUBY-1668 rails21, rails22, and rails23 are all excluded below
- TYPE=UNIT ENVIRONMENT=rails21
- TYPE=UNIT ENVIRONMENT=rails22
- TYPE=UNIT ENVIRONMENT=rails23

- TYPE=UNIT ENVIRONMENT=rails30
- TYPE=UNIT ENVIRONMENT=rails31
- TYPE=UNIT ENVIRONMENT=rails32
Expand All @@ -97,48 +93,30 @@ matrix:
exclude:
# Unsupported Rails/Ruby combinations
# 2.6
- rvm: 2.6.0
env: TYPE=UNIT ENVIRONMENT=rails21
- rvm: 2.6.0
env: TYPE=UNIT ENVIRONMENT=rails22
- rvm: 2.6.0
env: TYPE=UNIT ENVIRONMENT=rails23
- rvm: 2.6.0
- rvm: 2.6.1
env: TYPE=UNIT ENVIRONMENT=rails30
- rvm: 2.6.0
- rvm: 2.6.1
env: TYPE=UNIT ENVIRONMENT=rails31
- rvm: 2.6.0
- rvm: 2.6.1
env: TYPE=UNIT ENVIRONMENT=rails32
- rvm: 2.6.0
- rvm: 2.6.1
env: TYPE=UNIT ENVIRONMENT=rails40
- rvm: 2.6.0
- rvm: 2.6.1
env: TYPE=UNIT ENVIRONMENT=rails41

# 2.5
- rvm: 2.5.0
env: TYPE=UNIT ENVIRONMENT=rails21
- rvm: 2.5.0
env: TYPE=UNIT ENVIRONMENT=rails22
- rvm: 2.5.0
env: TYPE=UNIT ENVIRONMENT=rails23
- rvm: 2.5.0
- rvm: 2.5.3
env: TYPE=UNIT ENVIRONMENT=rails30
- rvm: 2.5.0
- rvm: 2.5.3
env: TYPE=UNIT ENVIRONMENT=rails31
- rvm: 2.5.0
- rvm: 2.5.3
env: TYPE=UNIT ENVIRONMENT=rails32
- rvm: 2.5.0
- rvm: 2.5.3
env: TYPE=UNIT ENVIRONMENT=rails40
- rvm: 2.5.0
- rvm: 2.5.3
env: TYPE=UNIT ENVIRONMENT=rails41

# 2.4
- rvm: 2.4.2
env: TYPE=UNIT ENVIRONMENT=rails21
- rvm: 2.4.2
env: TYPE=UNIT ENVIRONMENT=rails22
- rvm: 2.4.2
env: TYPE=UNIT ENVIRONMENT=rails23
- rvm: 2.4.2
env: TYPE=UNIT ENVIRONMENT=rails30
- rvm: 2.4.2
Expand All @@ -150,78 +128,26 @@ matrix:
- rvm: 2.4.2
env: TYPE=UNIT ENVIRONMENT=rails41

# 2.3
- rvm: 2.3.5
env: TYPE=UNIT ENVIRONMENT=rails21
- rvm: 2.3.5
env: TYPE=UNIT ENVIRONMENT=rails22
- rvm: 2.3.5
env: TYPE=UNIT ENVIRONMENT=rails23

# 2.2
- rvm: 2.2.8
env: TYPE=UNIT ENVIRONMENT=rails21
- rvm: 2.2.8
env: TYPE=UNIT ENVIRONMENT=rails22
- rvm: 2.2.8
env: TYPE=UNIT ENVIRONMENT=rails23

# 2.1
- rvm: 2.1.10
env: TYPE=UNIT ENVIRONMENT=rails21
- rvm: 2.1.10
env: TYPE=UNIT ENVIRONMENT=rails22
- rvm: 2.1.10
env: TYPE=UNIT ENVIRONMENT=rails23
- rvm: 2.1.10
env: TYPE=UNIT ENVIRONMENT=rails50
- rvm: 2.1.10
env: TYPE=UNIT ENVIRONMENT=rails51

# 2.0
- rvm: 2.0.0-p648
env: TYPE=UNIT ENVIRONMENT=rails21
- rvm: 2.0.0-p648
env: TYPE=UNIT ENVIRONMENT=rails22
- rvm: 2.0.0-p648
env: TYPE=UNIT ENVIRONMENT=rails23
- rvm: 2.0.0-p648
env: TYPE=UNIT ENVIRONMENT=rails50
- rvm: 2.0.0-p648
env: TYPE=UNIT ENVIRONMENT=rails51

# jruby 9.0
- rvm: jruby-9.1.13.0
env: TYPE=UNIT ENVIRONMENT=rails21
- rvm: jruby-9.1.13.0
env: TYPE=UNIT ENVIRONMENT=rails22
- rvm: jruby-9.1.13.0
env: TYPE=UNIT ENVIRONMENT=rails23
- rvm: jruby-9.1.13.0
# jruby 9.2.6.0 (Compatible with MRI 2.5)
- rvm: jruby-9.2.6.0
env: TYPE=UNIT ENVIRONMENT=rails30
- rvm: jruby-9.1.13.0
- rvm: jruby-9.2.6.0
env: TYPE=UNIT ENVIRONMENT=rails31
- rvm: jruby-9.1.13.0
- rvm: jruby-9.2.6.0
env: TYPE=UNIT ENVIRONMENT=rails32

# Travis (and only Travis) has been throwing difficult-to-reproduce
# errors in various JRuby tests. These appeared after a build image
# update, and they seem to be unrelated to any agent code changes.
# So, we'll allow these specific test runs to fail while we track
# the issue (RUBY-1869).
#
allow_failures:
- rvm: jruby-9.1.13.0
- rvm: jruby-9.2.6.0
env: TYPE=UNIT ENVIRONMENT=rails40
- rvm: jruby-9.1.13.0
- rvm: jruby-9.2.6.0
env: TYPE=UNIT ENVIRONMENT=rails41
- rvm: jruby-9.1.13.0
env: TYPE=UNIT ENVIRONMENT=rails42
- rvm: jruby-9.1.13.0
env: TYPE=UNIT ENVIRONMENT=rails50
- rvm: jruby-9.1.13.0
env: TYPE=UNIT ENVIRONMENT=rails51
- rvm: jruby-9.1.13.0
env: TYPE=UNIT ENVIRONMENT=norails
- rvm: jruby-9.1.13.0
env: TYPE=FUNCTIONAL GROUP=background_2
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# New Relic Ruby Agent Release Notes #

## v6.2.0

* Bugfix for superfluous `Empty JSON response` error messages

Version 6.1.0 of the agent frequently logged error messages about an empty
JSON response, when no error had occurred. These logs no longer appear.

* Bugfix for `Unable to calculate elapsed transaction time` warning messages

Ruby Agent versions 5.4 through 6.1, when running in jruby without
ObjectSpace enabled, would occasionally log a warning indicating that the
agent was unable to calculate the elapsed transaction time. When this log
statement appeared, the affected transactions would not be included in the
data displayed on the capacity analysis page. These transactions are now
correctly recorded.

## v6.1.0

* Performance monitoring on Kubernetes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def define_cachedp_method
# we don't expect this to be called more than once, but we're being
# defensive.
return if defined?(cached?)
if ::ActiveRecord::VERSION::STRING >= "5.1.0"
if defined?(::ActiveRecord) && ::ActiveRecord::VERSION::STRING >= "5.1.0"
def cached?(payload)
payload.fetch(:cached, false)
end
Expand Down
1 change: 0 additions & 1 deletion lib/new_relic/agent/new_relic_service/json_marshaller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def dump(ruby, opts={})

def load(data)
if data.nil? || data.empty?
::NewRelic::Agent.logger.error "Empty JSON response from collector: '#{data.inspect}'"
return nil
end

Expand Down
23 changes: 19 additions & 4 deletions lib/new_relic/agent/transaction_time_aggregator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

require 'objspace'

# This module powers the Busy calculation for the Capacity report in
# APM (https://rpm.newrelic.com/accounts/.../applications/.../optimize/capacity_analysis).
#
Expand Down Expand Up @@ -102,12 +100,27 @@ def current_thread
end

def thread_is_alive?(thread_id)
thread = ObjectSpace._id2ref(thread_id)
thread = thread_by_id thread_id
thread && thread.alive?
rescue StandardError
false
end

# ObjectSpace is faster on MRI, but disabled by default on JRuby for
# perfomance reasons. We have two implmentations of `thread_by_id`
# based on ruby implementation.
if RUBY_ENGINE == 'jruby'
def thread_by_id thread_id
Thread.list.detect { |t| t.object_id == thread_id }
end
else
require 'objspace'

def thread_by_id thread_id
ObjectSpace._id2ref(thread_id)
end
end

def set_transaction_start_time(timestamp, thread_id = current_thread)
@stats[thread_id].transaction_started_at = timestamp
end
Expand All @@ -131,7 +144,9 @@ def transaction_time_in_thread timestamp, thread_id, entry
end

def log_missing_elapsed_transaction_time
transaction_name = Tracer.current_transaction.best_name
transaction_name = Tracer.current_transaction &&
Tracer.current_transaction.best_name ||
"unknown"
NewRelic::Agent.logger.warn("Unable to calculate elapsed transaction time for #{transaction_name}")
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/new_relic/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def self.build_version_string(*parts)
end

MAJOR = 6
MINOR = 1
MINOR = 2
TINY = 0

begin
Expand Down
11 changes: 2 additions & 9 deletions newrelic_rpm.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Gem::Specification.new do |s|
s.version = NewRelic::VERSION::STRING
s.required_ruby_version = '>= 2.0.0'
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
s.authors = [ "Matthew Wear", "Chris Pine", "Erin Dees", "Rachel Klein" ]
s.authors = [ "Matthew Wear", "Chris Pine", "Rachel Klein", "Justin Foote" ]
s.date = Time.now.strftime('%Y-%m-%d')
s.licenses = ['New Relic']
s.description = <<-EOS
Expand Down Expand Up @@ -45,15 +45,8 @@ EOS
s.add_development_dependency 'minitest', '~> 4.7.5'
s.add_development_dependency 'mocha', '~> 0.13.0'
s.add_development_dependency 'yard'
s.add_development_dependency 'rails', '~> 3.2.13'
s.add_development_dependency 'json', '>= 2.0.2' if RUBY_VERSION >= '2.4.0' # possible bundler issue?
s.add_development_dependency 'pry-nav', '~> 0.2.4'
s.add_development_dependency 'pry-stack_explorer', '~> 0.4.9'
s.add_development_dependency 'hometown', '~> 0.2.5'

if RUBY_PLATFORM == 'java'
s.add_development_dependency 'activerecord-jdbcsqlite3-adapter'
else
s.add_development_dependency 'sqlite3', '~> 1.3.13'
end
s.add_development_dependency 'bundler', '< 2.0'
end
9 changes: 4 additions & 5 deletions test/environments/lib/environments/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ class Runner
"2.2" => ["rails50"],
"2.1" => ["rails50"],
"2.0" => ["rails50"],
"2" => ["rails21", "rails22", "rails23"],
"jruby-9.0" => ["rails21", "rails22", "rails23", "rails30", "rails31", "rails32"]
"jruby-9.0" => ["rails30", "rails31", "rails32"]
}

attr_reader :envs
Expand Down Expand Up @@ -86,10 +85,10 @@ def potential_directories

def bundle(dir)
puts "Bundling in #{dir}..."
result = `cd #{dir} && bundle _1.17.3_ install --local`
result = `cd #{dir} && bundle install --local`
unless $?.success?
puts "Failed local bundle, trying again with full bundle..."
command = "cd #{dir} && bundle _1.17.3_ install --retry 3"
command = "cd #{dir} && bundle install --retry 3"
result = Multiverse::ShellUtils.try_command_n_times(command, 3)
end

Expand All @@ -100,7 +99,7 @@ def bundle(dir)

def run(dir)
puts "Starting tests..."
IO.popen("cd #{dir} && bundle _1.17.3_ exec rake") do |io|
IO.popen("cd #{dir} && bundle exec rake") do |io|
until io.eof do
print io.read(1)
end
Expand Down
2 changes: 1 addition & 1 deletion test/multiverse/lib/multiverse/suite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def exclusive_bundle
puts "Waiting on '#{bundling_lock_file}' for our chance to bundle" if verbose?
f.flock(File::LOCK_EX)
puts "Let's get ready to BUNDLE!" if verbose?
bundler_out = ShellUtils.try_command_n_times 'bundle _1.17.3_ install --retry 3', 3
bundler_out = ShellUtils.try_command_n_times 'bundle install --retry 3', 3
end
bundler_out
end
Expand Down
25 changes: 25 additions & 0 deletions test/multiverse/suites/active_record/Envfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,31 @@ boilerplate_gems = <<-BOILERPLATE
gem 'rack'
BOILERPLATE

if RUBY_VERSION >= '2.2.2' && RUBY_PLATFORM == 'java'
mysql_vsn = '~>0.4.4'

gemfile <<-RB
gem 'activerecord', '~> 5.2.0'
gem 'minitest', '~> 5.2.3'
gem 'activerecord-jdbcmysql-adapter', '~>52.0'
#{boilerplate_gems}
RB

gemfile <<-RB
gem 'activerecord', '~> 5.1.6'
gem 'minitest', '~> 5.2.3'
gem 'activerecord-jdbcmysql-adapter', '~>51.0'
#{boilerplate_gems}
RB

gemfile <<-RB
gem 'activerecord', '~> 5.0.0'
gem 'minitest', '~> 5.2.3'
gem 'activerecord-jdbcmysql-adapter', '~>50.0'
#{boilerplate_gems}
RB
end

if RUBY_VERSION >= '2.2.2' && RUBY_PLATFORM != 'java'
mysql_vsn = '~>0.4.4'

Expand Down
2 changes: 1 addition & 1 deletion test/multiverse/suites/rack/puma_rack_builder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_puma_rack_builder_is_auto_instrumented
["Middleware/Rack/PumaRackBuilderTest::MiddlewareTwo/call", "Controller/Rack/PumaRackBuilderTest::ExampleApp/call"],
["Nested/Controller/Rack/PumaRackBuilderTest::ExampleApp/call", "Controller/Rack/PumaRackBuilderTest::ExampleApp/call"]
],
:ignore_filter => /^(Supportability|RubyVM|Memory)/
:ignore_filter => /^(Supportability|RubyVM|Memory|CPU)/
)
end
end
Expand Down
Loading

0 comments on commit aa87291

Please sign in to comment.