GitXplorerGitXplorer
b

cache-query-trace

public
3 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
239bb75516b0849f79f043f75b4855b91bca9d9c

Release 0.1.1

bbe9 committed 9 years ago
Unverified
686b23695385da898778d25db5607ca90ef2e62e

Remove allowed_push_host section from the gemspec

bbe9 committed 9 years ago
Unverified
83b2e6ba373a12d1c654a177578ba070ae893426

Add the name to the license file

bbe9 committed 9 years ago
Unverified
cff50bcfb6d741c5c37ad3f691c51c70fa8dce37

Initial commit

bbe9 committed 9 years ago

README

The README file for this repository.

Logs the source of execution of cache queries to the Rails log. Helpful to track down where queries are being executed in your application, for performance optimizations most likely.

This gem is basically a modified version of active_record_query_trace.

Installation

Add this line to your application's Gemfile:

gem 'cache-query-trace'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cache-query-trace

Usage

Enable it in an initializer:

CacheQueryTrace.enabled = true

Options

There are three levels of debug.

  1. app - includes only files in your app/ directory.
  2. full - includes files in your app as well as rails.
  3. rails - alternate output of full backtrace, useful for debugging gems.
CacheQueryTrace.level = :app # default

Additionally, if you are working with a large app, you may wish to limit the number of lines displayed for each query.

CacheQueryTrace.lines = 10 # Default is 5. Setting to 0 includes entire trace.

Output

When enabled cache queries will be logged like:

Cache read: posts_count
  ↳ app/controllers/posts_controller.rb:3:in `index'
Read fragment views/posts/4-20151210094737092778000/8837ab4e4a7592addd66bce7a312e0e6 (3.1ms)
Cache write: views/posts/4-20151210094737092778000/8837ab4e4a7592addd66bce7a312e0e6
  ↳ app/views/posts/index.html.erb:5:in `block in _app_views_posts_index_html_erb__3444413509721278033_69855962868040'
     from app/views/posts/index.html.erb:4:in `_app_views_posts_index_html_erb__3444413509721278033_69855962868040'
  ↳ app/views/posts/index.html.erb:5:in `block in _app_views_posts_index_html_erb__3444413509721278033_69855962868040'
     from app/views/posts/index.html.erb:4:in `_app_views_posts_index_html_erb__3444413509721278033_69855962868040'
Write fragment views/posts/4-20151210094737092778000/8837ab4e4a7592addd66bce7a312e0e6 (16.4ms)
  Rendered posts/index.html.erb within layouts/application (184.0ms)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cache-query-trace. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.