Package com.newrelic.telemetry.events
Class EventBuffer
- java.lang.Object
-
- com.newrelic.telemetry.events.EventBuffer
-
public final class EventBuffer extends java.lang.ObjectA 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 voidaddEvent(Event event)Append aEventto this buffer, to be sent in the nextEventBatch.EventBatchcreateBatch()Creates a newEventBatchfrom the contents of this buffer, then clears the contents of this buffer.booleanequals(java.lang.Object o)inthashCode()intsize()Get the size of theEventsbuffer.java.lang.StringtoString()
-
-
-
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 everyEventin this buffer.
-
-
Method Detail
-
addEvent
public void addEvent(Event event)
Append aEventto this buffer, to be sent in the nextEventBatch.- Parameters:
event- The newEventinstance to be sent.
-
createBatch
public EventBatch createBatch()
Creates a newEventBatchfrom the contents of this buffer, then clears the contents of this buffer.Eventsadded to this buffer by other threads during this method call will either be added to theEventBatchbeing created, or will be saved for the nextEventBatch.- Returns:
- A new
EventBatchwith an immutable collection ofEvents.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-