Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/run_perfverse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ jobs:
iterations: ${{ inputs.iterations }}
run_label: run_four


run_perf_tests_disabled:
runs-on: ubuntu-latest
if: ${{ inputs.agent_test_agent_disabled }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/scripts/run_perf_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def run_command(command)
end

def transform_agent_tags(agent_tag)
agent_tag.split(':').tap do |array|
agent_tag.split(':', 2).tap do |array|
array[1] = array[1]&.split(';')
end
end
Expand Down Expand Up @@ -62,14 +62,14 @@ def run_rails_app(agent_tag, env_vars, iteration)
end

def run_docker_report(agent_tag, container_ids, iteration)
Thread.new do
Thread.new do
output_dir = "#{ENV['DOCKER_MONITOR_OUTPUT_DIR']}/run_#{iteration}"
env_str = ''
env_str += "-e TEST_TAG=#{ENV['TEST_TAG']} "
env_str += "-e AGENT_VERSION=#{agent_tag} "
env_str += "-e DOCKER_MONITOR_OUTPUT_DIR=#{output_dir} "
env_str += "-e MONITOR_CONTAINERS=#{container_ids} "

docker_mount_bind = "--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock"
output_mount_bind = "--mount type=bind,source=./#{output_dir},target=/app/#{output_dir}"

Expand Down
2 changes: 1 addition & 1 deletion test/perfverse/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG RUBY_VERSION=3.3.3
FROM registry.docker.com/library/ruby:$RUBY_VERSION as base
FROM registry.docker.com/library/ruby:$RUBY_VERSION AS base

ARG AGENT_VERSION

Expand Down
25 changes: 13 additions & 12 deletions test/perfverse/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@

## Overview

Performance test for the agent that runs in GHA. To run the Perfverse, go to [Github Actions](https://github.com/newrelic/newrelic-ruby-agent/actions/workflows/run_perfverse.yml) to run the workflow.
Performance test for the agent that runs in GHA. To run the Perfverse, go to [Github Actions](https://github.com/newrelic/newrelic-ruby-agent/actions/workflows/run_perfverse.yml) to run the workflow.


### Agent Version and Agent Configs

Each run will run a specific git tag with whatever env vars you set passed in to the agent. Agent config env vars are optional, and do not need to be listed.
Each run will run a specific git tag with whatever env vars you set passed in to the agent. Agent config env vars are optional, and do not need to be listed.

Expected String format:

git_tag:ENV_VAR_1=one;ENV_VAR_2=two

**Note:** The git tag **must** be unique for every run. The git tags are used for the x-axis column names on the output graphs. Keep tag names short to keep the charts readable.

### Github Actions
### Github Actions

Designed to be run in GHA by triggering the workflow dispatch with the expected inputs.
Designed to be run in GHA by triggering the workflow dispatch with the expected inputs.
The GHA files used to run the perfverse:

- `.github/workflows/run_perfverse.yml`
Expand All @@ -30,8 +31,8 @@ While it's designed to run in GHA, individual parts of this can be run locally f

### Rails app

Will build a rails app running the agent from a specific git tag. All versions also have git tags, so any version number can be used.
Currently we only have a single rails 7 app. You will need to pass in the new relic staging license key as an env var (or use prod and remove the host config).
Will build a rails app running the agent from a specific git tag. All versions also have git tags, so any version number can be used.
Currently we only have a single rails 7 app. When running locally, you will need to pass in the new relic staging license key as an env var (or use prod and remove the host config).

cd ./test/perfverse/

Expand All @@ -46,10 +47,10 @@ The container it will be monitoring needs to be already running, and it will run

Env vars you will need to pass in to dockermon: MONITOR_CONTAINERS, AGENT_VERSION, DOCKER_MONITOR_OUTPUT_DIR. There also need to be some volume mounts, one for it to connect to the Docker socket and another for the output directory.

cd ./test/perfverse/docker_monitor
cd ./test/perfverse/docker_monitor
mkdir -p docker_monitor_outputs

docker build --pull --progress=plain -t docker_monitor_report:local .
docker build --pull --progress=plain -t docker_monitor_report:local .

docker run --rm --name docker_monitor_report -e MONITOR_CONTAINERS=perfverse_local -e AGENT_VERSION=9.0.0 -e DOCKER_MONITOR_OUTPUT_DIR=docker_monitor_outputs --mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock --mount type=bind,source=./docker_monitor_outputs,target=/app/docker_monitor_outputs docker_monitor_report:local

Expand All @@ -58,8 +59,8 @@ Env vars you will need to pass in to dockermon: MONITOR_CONTAINERS, AGENT_VERSIO

This is the traffic driver. It is configured to provide a consistent load on the application being tested. You can change how long you want it to run by modifying the value of the `-t` flag.

cd ./test/perfverse/traffic
cd ./test/perfverse/traffic

docker pull locustio/locust

docker run -p 8089:8089 --network="host" -v $PWD:/mnt/locust locustio/locust -t 1m -f /mnt/locust/driver.py --host=http://127.0.0.1:3000 --headless -u 5
Expand All @@ -72,9 +73,9 @@ This will create all the graphs from the dockermon data. It is expecting to find

cd ./test/perfverse/reports

mkdir -p inputs
mkdir -p inputs
mkdir -p outputs

docker build --pull --progress=plain -t charty:local .
docker build --pull --progress=plain -t charty:local .
docker run --rm --name ruby-charty --network="host" -it --mount type=bind,source=./output,target=/charty/output charty:local

4 changes: 2 additions & 2 deletions test/perfverse/docker_monitor/docker-monitor-threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ def read_from_container(client, log, container_id):
print(f"Time: {stat['read']} Container: {container_id} name: {stat['name']}", flush=True)
output_stats(log, stat)


def sigterm_handler(signum, frame):
print("SIGTERM received, exiting gracefully...")
sys.exit(0)

if __name__ == "__main__":
# Register the signal handler for SIGTERM
signal.signal(signal.SIGTERM, sigterm_handler)

client = docker.from_env()

dockermon_output_dir = os.environ.get("DOCKER_MONITOR_OUTPUT_DIR")
Expand Down
2 changes: 1 addition & 1 deletion test/perfverse/rails7/lib/custom_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def custom_instance_method
add_transaction_tracer :custom_instance_method, category: :task

def custom_instance_method_too
2 | 1 =~ 3
2 | 1 == 3
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous code raised an error... and I'm not sure if that was on purpose?

end
add_method_tracer :custom_instance_method_too, %w[Custom/CLMtesting/InstanceMethod]
end
Expand Down
Loading