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

feat: add aggregated metrics for rails and more #630

Merged
merged 7 commits into from
Nov 8, 2024

Conversation

roelbondoc
Copy link
Member

This adds aggregated metrics for the following plugins:

  • rails
  • net_http
  • sidekiq

Similar to the Karafka plugin, there is now more configuration to fine tune the data:

  • rails.insights.events
  • rails.insights.metrics
  • sidekiq.insights.events
  • sidekiq.insights.metrics
  • net_http.insights.events
  • net_http.insights.metrics

Before submitting a pull request, please make sure the following is done:

  1. If you've fixed a bug or added code that should be tested, add tests!
  2. Run rake spec in the repository root.
  3. Use a pull request title that conforms to conventional commits.

This adds aggregated metrics for the following plugins:

* rails
* net_http
* sidekiq

Similar to the Karafka plugin, there is now more configuration:

* `rails.insights.events`
* `rails.insights.metrics`
* `sidekiq.insights.events`
* `sidekiq.insights.metrics`
* `net_http.insights.events`
* `net_http.insights.metrics`
@roelbondoc roelbondoc force-pushed the add-more-aggregated-metrics branch from 7a6c8f7 to bc87b48 Compare November 6, 2024 15:14
@roelbondoc roelbondoc marked this pull request as ready for review November 6, 2024 16:19
@roelbondoc roelbondoc requested a review from a team November 6, 2024 16:19
Comment on lines 64 to 68
def find_metrics(name, payload)
RAILS_METRICS.select do |metric|
metric.event.to_s == name.to_s && payload.keys.include?(metric.value_key) && (payload.keys & metric.context).any?
end
end
Copy link
Member

Choose a reason for hiding this comment

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

I'm nervous about the load that will be added by going through this loop for every event. Perhaps this could be optimized by converting RAILS_METRICS into a hash, keyed by name, and the value is a proc or something callable that accepts the payload and either returns an array of metrics to the caller (like the method currently does) or even calls public_send itself. Maybe that "something callable" is a Metric class that's more than just a struct. :)

@roelbondoc roelbondoc requested a review from stympy November 8, 2024 16:02
@roelbondoc roelbondoc merged commit 12db5a4 into master Nov 8, 2024
59 checks passed
@roelbondoc roelbondoc deleted the add-more-aggregated-metrics branch November 8, 2024 19:04
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.

2 participants