-
Notifications
You must be signed in to change notification settings - Fork 62
Implement render_template & render_partial subscriptions #53
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
Conversation
140984e
to
caaf546
Compare
Ok, added now some unit and integration tests. |
7717a24
to
f418005
Compare
Sorry, I'm currently a bit busy. Give me a few days to get things in order. At a first glance this looks promising. I'm not a big fan of
If that clears things up, go ahead. |
No worries, take your time ⌚
Right. Maybe we can move it to a
Ok, cool! I will try to move it to a dedicated class then. |
f60f1d4
to
34674f9
Compare
FYI: I've relocated the |
34674f9
to
c25d336
Compare
👍 cool, I will update tomorrow. I added two more features:
Thanks |
Neat :-)
After reverting |
to follow Single Responsibilty and improve testing. This also allows to introduce more subscriber with the same interface in the future.
to write ActionView render measurements to InfluxDB. This commit subscribes to the following events: * render_template.action_view * render_partial.action_view https://guides.rubyonrails.org/active_support_instrumentation.html#action-view Fix InfluxCommunity#51
Subscribes now to render_collection.action_view as well. https://guides.rubyonrails.org/active_support_instrumentation.html#render-collection-action-view Implement InfluxCommunity#51
To know where from which controller action the template was rendered.
c25d336
to
4470416
Compare
@dmke I rebased now on the tag middleware changes and also removed the timestamp conversion module.
I guess / hope not as I only track I just would like to do queries like:
to see the slowest queries. I'm not too familiar with InfluxDB yet but would that be possible with a field value or what would be the advantage of the field value except that it is not limited in the number of different values like a tag?). I can also move this last commit to a dedicated PR so that we can get in the PR and continue discussion in the other PR? |
I would like to get something like this: Skylight does something similar, they combine it with the partial and view results: Would that be possible with a field value? Otherwise maybe we can normalize the queries even more? But I really see a huge advantage in measuring this data 🔍 |
I'll sample a few queries from a few different Rails apps I've access to, and throw it against your normalizer. I suspect the interesting queries (those with sub-sejects, joins, and/or group-by clauses) are going to be boiled down too much. I fear that the simple regex is both too simple has a too large CPU footprint (I've seen hundrets of queries on a single page).
Tags are automatically indexed and allow to be Say you want to see the average query time in the last 24 hours in 1 hour slices, for each query. This is what you'd send to the server: select mean(value) from "rails.sql" where time > now() - 1d group by time(1h), sql If
That looks to me, as if the omit the conditions from the query (I see
Yeah, let's do that for now. |
because otherwise they always run in the same order which can cause dependencies between the specs.
4470416
to
8bdbbec
Compare
Dropped and opened https://github.com/influxdata/influxdb-rails/pull/55 |
Because it got promoted to influxdb-ruby.
8bdbbec
to
b8f4765
Compare
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.
Apart from a few nitpicks, I like what I see.
to DRY the code a little bit.
to DRY the code and make it more readable.
246e585
to
84fe374
Compare
@dmke thanks for the review, implemented your suggestions. |
I've changed a few bits (Rubocop was still producing output), but this is now merged. |
Initial proposal to implement subscriptions for 👀
https://guides.rubyonrails.org/active_support_instrumentation.html#action-view
ActionView::RenderSubscription
class to handle the events and write to influxdbI would also propose to move
InfluxDB::Rails.handle_action_controller_metrics
and the lambda inRailties
class to a dedicated class.Thanks for providing feedback ❤️