Skip to content

Commit

Permalink
Merge branch 'dev' into jruby9440
Browse files Browse the repository at this point in the history
  • Loading branch information
fallwith committed Nov 23, 2023
2 parents 238a281 + e4f2bba commit ec4336a
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 30 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Configure git
run: 'git config --global init.defaultBranch main'
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # tag v3.5.0
- uses: ruby/setup-ruby@5311f05890856149502132d25c4a24985a00d426 # tag v1.153.0
- uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # tag v1.161.0
with:
ruby-version: '3.2'
- run: bundle
Expand All @@ -36,7 +36,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: [2.4.10, 2.5.9, 2.6.10, 2.7.8, 3.0.6, 3.1.4, 3.2.2, 3.3.0-preview2]
ruby-version: [2.4.10, 2.5.9, 2.6.10, 2.7.8, 3.0.6, 3.1.4, 3.2.2, 3.3.0-preview3]

steps:
- name: Configure git
Expand All @@ -50,7 +50,7 @@ jobs:
run: sudo apt-get update; sudo apt-get install -y --no-install-recommends libcurl4-nss-dev libsasl2-dev libxslt1-dev

- name: Install Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@5311f05890856149502132d25c4a24985a00d426 # tag v1.153.0
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # tag v1.161.0
with:
ruby-version: ${{ matrix.ruby-version }}

Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
"3.2.2": {
"rails": "norails,rails61,rails70,railsedge"
},
"3.3.0-preview2": {
"3.3.0-preview3": {
"rails": "norails,rails61,rails70,railsedge"
}
}
Expand Down Expand Up @@ -200,7 +200,7 @@ jobs:
fail-fast: false
matrix:
multiverse: [agent, background, background_2, database, frameworks, httpclients, httpclients_2, rails, rest]
ruby-version: [2.4.10, 2.5.9, 2.6.10, 2.7.8, 3.0.6, 3.1.4, 3.2.2, 3.3.0-preview2]
ruby-version: [2.4.10, 2.5.9, 2.6.10, 2.7.8, 3.0.6, 3.1.4, 3.2.2, 3.3.0-preview3]
steps:
- name: Configure git
run: 'git config --global init.defaultBranch main'
Expand All @@ -213,7 +213,7 @@ jobs:
run: sudo apt-get update; sudo apt-get install -y --no-install-recommends libcurl4-nss-dev libsasl2-dev libxslt1-dev

- name: Install Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@5311f05890856149502132d25c4a24985a00d426 # tag v1.153.0
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # tag v1.161.0
with:
ruby-version: ${{ matrix.ruby-version }}

Expand Down Expand Up @@ -278,14 +278,14 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: [2.7.8, 3.0.6, 3.1.4, 3.2.2, 3.3.0-preview2]
ruby-version: [2.7.8, 3.0.6, 3.1.4, 3.2.2, 3.3.0-preview3]
steps:
- name: Configure git
run: 'git config --global init.defaultBranch main'
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # tag v3.5.0

- name: Install Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@5311f05890856149502132d25c4a24985a00d426 # tag v1.153.0
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # tag v1.161.0
with:
ruby-version: ${{ matrix.ruby-version }}

Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Version 9.6.0 adds instrumentation for Async::HTTP, Ethon, and HTTPX, adds the a

We also received some great contributions from community members to resolve some outstanding technical debt issues. Thank you for your contributions!
* Add and Replace SLASH and ROOT constants: [PR#2256](https://github.com/newrelic/newrelic-ruby-agent/pull/2256) [chahmedejaz](https://github.com/chahmedejaz)
* Remove pry as a dev dependency: [PR#2665](https://github.com/newrelic/newrelic-ruby-agent/pull/2265), [PR#2273](https://github.com/newrelic/newrelic-ruby-agent/pull/2273) [AlajeBash](https://github.com/AlajeBash)
* Remove pry as a dev dependency: PR#2665, PR#2273, AlajeBash (profile no longer active)
* Replace "start up" with "start-up": [PR#2249](https://github.com/newrelic/newrelic-ruby-agent/pull/2249) [chahmedejaz](https://github.com/chahmedejaz)
* Remove unused variables in test suites: [PR#2250](https://github.com/newrelic/newrelic-ruby-agent/pull/2250)

Expand Down
4 changes: 2 additions & 2 deletions lib/new_relic/agent/vm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# frozen_string_literal: true

require 'new_relic/language_support'
require 'new_relic/agent/vm/mri_vm'
require 'new_relic/agent/vm/c_ruby_vm'
require 'new_relic/agent/vm/jruby_vm'

module NewRelic
Expand All @@ -21,7 +21,7 @@ def self.create_vm
if NewRelic::LanguageSupport.jruby?
JRubyVM.new
else
MriVM.new
CRubyVM.new
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
module NewRelic
module Agent
module VM
class MriVM
class CRubyVM
def snapshot
snap = Snapshot.new
gather_stats(snap)
Expand All @@ -24,7 +24,7 @@ def gather_stats(snap)

def gather_gc_stats(snap)
gather_gc_runs(snap) if supports?(:gc_runs)
gather_derived_stats(snap) if GC.respond_to?(:stat)
gather_derived_stats(snap)
end

def gather_gc_runs(snap)
Expand All @@ -33,19 +33,11 @@ def gather_gc_runs(snap)

def gather_derived_stats(snap)
stat = GC.stat
snap.total_allocated_object = derive_from_gc_stats(%i[total_allocated_objects total_allocated_object], stat)
snap.major_gc_count = derive_from_gc_stats(:major_gc_count, stat)
snap.minor_gc_count = derive_from_gc_stats(:minor_gc_count, stat)
snap.heap_live = derive_from_gc_stats(%i[heap_live_slots heap_live_slot heap_live_num], stat)
snap.heap_free = derive_from_gc_stats(%i[heap_free_slots heap_free_slot heap_free_num], stat)
end

def derive_from_gc_stats(keys, stat)
Array(keys).each do |key|
value = stat[key]
return value if value
end
nil
snap.total_allocated_object = stat.fetch(:total_allocated_objects, nil)
snap.major_gc_count = stat.fetch(:major_gc_count, nil)
snap.minor_gc_count = stat.fetch(:minor_gc_count, nil)
snap.heap_live = stat.fetch(:heap_live_slots, nil)
snap.heap_free = stat.fetch(:heap_free_slots, nil)
end

def gather_gc_time(snap)
Expand Down
3 changes: 2 additions & 1 deletion test/multiverse/suites/grpc/Envfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ end

instrumentation_methods(:chain, :prepend)

# TODO: permit testing of the nil (latest) version against Ruby 3.3+
GRPC_VERSIONS = [
[nil, 2.6],
[nil, 2.6, 3.2],
['1.48.0', 2.5, 3.1]
]

Expand Down
10 changes: 10 additions & 0 deletions test/multiverse/suites/rails/activejob_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,16 @@ def test_record_perform_metrics_in_web
assert_metrics_recorded("#{PERFORM_PREFIX}/default")
end

def test_record_perform_all_later_metrics_in_web
skip if Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new('7.1.0')

in_web_transaction do
ActiveJob.perform_all_later(MyJob.new, MyJob.new, MyJob.new)
end

assert_metrics_recorded("#{PERFORM_PREFIX}/default")
end

def test_record_perform_metrics_with_alternate_queue_in_web
in_web_transaction do
MyJobWithAlternateQueue.perform_later
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
# frozen_string_literal: true

require_relative '../../../test_helper'
require 'new_relic/agent/vm/mri_vm'
require 'new_relic/agent/vm/c_ruby_vm'

unless NewRelic::LanguageSupport.jruby?
module NewRelic
module Agent
module VM
class MriVMTest < Minitest::Test
class CRubyVMTest < Minitest::Test
def setup
@snap = Snapshot.new
@vm = MriVM.new
@vm = CRubyVM.new
end

def test_gather_gc_time_sets_gc_total_time_if_gc_profiler_is_enabled
Expand Down

0 comments on commit ec4336a

Please sign in to comment.