You can now find this packaged up nicely in a rubygem as rollout-zk.
I've implemented a zookeeper-based storage adapter for [rollout][] that does not require any network roundtrips to check if a feature is active for a user.
You can now find this packaged up nicely in a rubygem as rollout-zk.
I've implemented a zookeeper-based storage adapter for [rollout][] that does not require any network roundtrips to check if a feature is active for a user.
| class Scheduler < Rufus::Scheduler::PlainScheduler | |
| def initialize(zk, *args) | |
| super(*args) | |
| @zk_locker = zk.exclusive_locker('scheduler') | |
| end | |
| def run | |
| @zk_locker.with_lock do | |
| configure |
| Installing hitimes (1.1.1) with native extensions | |
| Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. | |
| /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb | |
| creating Makefile | |
| make | |
| xcrun cc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -DUSE_INSTANT_OSX=1 -Wall -c hitimes_ext.c | |
| xcrun cc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -DUSE_INSTANT_OSX=1 -Wall -c hiti |
| module Zookeeper | |
| class BroadcastTrigger | |
| def initialize(zk, path) | |
| @zk = zk | |
| @path = path | |
| end | |
| def trigger | |
| @zk.set(@path, "#{$$}") | |
| rescue ZK::Exceptions::NoNode |
| God.watch do |w| | |
| w.name = 'remote_syslog' | |
| w.interval = 7.seconds | |
| w.log = File.join(RAILS_ROOT, 'log', "#{w.name}-god.log") | |
| w.dir = RAILS_ROOT | |
| w.start = "bundle exec remote_syslog --tls -D -c #{RAILS_ROOT}/config/remote_syslog.yml" |
| namespace :redis_failover do | |
| task :monitor_client do | |
| require 'redis_failover' | |
| zookeepers = ENV['ZOOKEEPERS'] | |
| if !zookeepers && zookeepers_file = ENV['ZOOKEEPERS_FILE'] | |
| if File.exists?(zookeepers_file) | |
| zookeepers = File.read(zookeepers_file).chomp | |
| end |
| require 'lazy' | |
| require 'system_timer' | |
| class LibratoMetric | |
| COUNT = 10 | |
| RESOLUTION = 1 | |
| def initialize(metric_name, timeout = 4) | |
| @metric_name = metric_name | |
| @timeout = timeout |
| #!/usr/bin/env ruby | |
| # encoding: utf-8 | |
| # setup | |
| # | |
| require 'fileutils' | |
| script = File.expand_path(__FILE__).gsub(%r|\breleases/\d+\b|, 'current') | |
| script_dir = File.dirname(script) | |
| rails_root = File.dirname(script_dir) |
| # | |
| # Simple Boundary client | |
| # | |
| class BoundaryClient | |
| def initialize(orgid, apikey) | |
| @orgid = orgid | |
| @apikey = apikey | |
| end |
| /* | |
| * Cubism source for Papertrail | |
| * https://papertrailapp.com/ | |
| */ | |
| cubism.context.prototype.papertrail = function(token) { | |
| var source = {}; | |
| source.metric = function(expression, title) { | |
| var lookup = {}; |