Skip to content

Instantly share code, notes, and snippets.

View dkuebric's full-sized avatar

Dan Kuebrich dkuebric

View GitHub Profile
@dkuebric
dkuebric / gist:4198006
Created December 3, 2012 21:02
oboeware os x patch
diff --git a/oboe/__init__.py b/oboe/__init__.py
index ab4d176..45f7a2d 100644
--- a/oboe/__init__.py
+++ b/oboe/__init__.py
@@ -3,8 +3,6 @@
Copyright (C) 2012 by Tracelytics, Inc.
All rights reserved.
"""
-from oboe_ext import Context as SwigContext, Event as SwigEvent, UdpReporter, Metadata
-
@dkuebric
dkuebric / gist:4198011
Created December 3, 2012 21:03
oboe_noop
""" Tracelytics instrumentation API for Python.
Copyright (C) 2012 by Tracelytics, Inc.
All rights reserved.
"""
# defines no-op classes for platforms we don't support building the c extension on
class Metadata(object):
def __init__(self, _=None):
pass
@dkuebric
dkuebric / gist:4198795
Created December 3, 2012 22:40
python - custom post instrumentation
try:
import oboe
except ImportError, e
pass
...
if 'oboe' in sys.modules:
oboe.log('info', None, keys={'Post-length': len(my_post_field), 'Post-data': my_post_field[0:256]})
@dkuebric
dkuebric / gist:4540626
Last active December 11, 2015 03:49
test gist
import requests
requests.get("WABSITE 3.0")
@dkuebric
dkuebric / rg_dyno_sim.R
Last active December 14, 2015 00:09 — forked from toddwschneider/rg_dyno_sim.R
updated to generate+plot series comparing different #s of workers/node
run_simulation = function(router_mode = "naive",
reqs_per_minute = 9000,
simulation_length_in_minutes = 5,
dyno_count = 100,
choice_of_two = FALSE,
power_of_two = FALSE,
unicorn_workers_per_dyno = 0,
track_dyno_queues = FALSE) {
if(!(router_mode %in% c("naive", "intelligent"))) {
@dkuebric
dkuebric / gist:5079655
Created March 4, 2013 03:15
RUM wrapper
/**
* Wraps RUM methods using reflection.
* (works even if RUM classes are unavailable.)
*/
import java.lang.reflect.Method;
public class RUMWrapper {
@dkuebric
dkuebric / LICENSE.txt
Created April 1, 2013 14:25
LICENSE.txt
* This software includes portions of Javassist from
http://www.csg.ci.i.u-tokyo.ac.jp/~chiba/javassist/ under the Apache
License, Version 2.0. A copy of the Apache License is included with
this distribution in the file Apache-2.0.txt.
* This software includes portions of the Google Guava Libraries from
http://code.google.com/p/guava-libraries/ under the Apache License,
Version 2.0. A copy of the Apache License is included with this
distribution in the file Apache-2.0.txt.
@dkuebric
dkuebric / gist:5301243
Created April 3, 2013 13:33
sampling stats
import math
import matplotlib
import matplotlib.pyplot as plt
def confidence_for_sampling(pop_size=1000, con_level=0.99, sample_rate=0.1):
if con_level not in (0.99, 0.95):
raise Exception("don't know those zvals")
zval = 1.96 if con_level == 0.95 else 2.58
variance = (pop_size * sample_rate) * (1 - sample_rate)
@dkuebric
dkuebric / trace.py
Created May 13, 2013 18:49
starting tracing in python code
import oboe
from oboeware import loader
# load monkey-patched instrumentation for supported modules
loader.load_inst_modules()
# say this is the entry point for your mod_python code
def handle_request(headers, **other_stuff):
# start a trace based on incoming X-Trace HTTP header from Apache/nginx if available
oboe.start_trace('mod_python', xtr=headers['X-Trace'])
@dkuebric
dkuebric / solarium patch.php
Last active December 19, 2015 01:48
quick patch to provide tracing coverage to Solarium
<?php
public function execute($request, $endpoint)
{
if (is_callable('oboe_log')) {
oboe_log('Solarium', 'entry', array('IsService'=>'1'));
}
$client = $this->getZendHttp();
$client->resetParameters();