CorrelationId (System:MES,Squad:publisher,Type:Component)

Provides correllation id implementation.

Technology

  • ruby

Build

Build Status

Allows correlation tracking from request down the network stack

Installation

Add this line to your application's Gemfile:

gem 'correlation_id'

And then execute:

$ bundle

Or install it yourself as:

$ gem install correlation_id

Usage

Rails

You need just add gem to your Gemfile somewhere after rails.

Rack

You need to add our middleware to the top of your middlewares config.ru.

use CorrelationId::Middleware::Rack

Airbrake

You need to add our Airbrake filter after configuring Airbrake

Airbrake.configure do |c|
  c.project_id = ENV['AIRBRAKE_PROJECT_ID']
  c.project_key = ENV['AIRBRAKE_PROJECT_KEY']
end

Airbrake.add_filter(CorrelationId::Middleware::Airbrake)

Faraday

You need to add gem after faraday and add middleware when you create Faraday connection.

Example:

conn = Faraday.new 'http://example.com' do |faraday|
  faraday.request :correlation_id
  faraday.adapter Faraday.default_adapter
end
conn.get('/page')

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/glomex/correlation_id. 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.