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
package log | |
import ( | |
"io" | |
libhoney "github.com/honeycombio/libhoney" | |
) | |
type hnyLogger struct { | |
} |
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
#!/bin/bash | |
num=$(grep playver index.py | grep -E -o '[0-9]+') | |
newnum=$((num+1)) | |
echo https://s3.amazonaws.com/mybucket/testlambda/archive${newnum}.zip | |
sed -i -e "s/= ${num}$/= ${newnum}/" index.py | |
python make-archive.py | |
aws s3 cp archive.zip s3://mybucket/testlambda/archive${newnum}.zip | |
aws lambda update-function-code --function-name testlambda_playground --s3-bucket mybucket --s3-key testlambda/archive${newnum}.zip |
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
wk = node[:honeycomb][:writekey] | |
n = node | |
Chef.event_handler do | |
Chef::Client.when_run_completes_successfully {|run_status| @handler.instance_variable_set(:@run_status, run_status) } | |
Chef::Client.when_run_fails {|run_status| @handler.instance_variable_set(:@run_status, run_status) } | |
::Honeycomb.init(wk) | |
on :run_completed do | |
puts "run_completed handler" |
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
require "net/http" | |
require "uri" | |
require "openssl" | |
require "json" | |
class Honeycomb | |
def self.report(run_status) | |
api_data = { | |
"node.name" => run_status.node.name, | |
"start_time" => run_status.start_time, |
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
require 'sinatra' | |
require 'libhoney' | |
configure do | |
set :honeycomb, Libhoney::Client.new(writekey: "abc123redacteddef456", dataset: 'rubytest') | |
end | |
before do | |
@ev = settings.honeycomb.event() | |
@ev.add_field("url", request.url) |
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
require 'libhoney' | |
honeycomb = Libhoney::Client.new(writekey: "abc123redacteddef456", dataset: 'rubytest') | |
data = {} | |
data[:test] = "Data!" | |
honeycomb.send_now(data) | |
honeycomb.close(true) |
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
func (a *App) ServeHTTP(writer http.ResponseWriter, request *http.Request) { | |
// we wrap the writer to gain access to the status field later | |
w := api.NewResponseWrapper(writer) | |
builder := libhoney.NewBuilder() | |
// we wrap libhoney in an interface to abstract events vs. builders | |
hnyWrapper := &libhoneyWrapper{builder: builder} | |
// Embed the libhoney wrapper in a context to give the rest of the code access | |
ctx := context.WithValue(request.Context(), CtxKeyLibhoney, hnyWrapper) | |
r := request.WithContext(ctx) |
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
aoeu | |
aoeu | |
aoeu | |
oaeuaoeu |
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
➜ go run main.go | |
0: `foo=bar` // correct | |
(map[string]interface {}) (len=1) { | |
(string) (len=3) "foo": (string) (len=3) "bar" | |
} | |
1: `foo=bar baz=3 fl=3.1415926535 bl=true` // correct | |
(map[string]interface {}) (len=4) { | |
(string) (len=2) "bl": (bool) true, | |
(string) (len=3) "foo": (string) (len=3) "bar", | |
(string) (len=3) "baz": (int) 3, |
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
package main | |
import ( | |
"fmt" | |
"strconv" | |
"github.com/davecgh/go-spew/spew" | |
"github.com/kr/logfmt" | |
) |