Skip to content

Latest commit

 

History

History
56 lines (42 loc) · 1.13 KB

README.md

File metadata and controls

56 lines (42 loc) · 1.13 KB

nrpush

Push custom New Relic Insight datasource in golang

Installation

import "github.com/reddotpay/nrpush"

Usage

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

type NRPush struct {
	Endpoint  string
	InsertKey string
	EventType string
}

NRPush represents an NewRelic Push data

func New

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 (NRPush) Push

func (n NRPush) Push(ctx context.Context, data interface{}) (string, error)

Push inserts a new custom data and return the UUID when successful

func (NRPush) PushBatch

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