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 controller and action name to the fragment caching instrumentation payload #14137

Merged

Conversation

dasch
Copy link
Contributor

@dasch dasch commented Feb 21, 2014

This allows tracking the cache activity and performance separately for each controller action. For instance, it would be possible to calculate the cache hit rate for a specific action on a specific controller.

I'd like to add the virtual path of the template to the payload, but it doesn't appear to be accessible from within the module – and I'd rather not pass it explicitly from Action View. If you have any ideas, it would be much appreciated.

@dasch
Copy link
Contributor Author

dasch commented Feb 22, 2014

@josevalim I've added some more instrumentation here – would you mind taking a look at it?

@robin850 robin850 modified the milestone: 4.2.0 Feb 22, 2014
@robin850 robin850 added this to the 4.2.0 milestone Mar 2, 2014
@dasch
Copy link
Contributor Author

dasch commented May 3, 2014

@rafaelfranca @josevalim would you guys care to take a look at this? It's been sitting here for a while now, and I think it would be useful for people :-)

@rafaelfranca
Copy link
Member

I don't see why we should not. Could you add a CHANGELOG entry?

@dasch
Copy link
Contributor Author

dasch commented May 10, 2014

@rafaelfranca sure! I've pushed an updated commit.

@@ -90,7 +90,13 @@ def expire_fragment(key, options = nil)
end

def instrument_fragment_cache(name, key) # :nodoc:
ActiveSupport::Notifications.instrument("#{name}.action_controller", :key => key){ yield }
payload = {
:controller => controller_name,
Copy link
Member

Choose a reason for hiding this comment

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

Could you please use 1.9 hash syntax here ?

@rafaelfranca rafaelfranca merged commit 92fbbf6 into rails:master May 14, 2014
rafaelfranca added a commit that referenced this pull request May 14, 2014
…ation

Add controller and action name to the fragment caching instrumentation payload

Conflicts:
	actionpack/CHANGELOG.md
@dasch dasch deleted the better-fragment-cache-instrumentation branch October 16, 2014 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants