Code Monkey home page Code Monkey logo

flipper-echo's Introduction

Flipper::Echo

Build Status Gem Version Code 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.configure do |config|
  config.flipper = FLIPPER

  config.notifier = proc do |event|
    # Do something with the event...
    #
    puts "#{event.feature.name} changed: #{event.action}"
  end
end

Handle event with an object

You can provide any Ruby object with a notify method:

class CustomNotifier
  def notify(event)
    # Do something with the event...
  end
end

Flipper::Echo.configure do |config|
  config.flipper  = FLIPPER
  config.notifier = CustomNotifier.new
end

Configure multiple notifiers

Flipper::Echo.configure do |config|
  config.flipper = FLIPPER

  config.notifiers << NewrelicNotifier.new
  config.notifiers << GraphiteNotifier.new
  config.notifiers << Flipper::Echo::Stdout::Notifier.new
end

Built-in notifiers

Slack

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

Flipper::Echo.configure do |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

flipper-echo's People

Contributors

rivers avatar veganstraightedge avatar amancevice avatar agnieszkaabgarozachariasiewicz avatar rtlechow avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.