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
merged 1 commit into from May 14, 2014

Conversation

Projects
None yet
3 participants
@dasch
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@dasch

dasch Feb 22, 2014

Contributor

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

Contributor

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 actionpack and removed activesupport labels Mar 2, 2014

@robin850 robin850 added this to the 4.2.0 milestone Mar 2, 2014

@dasch

This comment has been minimized.

Show comment
Hide comment
@dasch

dasch May 3, 2014

Contributor

@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 :-)

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca May 10, 2014

Member

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

Member

rafaelfranca commented May 10, 2014

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

@dasch

This comment has been minimized.

Show comment
Hide comment
@dasch

dasch May 10, 2014

Contributor

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

Contributor

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,

This comment has been minimized.

@robin850

robin850 May 10, 2014

Member

Could you please use 1.9 hash syntax here ?

@robin850

robin850 May 10, 2014

Member

Could you please use 1.9 hash syntax here ?

:key => key
}
ActiveSupport::Notifications.instrument("#{name}.action_controller", payload){ yield }

This comment has been minimized.

@rafaelfranca

rafaelfranca May 10, 2014

Member

Put a space before the {

@rafaelfranca

rafaelfranca May 10, 2014

Member

Put a space before the {

@rafaelfranca rafaelfranca merged commit 92fbbf6 into rails:master May 14, 2014

rafaelfranca added a commit that referenced this pull request May 14, 2014

Merge pull request #14137 from dasch/better-fragment-cache-instrument…
…ation

Add controller and action name to the fragment caching instrumentation payload

Conflicts:
	actionpack/CHANGELOG.md

@dasch dasch deleted the dasch:better-fragment-cache-instrumentation branch Oct 16, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment