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

include additional AC topics in Rails subscription #2745

Merged
merged 2 commits into from
Jul 15, 2024
Merged

Conversation

fallwith
Copy link
Contributor

When subscribing to Action Controller topics for Rails notifications, include 4 new topics in the subscription regex:

  • exist_fragment?
  • expire_fragment
  • read_fragment
  • write_fragment

When subscribing to Action Controller topics for Rails notifications,
include 4 new topics in the subscription regex:

- `exist_fragment?`
- `expire_fragment`
- `read_fragment`
- `write_fragment`
Copy link

SimpleCov Report

Coverage Threshold
Line 93.85% 93%
Branch 70.54% 50%


# have to double escape period because its going from string -> regex
NewRelic::Agent::Instrumentation::ActionControllerOtherSubscriber \
.subscribe(Regexp.new("^(#{subs.join('|')})\\.action_controller$"))
.subscribe(Regexp.new("^(?:#{subs.join('|')})\\.action_controller$"))
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the addition of ?: doing as a non-regex pro?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By default, wrapping part of the pattern in parens will cause the part of the match to be captured. By using (?:) instead of (), I'm telling both the parser and the future human reviewer that we don't actually intend to do any capturing with this regex and simply want to use the parens for grouping.

@fallwith fallwith merged commit c6f8b72 into dev Jul 15, 2024
32 checks passed
@fallwith fallwith deleted the addactopics branch July 15, 2024 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants