This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mechanize | |
import urllib | |
BASE_URL = 'http://my-reddit' | |
THREAD = BASE_URL + '/r/reddit/particular-thread' | |
class Transaction(object): | |
def __init__(self): | |
self.user = 'redditor' | |
self.pass = 'password' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import oboe | |
import pickle | |
import time | |
import zmq | |
def instrumented_rpc(socket, message): | |
""" Example instrumented RPC method.""" | |
keys = {'IsService': True, 'RemoteURL': 'tcp://localhost:5556'} | |
oboe.log_entry('RPC-Client', keys=keys) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import oboe | |
import pickle | |
import time | |
import zmq | |
def run_server(): | |
print('Distributed tracing server: receive request, sleep, reply') | |
zmq_context = zmq.Context() | |
socket = zmq_context.socket(zmq.REP) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function execute($request, $endpoint) | |
{ | |
if (is_callable('oboe_log')) { | |
oboe_log('Solarium', 'entry', array('IsService'=>'1')); | |
} | |
$client = $this->getZendHttp(); | |
$client->resetParameters(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Wraps RUM methods using reflection. | |
* (works even if RUM classes are unavailable.) | |
*/ | |
import java.lang.reflect.Method; | |
public class RUMWrapper { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"))) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
requests.get("WABSITE 3.0") |
NewerOlder