-
Notifications
You must be signed in to change notification settings - Fork 145
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
Conversation
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`
7a6c8f7
to
bc87b48
Compare
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 |
There was a problem hiding this comment.
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. :)
This adds aggregated metrics for the following plugins:
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:
rake spec
in the repository root.