tunnelRelic allows you to register/create/send custom events and custom attributes to New Relic Insights. Multiple tunnels (events) can be created to send events to different Insights events.
You'll need: New Relic Account # Insights API key
Both pieces of information are found here -> https://insights.newrelic.com/accounts/YOUR_ACCOUNT_NUM/manage/api_keys
Usage flow is drop-dead simple. Create tunnel -> send events to a tunnel -> we'll send them along to New Relic
gopherTunnel := tunnelRelic.NewTunnel(myAccount, myAPIKey, myTunnelName, flushInterval, bufferLimit)
flushInterval int //How often should we send queued events?
bufferLimit int //Ignore interval if we reach this many events in the queue
myAPIKey string //An insert key from the API keys tab of Insights
myAccount string //Your numberical New Relic account
myTunnelName string //Name of the event you're registering
Events can be resused/modified, and do not need to be allocated each time you want to register an event.
anEvent := gopherTunnel.NewTransaction()
anEvent["key"] = "value"
anEvent["Dammit"] = "Yoyo"
gopherTunnel.RegisterEvent(anEvent)
Events sent to Insights are fully queryable/pullable through the Insights product.
package main
import (
"./src"
)
func main() {
//create tunnelRelic
myAccount := "123"
myAPIKey := "456"
myTunnelName := "Purchase"
flushInterval := 60
bufferLimit := 15
tunnel := tunnelRelic.NewTunnel(myAccount, myAPIKey, myTunnelName, flushInterval, bufferLimit)
//Create sample event (can be reused)
anEvent := tunnelRelic.NewTransaction()
anEvent["key"] = "value"
anEvent["Dammit"] = "Yoyo"
//send event
tunnel.RegisterEvent(anEvent)
}
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Verbose logging on/off Multiple events in single post