Skip to content

Seamlessly integrate statsd with your sucker_punch jobs

License

Notifications You must be signed in to change notification settings

mjc-gh/sucker_punch-statsd

Repository files navigation

SuckerPunch::Statsd

This gem makes it easy to use statsd with sucker_punch.

Installation

Add this line to your application's Gemfile:

gem 'sucker_punch-statsd'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sucker_punch-statsd

Usage

First, configure SuckerPunch::Statsd with a :client and optional :namespace.

SuckerPunch::Statsd.configure client: statsd_client, prefix: 'my_app'

Now, include the module in any job class that you want to measure

class LogJob
  include SuckerPunch::Job
  include SuckerPunch::Statsd

  # The perform method is automatically wrapped in a Statsd measure
  # block.
  def perform
    Log.new(event).track
  end
end

Configuration Arguments

The :client argument should be a Statsd instance that responds to a measure method. Any of the following should work:

The measure metrics produced by this gem will use the Job's class name as the metric name. The optional :namespace argument will be prepended to every metric name when this argument is provided.

License

The gem is available as open source under the terms of the MIT License.

It was built in my spare time to support my work at Knotch, where we help make brands smarter!

Code of Conduct

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

About

Seamlessly integrate statsd with your sucker_punch jobs

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published