Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Active Support instrumentation #1742

Merged
merged 7 commits into from
Jan 20, 2023
Merged

Conversation

kaylareopelle
Copy link
Contributor

@kaylareopelle kaylareopelle commented Jan 18, 2023

Active Support has notifications built in to instrument caching-related activities, including:

  • cache_read
  • cache_generate
  • cache_fetch_hit
  • cache_write
  • cache_delete
  • cache_exist?

The payload always includes the :key and the name of the :store class. cache_read also includes whether the read is a :hit, and :super_operation when a read is used with #fetch.

https://guides.rubyonrails.org/active_support_instrumentation.html#active-support

When these operations are executed, a new segment will be started that includes the payload within the params attribute.

Closes #1514

@kaylareopelle kaylareopelle force-pushed the active-support-instrumentation branch 2 times, most recently from 9a71fa6 to fa5aff4 Compare January 18, 2023 21:55
Active Support has notifications built in to instrument
caching-related activities, including:
* cache_read
* cache_generate
* cache_fetch_hit
* cache_write
* cache_delete
* cache_exist?

The payload always includes the key and the name of the
store class. cache_read also includes whether the read
is a hit, and :super_operation when a read is used with

https://guides.rubyonrails.org/active_support_instrumentation.html#active-support

When these operations are executed, a new segment will
be started that includes the payload within the params
attribute.
@kaylareopelle kaylareopelle marked this pull request as ready for review January 18, 2023 23:07
CHANGELOG.md Outdated Show resolved Hide resolved
lib/new_relic/agent/configuration/default_source.rb Outdated Show resolved Hide resolved
newrelic.yml Show resolved Hide resolved
* Remove `dynamic_name` from Rails-related configs that do not need it
* Capitalize and add a space between references to Rails libraries
fallwith
fallwith previously approved these changes Jan 18, 2023
Add a unit test for the Active Storage instrumentation that does not
directly invoke the subscriber class's `#start` and `#finish` methods
manually, but instead performs a real Active Storage cache write and
confirms that the instrumentation works as expected.
CHANGELOG.md Outdated Show resolved Hide resolved

def test_failsafe_if_event_does_not_match_expected_pattern
in_transaction('test') do
generate_event('charcuterie_build_a_board_workshop')
Copy link
Contributor

Choose a reason for hiding this comment

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

lmao

fallwith and others added 2 commits January 19, 2023 15:31
prevent the Rails 3 and 4 environments from running the Active Support
caching test for notification verificatation
…er_test

Active Support instrumentation: add test
Copy link
Contributor

@fallwith fallwith left a comment

Choose a reason for hiding this comment

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

looks great

@github-actions
Copy link
Contributor

SimpleCov Report

Coverage Threshold
Line 93.17% 93%
Branch 84.53% 84%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rails notifications: subscribe to ActiveSupport topics
3 participants