PeakflowUtils
Various tools to use with www.peakflow.io.
Installation
Add this line to your application's Gemfile:
gem "peak_flow_utils"
And then execute:
$ bundle
Or install it yourself as:
$ gem install peak_flow_utils
Add this to config/peakflow.rb:
PeakFlowUtils::Notifier.configure(auth_token: "your-token")
Usage
Reporting errors manually
PeakFlowUtils::Notifier.notify(error: error)
Errors that escape a PeakFlowUtils::Notifier.with_parameters block keep a snapshot of the scoped parameters. Later framework handlers, such as Sidekiq error handlers, can report the same error after the block has unwound and still include the captured context.
Reporting Rails errors
Add this to config/peakflow.rb:
PeakFlowUtils::NotifierRails.configure
Reporting ActiveJob errors in Rails:
If you want the job name and its arguments logged in parameters you can execute this service:
PeakFlowUtils::ActiveJobParametersLogging.execute!
Reporting Sidekiq errors in Rails:
Add this to config/peakflow.rb:
PeakFlowUtils::NotifierSidekiq.configure
If you want the job name and its arguments logged in parameters you can execute this service:
PeakFlowUtils::SidekiqParametersLogging.execute!
Sidekiq and Postgres pings
Add this to routes.rb:
Rails.application.routes.draw do
mount PeakFlowUtils::Engine => "/peakflow_utils"
Add these to .env variables:
PEAKFLOW_PINGS_USERNAME=username
PEAKFLOW_PINGS_PASSWORD=secret-password
You can now add a HTTP ping on this path:
/peakflow_utils/pings/sidekiq
And this for Postgres:
/pings/postgres_connections
Contributing
Contribution directions go here.
License
The gem is available as open source under the terms of the MIT License.