Skip to content

Instantly share code, notes, and snippets.

@adam-hert
adam-hert / data.py
Last active August 2, 2017 16:36
Custom instrumentation - python
import oboe,time,urllib,urllib2,random,numpy
from scipy.stats import stats
#import the loader so modules get instrumented
from oboeware import loader
loader.load_inst_modules()
#set trace mode and start a trace
oboe.config['tracing_mode'] = 'always'
trace = oboe.start_trace('Python', keys=None, xtr=None)
@adam-hert
adam-hert / php.sh
Created July 25, 2017 21:40
Install script for PHP5.6 on Ubuntu16
#Download correct binary
wget http://files.tv.solarwinds.com/php/php-oboe-20131226-x86_64.so -O /usr/lib/php/20131226/oboe.so
#set permissions
chmod 644 /usr/lib/php/20131226/oboe.so
#Create ini file
echo "extension=oboe.so
[oboe]
oboe.tracing = through
<?php
oboe_log(null, 'info', array('Controller' => 'My_controller','Action' => 'my_action'));
// connect
$m = new Mongo();
// select a database
$db = $m->training;
$coll = $db->messages;
for ($i = 0; $i < 10; $i = $i + 1) {
$coll->insert( array( "text" => "Hello World", "n" => $i ) );
@adam-hert
adam-hert / docker-compose.yaml
Created June 14, 2017 19:01
logspout only stderr
demo.papertrail:
image: gliderlabs/logspout
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command:
syslog://logs5.papertrailapp.com:xxxx?filter.sources=stderr
var winston = require('winston');
require('winston-papertrail').Papertrail
const winstonConsole = new winston.transports.Console()
const winstonPapertrail = new winston.transports.Papertrail({
host: 'logs5.papertrailapp.com',
port: xxxx,
flushOnClose: true,
})
@adam-hert
adam-hert / server.js
Last active June 12, 2017 22:33
winston and buffers
var winston = require('winston');
require('winston-papertrail').Papertrail
const winstonConsole = new winston.transports.Console()
const winstonPapertrail = new winston.transports.Papertrail({
host: 'logs5.papertrailapp.com',
port: xxxx,
flushOnClose: true,
})
@adam-hert
adam-hert / trace.js
Created June 2, 2017 18:44
hapi + traceview
'use strict';
var tv = require('traceview');
tv.traceMode = 'always';
const Hapi = require('hapi');
const server = new Hapi.Server();
server.connection({ port: 3000, host: 'localhost' });
server.route({
method: 'GET',
@adam-hert
adam-hert / server.js
Created May 25, 2017 21:07
Adding info to exceptions in Winston
var http = require('http');
var winston = require('winston');
require('winston-papertrail').Papertrail;
var winstonPapertrail = new winston.transports.Papertrail({
host: 'logs.papertrailapp.com', //change to match your destination
port: xxxxx, //change to match your port
program: 'my_node_app'
})
@adam-hert
adam-hert / docker-compose.yml
Created May 11, 2017 19:21
Logspout + setting the hostname
version: '2'
services:
example-service:
build:
dockerfile: Dockerfile
context: php/
container_name: example.php-service
ports:
- 3333:3000