Easy analytics for your Rack/Rails app!
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
lib
spec
.gitignore
.rspec
.travis.yml
CODE_OF_CONDUCT.md
Gemfile
LICENSE.txt
README.md
Rakefile
dump.rdb
tracebin.gemspec

README.md

tracebin-ruby

This is the official Ruby agent for Tracebin, a simple performance monitoring tool for web applications. Go to traceb.in to get started.

Installation

Add this line to your application's Gemfile:

gem 'tracebin'

And then execute:

$ bundle

Configure the gem to point to this bin:

Tracebin::Agent.configure do |config|
  config.bin_id = '<YOUR BIN ID>'
end

Configuration

There are several configuration options available for the Tracebin agent. Just set the options in a configure block on Tracebin::Agent:

Tracebin::Agent.configure do |config|
  config.ignored_paths = ['/assets'] # Put any paths you wish to ignore in an array.

  if Rails.env.development? || Rails.env.test?
    config.enabled = false # You can completely disable the agent under the conditions of your choosing.
  end
end

Compatibility

tracebin-ruby has instrumentation in place for the following components:

Rails

tracebin-ruby is compatible with Rails 4+.

  • ActionController
  • ActiveRecord
  • ActionView

Background Jobs

  • ActiveJob
  • Sidekiq
  • Resque

Sinatra

  • Routes (used in place of ActionController)

Databases

If ActiveRecord isn't used, then we've implemented patches for the following database adapters:

  • PG (PostgreSQL)
  • Mysql2 (MySQL)

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/tracebin/tracebin-ruby. 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.

Notes

Storage and Reporting Strategy

Multiple threads are storing information in a thread-safe array. Every minute or so, we need to access that array, empty it, and send it to our service. If that data transfer fails (i.e., the response is not successful), that payload is simply re-added to the array and will be transmitted with the next try.