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 allocations to template renderer subscription #34136

Merged
merged 1 commit into from
Oct 10, 2018

Conversation

eileencodes
Copy link
Member

This PR adds the allocations to the instrumentation for template and
partial rendering.

Before:

  Rendering posts/new.html.erb within layouts/application
  Rendered posts/_form.html.erb (9.7ms)
  Rendered posts/new.html.erb within layouts/application (10.9ms)
Completed 200 OK in 902ms (Views: 890.8ms | ActiveRecord: 0.8ms)

After:

  Rendering posts/new.html.erb within layouts/application
  Rendered posts/_form.html.erb (Duration: 7.1ms | Allocations: 6004)
  Rendered posts/new.html.erb within layouts/application (Duration: 8.3ms | Allocations: 6654)
Completed 200 OK in 858ms (Views: 848.4ms | ActiveRecord: 0.4ms | Allocations: 1539564)

cc/ @tenderlove

@eileencodes eileencodes added this to the 6.0.0 milestone Oct 9, 2018
@rails-bot rails-bot bot added the actionpack label Oct 9, 2018
@eileencodes eileencodes force-pushed the add-allocations-to-template-renderer branch from 69a33bc to 0571e18 Compare October 9, 2018 19:30
Copy link
Contributor

@albertoalmagro albertoalmagro left a comment

Choose a reason for hiding this comment

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

Wow thanks @eileencodes! I just added a nitpicky comment 🔍

@@ -20,12 +20,15 @@ def process_action(event)
info do
payload = event.payload
additions = ActionController::Base.log_process_action(payload)

status = payload[:status]
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: After removing the blank line I would format status to the same level asadditions as we seem to follow that style across this file.

payload   = event.payload
additions = ActionController::Base.log_process_action(payload)
status    = payload[:status]

Copy link
Member Author

Choose a reason for hiding this comment

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

I went the other way. Evening the space makes searching harder so I'm not a huge fan.

Copy link
Contributor

Choose a reason for hiding this comment

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

Great! Thanks for caring about this and for the PR ❤️

This PR adds the allocations to the instrumentation for template and
partial rendering.

Before:

```
  Rendering posts/new.html.erb within layouts/application
  Rendered posts/_form.html.erb (9.7ms)
  Rendered posts/new.html.erb within layouts/application (10.9ms)
Completed 200 OK in 902ms (Views: 890.8ms | ActiveRecord: 0.8ms)
```

After:

```
  Rendering posts/new.html.erb within layouts/application
  Rendered posts/_form.html.erb (Duration: 7.1ms | Allocations: 6004)
  Rendered posts/new.html.erb within layouts/application (Duration: 8.3ms | Allocations: 6654)
Completed 200 OK in 858ms (Views: 848.4ms | ActiveRecord: 0.4ms | Allocations: 1539564)
```
@eileencodes eileencodes force-pushed the add-allocations-to-template-renderer branch from 0571e18 to e8c1be4 Compare October 10, 2018 12:07
@eileencodes eileencodes merged commit 8ecb75e into master Oct 10, 2018
@eileencodes eileencodes deleted the add-allocations-to-template-renderer branch October 10, 2018 13:31
@nateberkopec
Copy link
Contributor

nateberkopec commented Aug 6, 2019

Since this uses GC.stat, do we care that this will throw out potentially nonsense numbers for multithreaded application servers like Puma? Should this be turned off or somehow warning-flagged in those environments?

Also, it looks like GC moving now increments the object counter, also making this measurement less accurate.

@nateberkopec
Copy link
Contributor

@tenderlove @eileencodes forgot to tag.

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