Skip to content

Instantly share code, notes, and snippets.

perform_action -> #<(NewRelic::Agent::Instrumentation::ControllerInstrumentation)#perform_action>
perform_action_without_benchmark -> #<(ActionController::Filters::InstanceMethods)#perform_action_without_benchmark>
perform_action_without_filters -> #<ActionController::Base#perform_action_without_filters>
perform_action_without_flash -> #<(ActionController::Rescue)#perform_action_without_flash>
perform_action_without_newrelic_trace -> #<(ActionController::Flash::InstanceMethods)#perform_action_without_newrelic_trace>
perform_action_without_rescue -> #<(ActionController::Benchmarking)#perform_action_without_rescue>
module Papertrail
module Zookeeper
module Convenience
def assign(key, value, options = {})
set(key, value, options)
rescue ZK::Exceptions::NoNode
begin
create(key, value, options)
rescue ZK::Exceptions::NodeExists
set(key, value, options)
@eric
eric / crash_a_187.rb
Created May 15, 2012 06:31
segfault in MRI 1.8.7 that I tracked down with @slyphon
require 'thread'
# This seems to crash 1.8.7
10.times { Thread.new { Queue.new.pop } }
Process.waitpid fork { GC.start; puts "In child: #{$$}" }
@eric
eric / _deploy.rb
Created May 29, 2012 06:00
Capistrano notification for Boundary
# load plugin
load 'boundary'
# Notify boundary with your orgid, apikey
boundary.register 'cdd7261592bca18539eae9bb5f1bcfdd', 'f9e6282c4727c5733585a4be86e0f990'
@eric
eric / cubism.papertrail.js
Created June 1, 2012 04:37
cubism.js source for Papertrail
/*
* Cubism source for Papertrail
* https://papertrailapp.com/
*/
cubism.context.prototype.papertrail = function(token) {
var source = {};
source.metric = function(expression, title) {
var lookup = {};
#
# Simple Boundary client
#
class BoundaryClient
def initialize(orgid, apikey)
@orgid = orgid
@apikey = apikey
end
@eric
eric / jobs.rb
Created July 16, 2012 19:17 — forked from ahoward/jobs.rb
./script/jobs
#!/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)
require 'lazy'
require 'system_timer'
class LibratoMetric
COUNT = 10
RESOLUTION = 1
def initialize(metric_name, timeout = 4)
@metric_name = metric_name
@timeout = timeout
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
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"