Skip to content

Instantly share code, notes, and snippets.

package fieldsampler
import (
"github.com/honeycombio/beeline-go/sample"
)
const (
// CustomSampleRateFieldName is the field to use to override the default Sample Rate
CustomSampleRateFieldName = "CustomSampleRate"

Honeycomb Beeline Golang - Field Sampler

Usage:

// Configure it with a default sample rate
hook, err := fieldsampler.NewFieldSamplerHook(1)
if err != nil {
	log.Fatal(err)
}
(function() {
window.onerror = function(message, url, line, column) {
if (typeof url === "undefined" || url === null || url === "") {
return;
}
var data = JSON.stringify({
message: message,
url: url,
line: line,
@ngauthier
ngauthier / keybase.md
Created March 8, 2018 20:00
keybase.md

Keybase proof

I hereby claim:

  • I am ngauthier on github.
  • I am ngauthier (https://keybase.io/ngauthier) on keybase.
  • I have a public key ASDxB3I8Mq8d2GMauNlQdEGZKiu29cVrnz_zK6gLX-XU_go

To claim this, I am signing this object:

#!/usr/bin/env bash
set -e
USAGE="Usage: migrate <up|down|new|init>"
# http://www.postgresql.org/docs/9.5/static/libpq-envars.html
export PGDATABASE=${PGDATABASE:-meetspace}
cd `dirname $0`/../migrations
@ngauthier
ngauthier / README.md
Last active May 21, 2016 17:15
Gobridge Boston Day 1

Gobridge Boston Day 1

Hello and welcome to gobridge's day 1 content! The goal of this page is to guide you through the basics of programming in Go using the site Go by Example.

Please follow along with the class as we do each lesson, try not to skip ahead, and focus on the lesson we're on. If you finish early, play around by changing the code we're working with for the current lesson, or help a friend!

Lesson 1: Hello World

  1. Open https://gobyexample.com and click on the first link, "Hello World"
@ngauthier
ngauthier / Dockerfile
Last active March 21, 2016 18:10
GDG Docker App Example
FROM golang
ADD main.go ./
RUN go build -o greeter main.go
CMD ["./greeter"]
@ngauthier
ngauthier / Makefile
Created April 6, 2015 15:20
Minimum Viable Go Dependency Manager
build:
# get all the deps
go get -d -v -t ./...
# check out the library to the right ref
checkit github.com/myaccount/mylib abc123
# build stuff!
go build ./...
@ngauthier
ngauthier / timeout_and_tick.go
Created February 10, 2015 18:14
Golang timeout and tick loop
// keepDoingSomething will keep trying to doSomething() until either
// we get a result from doSomething() or the timeout expires
func keepDoingSomething() (bool, error) {
timeout := time.After(5 * time.Second)
tick := time.Tick(500 * time.Millisecond)
// Keep trying until we're timed out or got a result or got an error
for {
select {
// Got a timeout! fail with a timeout error
case <-timeout:
@ngauthier
ngauthier / build-container
Created February 2, 2015 15:28
Static Golang Container via Tar
#!/usr/bin/env bash
# Makes a docker container for a static golang application.
# For a small app, this container is usually about 7mb.
#
# Usage:
# build-container myapp myuser/myapp cmd/myapp/main.go
set -e
# Version is the git sha for HEAD
version=$(git log -1 --format=format:%H)