public class SpanEventsServiceImpl extends AbstractService implements AgentConfigListener, SpanEventsService, TransactionListener
SpanEventsServiceImpl collects span events and transmits them to the collectors.
Ideally, all span events are stored until harvest and then transmitted. If the number of events exceeds a configurable limit, events are replaced using a "reservoir" priority sampling algorithm.
This service can be configured using span_events with enabled or max_samples_stored.
| Modifier and Type | Class and Description |
|---|---|
static class |
SpanEventsServiceImpl.Builder |
logger| Constructor and Description |
|---|
SpanEventsServiceImpl(SpanEventsServiceImpl.Builder builder) |
| Modifier and Type | Method and Description |
|---|---|
void |
addHarvestableToService(java.lang.String appName) |
static SpanEventsServiceImpl.Builder |
builder() |
void |
clearReservoir()
Reset the event reservoir to allow for the next harvest to start
|
void |
configChanged(java.lang.String appName,
AgentConfig agentConfig) |
void |
dispatcherTransactionFinished(TransactionData transactionData,
TransactionStats transactionStats)
Called after a dispatcher transaction finishes on the request thread.
|
protected void |
doStart() |
protected void |
doStop() |
java.lang.String |
getEventHarvestIntervalMetric()
Returns the metric name for this service that records the actual interval in which the harvest is happening.
|
java.lang.String |
getEventHarvestLimitMetric()
Returns the metric name for this service that records the harvest limit.
|
int |
getMaxSamplesStored()
Returns the current limit of events to store per harvest interval.
|
com.newrelic.agent.interfaces.SamplingPriorityQueue<com.newrelic.agent.model.SpanEvent> |
getOrCreateDistributedSamplingReservoir(java.lang.String appName) |
java.lang.String |
getReportPeriodInSecondsMetric()
Returns the metric name for this service that records the expected report period.
|
void |
harvestEvents(java.lang.String appName)
Perform the harvest of any pending events right now.
|
boolean |
isEnabled()
Is the service enabled.
|
void |
setMaxSamplesStored(int maxSamplesStored)
For the setting to take effect, the reservoir must be re-created.
|
void |
storeEvent(com.newrelic.agent.model.SpanEvent event) |
getLogger, getName, isStarted, isStartedOrStarting, isStopped, isStoppedOrStopping, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLogger, getName, isStarted, isStartedOrStarting, isStopped, isStoppedOrStopping, start, stoppublic SpanEventsServiceImpl(SpanEventsServiceImpl.Builder builder)
public void dispatcherTransactionFinished(TransactionData transactionData, TransactionStats transactionStats)
TransactionListenerdispatcherTransactionFinished in interface TransactionListenertransactionData - the final data from the transactiontransactionStats - the final metric information from the transactionpublic void harvestEvents(java.lang.String appName)
EventServiceharvestEvents in interface EventServiceappName - the application to harvest forpublic java.lang.String getEventHarvestIntervalMetric()
EventServicegetEventHarvestIntervalMetric in interface EventServicepublic java.lang.String getReportPeriodInSecondsMetric()
EventServicegetReportPeriodInSecondsMetric in interface EventServicepublic java.lang.String getEventHarvestLimitMetric()
EventServicegetEventHarvestLimitMetric in interface EventServicepublic boolean isEnabled()
Serviceprotected void doStart()
throws java.lang.Exception
doStart in class AbstractServicejava.lang.Exceptionprotected void doStop()
throws java.lang.Exception
doStop in class AbstractServicejava.lang.Exceptionpublic void storeEvent(com.newrelic.agent.model.SpanEvent event)
storeEvent in interface SpanEventsServicepublic int getMaxSamplesStored()
EventServicegetMaxSamplesStored in interface EventServicepublic void setMaxSamplesStored(int maxSamplesStored)
setMaxSamplesStored in interface EventServicemaxSamplesStored - the new maximum number of events to store per harvest interval.public void clearReservoir()
EventServiceclearReservoir in interface EventServicepublic void addHarvestableToService(java.lang.String appName)
addHarvestableToService in interface SpanEventsServicepublic void configChanged(java.lang.String appName,
AgentConfig agentConfig)
configChanged in interface AgentConfigListenerpublic com.newrelic.agent.interfaces.SamplingPriorityQueue<com.newrelic.agent.model.SpanEvent> getOrCreateDistributedSamplingReservoir(java.lang.String appName)
getOrCreateDistributedSamplingReservoir in interface SpanEventsServicepublic static SpanEventsServiceImpl.Builder builder()