Documentation ¶
Overview ¶
Package events provides a programmatic API for creating custom events in New Relic.
Authentication ¶
You will need a valid Insights insert key to communicate with the backend New Relic API that provides this functionality. See the API key documentation below for more information on how to locate this key:
https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys
Index ¶
Constants ¶
const ( DefaultBatchWorkers = 1 DefaultBatchSize = 900 DefaultBatchTimeout = 60 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchConfigOption ¶ added in v0.35.0
func BatchConfigQueueSize ¶ added in v0.35.0
func BatchConfigQueueSize(size int) BatchConfigOption
BatchConfigQueueSize is how many events to queue before sending to New Relic. If this limit is hit before the Timeout, the queue is flushed.
func BatchConfigTimeout ¶ added in v0.35.0
func BatchConfigTimeout(seconds int) BatchConfigOption
BatchConfigTimeout is the maximum amount of time to queue events before sending to New Relic. If this is reached before the Size limit, the queue is flushed.
func BatchConfigWorkers ¶ added in v0.35.0
func BatchConfigWorkers(count int) BatchConfigOption
BatchConfigWorkers sets how many background workers will process events as they are queued
type Events ¶
type Events struct {
// contains filtered or unexported fields
}
Events is used to send custom events to NRDB.
func (*Events) BatchMode ¶ added in v0.35.0
func (e *Events) BatchMode(ctx context.Context, accountID int, opts ...BatchConfigOption) (err error)
BatchMode enables the Events client to accept, queue, and post Events on behalf of the consuming application
func (*Events) CreateEvent ¶
CreateEvent reports a custom event to New Relic.
func (*Events) EnqueueEvent ¶ added in v0.35.0
EnqueueEventContext handles the queueing. Only works in batch mode. If you wish to be able to avoid blocking forever until the event can be queued, provide a ctx with a deadline or timeout as this function will bail when ctx.Done() is closed and return and error.