Skip to content

Instantly share code, notes, and snippets.

@woodsaj
woodsaj / ping.go
Created September 11, 2020 10:37
Example usage of github.com/woodsaj/go-pinger
package main
import (
"fmt"
"log"
"net"
"os"
"os/signal"
"strings"
"sync"
@woodsaj
woodsaj / walk_tree.py
Last active December 17, 2019 08:51
Walk graphite metrics tree from specified prefix
#!/usr/bin/python
from __future__ import print_function
import requests
import json
import argparse
try:
from Queue import Queue
except:
@woodsaj
woodsaj / generate-HAR.md
Created November 6, 2018 04:57
Instructions for generating HAR files with Chrome or Firefox

How to generate a HAR file in Chrome

Start by opening Google Chrome.

  • In Chrome, go to the page within our application where you are experiencing trouble

  • Select the Chrome menu (⋮) at the top-right of your browser window, then select Tools > Developer Tools.

  • The Developer Tools will open as a docked panel at the side or bottom of Chrome. Click on the Network tab.

  • Select the option Preserve log (at the top of the panel)

@woodsaj
woodsaj / lock_test.go
Created September 19, 2018 07:40
Benchmark to compare shared locks vs per-thread locks
package input
import (
"fmt"
"sync"
"testing"
)
// simple datastruct to provide a lock around an int variable
type Data struct {
@woodsaj
woodsaj / goroutines.txt
Created December 6, 2017 19:32
MT instance not consuming
goroutine 48039790 [running]:
runtime/pprof.writeGoroutineStacks(0x7f51e32857f8, 0xc423a2e700, 0x30, 0xc42cb497a0)
/usr/local/go/src/runtime/pprof/pprof.go:603 +0x79
runtime/pprof.writeGoroutine(0x7f51e32857f8, 0xc423a2e700, 0x2, 0xc466d92570, 0x40fdb8)
/usr/local/go/src/runtime/pprof/pprof.go:592 +0x44
runtime/pprof.(*Profile).WriteTo(0x105b820, 0x7f51e32857f8, 0xc423a2e700, 0x2, 0xc423a2e700, 0xc466d927a0)
/usr/local/go/src/runtime/pprof/pprof.go:302 +0x3b5
net/http/pprof.handler.ServeHTTP(0xc42cb493f1, 0x9, 0x7f51e1da60b0, 0xc423a2e700, 0xc432ecd600)
/usr/local/go/src/net/http/pprof/pprof.go:209 +0x1d1
net/http/pprof.Index(0x7f51e1da60b0, 0xc423a2e700, 0xc432ecd600)
@woodsaj
woodsaj / test.py
Last active November 30, 2017 09:53
bufferedHTTPResonse
import sys
sys.path.append('/opt/graphite/webapp')
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'graphite.settings')
from graphite.http_pool import http
from graphite.util import unpickle
import time
import io
now = int(time.time())
@woodsaj
woodsaj / tsdb-gw.txt
Created September 18, 2017 10:11
tsdb-gw panic
fatal error: concurrent map iteration and map write
2017/09/17 17:40:37 [I] graphiteProxy: request to graphite-17303-medium-wix:8080 failed, will retry: context canceled
goroutine 21921 [running]:
runtime.throw(0x9ad065, 0x26)
/usr/local/go/src/runtime/panic.go:596 +0x95 fp=0xc4206a29e0 sp=0xc4206a29c0
runtime.mapiternext(0xc4206a2ba0)
/usr/local/go/src/runtime/hashmap.go:737 +0x7ee fp=0xc4206a2a90 sp=0xc4206a29e0
runtime.mapiterinit(0x958d80, 0xc421196030, 0xc4206a2ba0)
/usr/local/go/src/runtime/hashmap.go:727 +0x2b3 fp=0xc4206a2ae8 sp=0xc4206a2a90
package main
import (
"context"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"strconv"
@woodsaj
woodsaj / carbon-relay-ng-on-prem.ini
Last active August 9, 2017 16:41
Sovrn HostedMetrics
## Global settings ##
instance = "on-prem"
max_procs = 4
spool_dir = "spool"
pid_file = "carbon-relay-ng.pid"
## Logging ##
# one of critical error warning notice info debug
# see docs/logging.md for level descriptions
package api
import (
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
"time"
"github.com/raintank/metrictank/cluster"