Skip to content
Monitor your Ruby Applications metrics (Memory, SQL Requests & Request Time) as part of your test suite.
Ruby HTML Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Gem Version Build Status Codacy Badge Maintainability Test Coverage


Monitor your Ruby Applications metrics (Memory, SQL Requests & Request Time) as part of your test suite.

Please consider supporting this project by adding PigCI to your GitHub project & using this as part of CI. The CI tool will fail PRs that exceed metric threshold (e.g. a big increase in memory).


Add this line to your application's Gemfile:

group :test do
  gem 'pig-ci-rails'

And then execute:


Or install it yourself as:

gem install pig-ci-rails


On it's own

# In spec/rails_helper.rb
require 'pig_ci'

With - For sharing runs as a team via CI

You can hookup your project to, this will fail PRs when metric thresholds are exceeded (e.g. your app see a big increase in memory).

# In spec/rails_helper.rb
require 'pig_ci'
PigCI.start do |config|
  # When you connect your project, you'll be given an API key.
  config.api_key = 'you-api-key-here'

Configuring PigCI

This gems was setup to be configured by passing a block to the PigCI.start method, e.g:

# In spec/rails_helper.rb
require 'pig_ci'
PigCI.start do |config|
  config.option = 'new_value'

  # E.g. disable terminal summary output
  config.generate_terminal_summary = false
end # if ENV['RUN_PIG_CI'] || RSpec.configuration.files_to_run.count > 1

You can see the full configuration options lib/pig_ci.rb.

Framework support

Currently this gem only supports Ruby on Rails.

Metric notes

Minor fluctuations in memory usage and request time are to be expected and are nothing to worry about. Though any large spike is a signal of something worth investigating.


By default, this gem will tell Rails to eager load your application on startup. This aims to help identify leaks, over just pure bulk.

You can disable this functionality by setting your configuration to be:

require 'pig_ci'
PigCI.start do |config|
  config.during_setup_eager_load_application = false

Request Time

Often the first request test will be slow, as rails is loading a full environment. To mitigate this issue, this gem will make a blank request to your application before your test suite starts.

You can disable this functionality by setting your configuration to be:

require 'pig_ci'
PigCI.start do |config|
  config.during_setup_make_blank_application_request = false

You can also improve the first request performance (and overall memory usage) by precompiling your assets before running RSpec:

bundle exec rake assets:precompile RAILS_ENV=test


  • This gem was made by @MikeRogers0.
  • It was originally inspired by oink, after it was used to monitor acceptance tests and it spotted a memory leak. It seemed like something that would be useful to have as part of CI.
  • The HTML output was inspired by simplecov.


After checking out the repo, run bin/setup to install dependencies. Then, run rake test 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


Features I'd like to add at some point:

  • HTML output to include branch - Right now they're just timestamps which makes filtering hard.
  • Should I disable terminal output by default? It feels like noise.
  • Should I reject database requests that have a value of 0? I think so.
  • Document setting branch/commit encase of weird CI.
  • Add rake rake for submitting reports.
  • - Document the gem so it's easier for people to jump on.


Bug reports and pull requests are welcome on GitHub at PigCI/pig-ci-rails. 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.

Code of Conduct

Everyone interacting in the PigCI project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

You can’t perform that action at this time.