Skip to content

Repository files navigation

Flipper::Echo

Build StatusGem VersionCode Climate

This gem adds a simple callback interface for Flipper adapter events.

For example, when a Flipper feature is changed, you can:

  • send a Slack notification (built-in)
  • write the change to a database or log file
  • notify a performance monitoring application
  • send a YO

Installation

Add this line to your application's Gemfile:

gem'flipper-echo'

And then execute:

$ bundle

Or install it yourself as:

$ gem install flipper-echo

Usage

First, configure Flipper as you normally would (any adapter will do), e.g.:

FLIPPER=Flipper.new(Flipper::Adapters::Memory.new)

Then configure this gem in any of the following ways:

Handle event with a proc

Flipper::Echo.configuredo |config|
config.flipper=FLIPPERconfig.notifier=procdo |event|
# Do something with the event...#puts"#{event.feature.name} changed: #{event.action}"endend

Handle event with an object

You can provide any Ruby object with a notify method:

classCustomNotifierdefnotify(event)# Do something with the event...endendFlipper::Echo.configuredo |config|
config.flipper=FLIPPERconfig.notifier=CustomNotifier.newend

Configure multiple notifiers

Flipper::Echo.configuredo |config|
config.flipper=FLIPPERconfig.notifiers << NewrelicNotifier.newconfig.notifiers << GraphiteNotifier.newconfig.notifiers << Flipper::Echo::Stdout::Notifier.newend

Built-in notifiers

Slack

First create a Slack webhook url, then use it in your configuration:

Flipper::Echo.configuredo |config|
config.notifiers << Flipper::Echo::Slack::Notifier.new('https://hooks.slack.com/your/webhook...',channel: '#eng')end

Slack example 1

Slack example 2

Slack example 3

Documentation

http://www.rubydoc.info/github/mode/flipper-echo/master

Contributing

  1. Fork it ( https://github.com/mode/flipper-echo/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Actual screenshots

Newrelic example 1

About

Extensible event notifier for Flipper gem

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages