NRInsights is a library for sending custom events to NewRelic Insights from a Go application. Documentation for this api can be found here
To send events, you need to create a client. You can create a global singleton client, or a client for a single calls
type Event struct {
EventType string `json:"eventType"`
EventName string `json:"eventName"`
Timestamp int64 `json:"timestamp"`
}
cfg := nrinsights.DefaultConfig
cfg.Endpoint = ts.URL
cfg.Token = "newrelic_token"
c, err := nrinsights.NewClient(cfg)
if err != nil {
log.Fatal(err)
}
message := Event{"EventCreation", "Foo", 1461097120}
c.Send(message)
The single test is in nr_test.go. You can run it with go test
This project is released under the unlicense