Push custom New Relic Insight datasource in golang
import "github.com/reddotpay/nrpush"
const Endpoint = "https://insights-collector.newrelic.com/v1/accounts/{:accountID}/events"
Endpoint defines the New Relic HTTP URL where the payload will be sent
var (
// Verbose indicates if details of the HTTP request will be displayed
Verbose = false
)
type NRPush struct {
Endpoint string
InsertKey string
EventType string
}
NRPush represents an NewRelic Push data
func New(insertKey, accountID, eventType string) NRPush
New creates sets a new NRPush configuration. accountID
numeric. Can be found
as part of the URL endpoint in Insigts dashboard
func (n NRPush) Push(ctx context.Context, data interface{}) (string, error)
Push inserts a new custom data and return the UUID when successful
func (n NRPush) PushBatch(ctx context.Context, data []interface{}) (string, error)
PushBatch inserts a batch of new custom data and return the UUID when successful