Skip to content

Commit

Permalink
Merge branch 'dev' into sa-health-check
Browse files Browse the repository at this point in the history
  • Loading branch information
kaylareopelle authored Jan 17, 2025
2 parents a1bcd2a + 434d70d commit d85904b
Show file tree
Hide file tree
Showing 24 changed files with 575 additions and 81 deletions.
338 changes: 304 additions & 34 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

264 changes: 231 additions & 33 deletions .github/workflows/ci_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,50 @@ jobs:


multiverse:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
multiverse: [agent, ai, background, background_2, frameworks, httpclients, httpclients_2, rails, rest]
ruby-version: [2.4.10, 2.5.9, 2.6.10, 2.7.8, 3.0.7, 3.1.6, 3.2.6, 3.3.6, 3.4.1]
steps:
- name: Configure git
run: 'git config --global init.defaultBranch main'
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag v4.1.7

# - curl is needed for Curb
# - xslt is needed for older Nokogiris, RUBY_VERSION < 2.5
# - sasl is needed for memcached
- name: Install OS packages
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@4a9ddd6f338a97768b8006bf671dfbad383215f4 # tag v1.207.0
with:
ruby-version: ${{ matrix.ruby-version }}

- name: Setup bundler
run: ./.github/workflows/scripts/setup_bundler
env:
RUBY_VERSION: ${{ matrix.ruby-version }}

- name: Run Multiverse Tests
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # tag v3.0.0
with:
timeout_minutes: 60
max_attempts: 2
command: bundle exec rake test:multiverse[group="${{ matrix.multiverse }}"]
env:
VERBOSE_TEST_OUTPUT: true
SERIALIZE: 1

- name: Annotate errors
if: ${{ failure() }}
uses: ./.github/actions/annotate


multiverse_services_1:
needs: run_rubocop
runs-on: ubuntu-22.04
services:
elasticsearch7:
Expand All @@ -138,7 +182,7 @@ jobs:
--health-timeout 5s
--health-retries 10
elasticsearch8:
image: elasticsearch:8.4.2
image: elasticsearch:8.13.0
env:
discovery.type: single-node
xpack.security.enabled: false
Expand All @@ -149,17 +193,64 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 10
zookeeper:
image: bitnami/zookeeper
mongodb:
image: ${{ contains(fromJson('["2.4.10"]'), matrix.ruby-version) && 'mongo:5.0.11' || 'mongo:latest' }}
ports:
- 2181:2181
env:
ALLOW_ANONYMOUS_LOGIN: yes
- 27017:27017
rabbitmq:
image: rabbitmq:latest
ports:
- 5672:5672
options: >-
--health-cmd "echo mntr | nc -w 2 -q 2 localhost 2181"
--health-cmd "rabbitmq-diagnostics -q check_port_connectivity"
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
fail-fast: false
matrix:
ruby-version: [2.4.10, 2.5.9, 2.6.10, 2.7.8, 3.0.7, 3.1.6, 3.2.6, 3.3.6, 3.4.1]

steps:
- name: Configure git
run: 'git config --global init.defaultBranch main'
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag v4.1.7

# - curl is needed for Curb
# - xslt is needed for older Nokogiris, RUBY_VERSION < 2.5
# - sasl is needed for memcached
- name: Install OS packages
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@4a9ddd6f338a97768b8006bf671dfbad383215f4 # tag v1.207.0
with:
ruby-version: ${{ matrix.ruby-version }}

- name: Setup bundler
run: ./.github/workflows/scripts/setup_bundler
env:
RUBY_VERSION: ${{ matrix.ruby-version }}

- name: Run Multiverse Tests
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # tag v3.0.0
with:
timeout_minutes: 60
max_attempts: 2
command: bundle exec rake test:multiverse[group="services_1"]
env:
VERBOSE_TEST_OUTPUT: true
SERIALIZE: 1

- name: Annotate errors
if: ${{ failure() }}
uses: ./.github/actions/annotate


multiverse_services_2:
needs: run_rubocop
runs-on: ubuntu-22.04
services:
kafka:
image: bitnami/kafka
ports:
Expand All @@ -185,10 +276,133 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
mongodb:
image: ${{ contains(fromJson('["2.4.10"]'), matrix.ruby-version) && 'mongo:5.0.11' || 'mongo:latest' }}
redis:
image: redis
ports:
- 27017:27017
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
fail-fast: false
matrix:
ruby-version: [2.4.10, 2.5.9, 2.6.10, 2.7.8, 3.0.7, 3.1.6, 3.2.6, 3.3.6, 3.4.1]

steps:
- name: Configure git
run: 'git config --global init.defaultBranch main'
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag v4.1.7

# - curl is needed for Curb
# - xslt is needed for older Nokogiris, RUBY_VERSION < 2.5
# - sasl is needed for memcached
- name: Install OS packages
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@4a9ddd6f338a97768b8006bf671dfbad383215f4 # tag v1.207.0
with:
ruby-version: ${{ matrix.ruby-version }}

- name: Setup bundler
run: ./.github/workflows/scripts/setup_bundler
env:
RUBY_VERSION: ${{ matrix.ruby-version }}

- name: Run Multiverse Tests
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # tag v3.0.0
with:
timeout_minutes: 60
max_attempts: 2
command: bundle exec rake test:multiverse[group="services_2"]
env:
VERBOSE_TEST_OUTPUT: true
SERIALIZE: 1

- name: Annotate errors
if: ${{ failure() }}
uses: ./.github/actions/annotate



multiverse_services_kafka:
needs: run_rubocop
runs-on: ubuntu-22.04
services:
kafka:
image: bitnami/kafka
ports:
- 9092:9092
options: >-
--health-cmd "kafka-broker-api-versions.sh --version"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper:2181
ALLOW_PLAINTEXT_LISTENER: yes
KAFKA_LISTENERS: INSIDE://0.0.0.0:9093,OUTSIDE://0.0.0.0:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
KAFKA_ADVERTISED_LISTENERS: INSIDE://kafka:9093,OUTSIDE://localhost:9092
zookeeper:
image: bitnami/zookeeper
ports:
- 2181:2181
env:
ALLOW_ANONYMOUS_LOGIN: yes
options: >-
--health-cmd "echo mntr | nc -w 2 -q 2 localhost 2181"
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
fail-fast: false
matrix:
ruby-version: [2.4.10, 2.5.9, 2.6.10, 2.7.8, 3.0.7, 3.1.6, 3.2.6, 3.3.6, 3.4.1]

steps:
- name: Configure git
run: 'git config --global init.defaultBranch main'
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # tag v4.1.7

# - curl is needed for Curb
# - xslt is needed for older Nokogiris, RUBY_VERSION < 2.5
# - sasl is needed for memcached
- name: Install OS packages
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@4a9ddd6f338a97768b8006bf671dfbad383215f4 # tag v1.207.0
with:
ruby-version: ${{ matrix.ruby-version }}

- name: Setup bundler
run: ./.github/workflows/scripts/setup_bundler
env:
RUBY_VERSION: ${{ matrix.ruby-version }}

- name: Run Multiverse Tests
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # tag v3.0.0
with:
timeout_minutes: 60
max_attempts: 2
command: bundle exec rake test:multiverse[group="services_kafka"]
env:
VERBOSE_TEST_OUTPUT: true
SERIALIZE: 1

- name: Annotate errors
if: ${{ failure() }}
uses: ./.github/actions/annotate


multiverse_services_mysql_pg:
needs: run_rubocop
runs-on: ubuntu-22.04
services:
mysql:
image: mysql:5.7
env:
Expand All @@ -208,29 +422,11 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
rabbitmq:
image: rabbitmq:latest
ports:
- 5672:5672
options: >-
--health-cmd "rabbitmq-diagnostics -q check_port_connectivity"
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
fail-fast: false
matrix:
multiverse: [agent, ai, background, background_2, database, kafka, frameworks, httpclients, httpclients_2, rails, rest]
ruby-version: [2.4.10, 2.5.9, 2.6.10, 2.7.8, 3.0.7, 3.1.6, 3.2.6, 3.3.6, 3.4.1]

steps:
- name: Configure git
run: 'git config --global init.defaultBranch main'
Expand All @@ -247,8 +443,9 @@ jobs:
with:
ruby-version: ${{ matrix.ruby-version }}

# This allows the cache in the following step to be able to write files to the directory needed for mysql
- if: matrix.ruby-version == '2.4.10'
name: Prepare mysql dirextory
name: Prepare mysql directory
run: sudo chown -R $USER /usr/local

- if: matrix.ruby-version == '2.4.10'
Expand All @@ -259,7 +456,7 @@ jobs:
path: /usr/local/mysql55
key: mysql55-install

- if: steps.mysql55-cache.outputs.cache-hit != 'true' && ( matrix.ruby-version == '2.4.10')
- if: steps.mysql55-cache.outputs.cache-hit != 'true' && matrix.ruby-version == '2.4.10'
name: Install mysql55
run: sudo ./test/script/install_mysql55

Expand All @@ -280,13 +477,12 @@ jobs:
sleep 1;
fi
- name: Run Multiverse Tests
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # tag v3.0.0
with:
timeout_minutes: 60
max_attempts: 2
command: bundle exec rake test:multiverse[group="${{ matrix.multiverse }}"]
command: bundle exec rake test:multiverse[group="services_mysql_pg"]
env:
VERBOSE_TEST_OUTPUT: true
DB_PASSWORD: root
Expand All @@ -303,6 +499,8 @@ jobs:
uses: ./.github/actions/annotate




infinite_tracing:
runs-on: ubuntu-22.04
strategy:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

The agent now supports Ruby 3.4.0. We've made incremental changes throughout the preview stage to reach compatibility. This release includes an update to the Thread Profiler for compatibility with Ruby 3.4.0's new backtrace format. [Issue#2992](https://github.com/newrelic/newrelic-ruby-agent/issues/2992) [PR#2997](https://github.com/newrelic/newrelic-ruby-agent/pull/2997)

- **Feature: Kubernetes APM auto-attach - new agent version precedent**

Previously, when a customer installed the Ruby agent via [Kubernetes APM auto-attach](https://docs.newrelic.com/docs/kubernetes-pixie/kubernetes-integration/installation/k8s-agent-operator/) and also had the Ruby agent listed in their `Gemfile`, the agent version in `Gemfile` would take precedence. Now, the agent version installed by auto-attach takes priority. [PR#3018](https://github.com/newrelic/newrelic-ruby-agent/pull/3018)

- **Feature: Add health checks when the agent runs within Agent Control**

When the agent is started within an [Agent Control](https://docs-preview.newrelic.com/docs/new-relic-agent-control) environment, a health check file will be created at the configured file location for every agent process. By default, this location is: '/newrelic/apm/health'. The health check files will be updated at the configured frequency, which defaults to every five seconds. [PR#2995](https://github.com/newrelic/newrelic-ruby-agent/pull/2995)
Expand Down
7 changes: 4 additions & 3 deletions lib/boot/strap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ module NRBundlerPatch
NR_AGENT_GEM = 'newrelic_rpm'

def require(*_groups)
super

require_newrelic

super
end

def require_newrelic
lib = File.expand_path('../..', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
$LOAD_PATH.reject! { |path| path.include?('newrelic_rpm') }
$LOAD_PATH.unshift(lib)
Kernel.require NR_AGENT_GEM
end
end
Expand Down
2 changes: 2 additions & 0 deletions test/environments/rails60/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ gem 'pry' if ENV['ENABLE_PRY']

gem 'simplecov' if ENV['VERBOSE_TEST_OUTPUT']
gem 'warning'

gem 'logger'
1 change: 1 addition & 0 deletions test/environments/rails60/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# frozen_string_literal: true

require_relative 'boot'
require 'logger'

require 'rails/all'
require 'active_record/base'
Expand Down
2 changes: 2 additions & 0 deletions test/environments/rails61/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ if RUBY_VERSION.split('.')[0..1].join('.').to_f >= 3.4
gem 'mutex_m'
gem 'ostruct'
end

gem 'logger'
Loading

0 comments on commit d85904b

Please sign in to comment.