Skip to content

Commit

Permalink
Merge pull request #1694 from newrelic/100_acre_wood
Browse files Browse the repository at this point in the history
tests and CHANGELOG entry for 1693
  • Loading branch information
fallwith authored Dec 13, 2022
2 parents 0d6d8a2 + 7f35c7b commit 66ceae1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

## v8.14.0

Version 8.14.0 of the agent restores desired Capistrano-based changelog lookup functionalty when a deployment is performed, delivers support for instrumenting Rails custom event notifications, and fixes potential compatibility issues with Redis gems, and fixes bugs related to initialization in Rails.
Version 8.14.0 of the agent restores desired Capistrano-based changelog lookup functionalty when a deployment is performed, speeds up GUID generation, delivers support for instrumenting Rails custom event notifications, fixes potential compatibility issues with the RedisClient gem, and fixes bugs related to initialization in Rails.

- **Deployment Recipe: Restore desired Capistrano-based changelog lookup behavior**

The New Relic Ruby agent offers [a Capistrano recipe for recording app deployments](https://docs.newrelic.com/docs/apm/agents/ruby-agent/features/record-deployments-ruby-agent/#capistrano3). The recipe code was significantly cleaned up with [PR#1498](https://github.com/newrelic/newrelic-ruby-agent/pull/1498) which inadvertently changed the way the recipe handles the changelog for a deployment. Community member [@arthurwozniak](https://github.com/arthurwozniak) spotted and corrected this change in order to restore the desired changelog lookup functionality while retaining all of the previous cleanup. Thank you very much for your contribution, [@arthurwozniak](https://github.com/arthurwozniak)! [PR#1653](https://github.com/newrelic/newrelic-ruby-agent/pull/1653)

- **Speed up GUID generation**

The agent leverages random numbers in its GUID (globally unique identifier) generation and would previously always freshly calculate the result of 16^16 or 32^32 before generating a random number. Given that those 16^16 and 32^32 operations are expected, it makes sense to calculate their results up front and store them in constants to be referred to later. Doing so has resulted in a performance gain for the generation of GUIDs. Many thanks to [@tungmq](https://github.com/tungmq) for contributing this optimisation and the benchmarks to support it! [PR#1693[(https://github.com/newrelic/newrelic-ruby-agent/pull/1693)

- **Support for Rails ActiveSupport::Notifications for custom events**

When the new `active_support_custom_events_names` configuration parameter is set equal to an array of custom event names to subscribe to, the agent will now subscribe to each of the names specified and report instrumentation for the events when they take place. [Creating custom events](https://guides.rubyonrails.org/active_support_instrumentation.html#creating-custom-events) is simple and now reporting instrumentation for them to New Relic is simple as well. [PR#1659](https://github.com/newrelic/newrelic-ruby-agent/pull/1659)
Expand Down
36 changes: 36 additions & 0 deletions test/new_relic/agent/guid_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,42 @@ def test_generate_guid_custom_length
# the result should be exactly 32 hexadecimal characters
assert_match(/[a-f0-9]{32}/, guid)
end

def test_max_rand_16_constant
canned = 1234567890123456
NewRelic::Agent::GuidGenerator.stub_const(:MAX_RAND_16, canned..canned) do
guid = NewRelic::Agent::GuidGenerator.generate_guid(16)

assert_equal '000462d53c8abac0', guid
end
end

def test_max_rand_32_constant
canned = 12345678901234567890123456789012
NewRelic::Agent::GuidGenerator.stub_const(:MAX_RAND_32, canned..canned) do
guid = NewRelic::Agent::GuidGenerator.generate_guid(32)

assert_equal '0000009bd30a3c645943dd1690a03a14', guid
end
end

def test_non_rjust
canned = NewRelic::Agent::GuidGenerator::MAX_RAND_32
NewRelic::Agent::GuidGenerator.stub_const(:MAX_RAND_32, canned..canned) do
guid = NewRelic::Agent::GuidGenerator.generate_guid(32)

assert_equal '100000000000000000000000000000000', guid
end
end

def test_rjust
canned = 1138
NewRelic::Agent::GuidGenerator.stub_const(:MAX_RAND_16, canned..canned) do
guid = NewRelic::Agent::GuidGenerator.generate_guid(16)

assert_equal '0000000000000472', guid
end
end
end
end
end

0 comments on commit 66ceae1

Please sign in to comment.