Package com.newrelic.telemetry.events
Class EventBuffer
- java.lang.Object
-
- com.newrelic.telemetry.events.EventBuffer
-
public final class EventBuffer extends java.lang.Object
A buffer for collectingEvents
.One instance of this class can collect many
Events
. To send them to the Events API, callcreateBatch()
and thenEventBatchSender.sendBatch(EventBatch)
.
-
-
Constructor Summary
Constructors Constructor Description EventBuffer(Attributes commonAttributes)
Create a new buffer with the provided common set of attributes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEvent(Event event)
Append aEvent
to this buffer, to be sent in the nextEventBatch
.EventBatch
createBatch()
Creates a newEventBatch
from the contents of this buffer, then clears the contents of this buffer.boolean
equals(java.lang.Object o)
int
hashCode()
java.lang.String
toString()
-
-
-
Constructor Detail
-
EventBuffer
public EventBuffer(Attributes commonAttributes)
Create a new buffer with the provided common set of attributes.- Parameters:
commonAttributes
- These attributes will be appended (by the New Relic backend) to everyEvent
in this buffer.
-
-
Method Detail
-
addEvent
public void addEvent(Event event)
Append aEvent
to this buffer, to be sent in the nextEventBatch
.- Parameters:
event
- The newEvent
instance to be sent.
-
createBatch
public EventBatch createBatch()
Creates a newEventBatch
from the contents of this buffer, then clears the contents of this buffer.Events
added to this buffer by other threads during this method call will either be added to theEventBatch
being created, or will be saved for the nextEventBatch
.- Returns:
- A new
EventBatch
with an immutable collection ofEvents
.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-