github.com/randomtask1155/cli@v6.41.1-0.20181227003417-a98eed78cbde+incompatible/integration/helpers/reporters.go (about) 1 package helpers 2 3 import ( 4 "os" 5 6 "github.com/cloudfoundry/custom-cats-reporters/honeycomb" 7 "github.com/cloudfoundry/custom-cats-reporters/honeycomb/client" 8 libhoney "github.com/honeycombio/libhoney-go" 9 ginkgo "github.com/onsi/ginkgo" 10 ) 11 12 func GetHoneyCombReporter(suiteName string) ginkgo.Reporter { 13 writeKey := os.Getenv("HONEYCOMB_WRITE_KEY") 14 dataset := os.Getenv("HONEYCOMB_DATASET") 15 if writeKey == "" || dataset == "" { 16 println("No HONEYCOMB writekey found. Will not log any requests") 17 return nil 18 } 19 20 honeyCombClient := client.New(libhoney.Config{ 21 WriteKey: writeKey, 22 Dataset: dataset, 23 }) 24 25 honeyCombReporter := honeycomb.New(honeyCombClient) 26 globalTags := map[string]interface{}{ 27 "RunID": os.Getenv("RUN_ID"), 28 "API": GetAPI(), 29 "SuitID": suiteName, 30 } 31 32 honeyCombReporter.SetGlobalTags(globalTags) 33 return honeyCombReporter 34 }