Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

trace_location

> 后端框架
Open source

Help you get reading the huge open souce libraries in Ruby and trace its source locations

269 stars0 likes5 views
WebsiteGitHub

About

Help you get reading the huge open souce libraries in Ruby and trace its source locations

TraceLocation

TraceLocation helps you trace the source location to ease reading huge open-source libraries in Ruby.

Installation

Add this line to your application's Gemfile:

ruby
gem 'trace_location'

And then execute:

$ bundle

Or install it yourself as:

$ gem install trace_location

Usage

Example: Track establish connection in Active Record

ruby
config = Rails.application.config.database_configuration[Rails.env]

TraceLocation.trace do
  # You just surround you want to track the process.
  ActiveRecord::Base.establish_connection(config)
end

Then you can get logs like this: .md, .log, .csv

Trace method options

name content example
format :md, :log, :csv (default: :md) :md
match Regexp, Symbol, String or Array for allow list [:activerecord, :activesupport]
ignore Regexp, Symbol, String or Array for deny list /bootsnap|activesupport/
methods Symbol or Array of method names [:call]

More examples

Example: Track the validation process of Active Record

ruby
book = Book.new(title: "My Book Title")
TraceLocation.trace(match: /activerecord/) { book.validate }

Results: .md, .log, .csv

Example: Track the lifecycle of Rails application

ruby
env = Rack::MockRequest.env_for('http://localhost:3000/books')

TraceLocation.trace do
  status, headers, body = Rails.application.call(env)
end

Results: .md, .log, .csv

Example: Track the has_secure_password in User model

ruby
class User < ApplicationRecord
  # temporary surrounding with TraceLocation#trace
  TraceLocation.trace(format: :md, ignore: /activesupport/) do
    has_secure_password
  end

Results: .md, .log, .csv

Example: Track the rendering process of action in controller class

ruby
class BooksController < ApplicationController
  before_action :set_book, only: [:show, :update, :destroy]

  # GET /books
  def index
    @books = Book.all

    # temporary surrounding with TraceLocation#trace
    TraceLocation.trace(format: :md, ignore: /activesupport|rbenv|concurrent-ruby/) do
      render json: @books
    end
  end

Results: .md, .log, .csv

License

MIT License

Issues· 1 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rubycodereaderrailstracepoints

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架