public class LogSenderServiceImpl extends AbstractService implements LogSenderService
| Modifier and Type | Class and Description |
|---|---|
static class |
LogSenderServiceImpl.TransactionLogs
Used to record LogEvents on Transactions
|
| Modifier and Type | Field and Description |
|---|---|
protected AgentConfigListener |
configListener
Listener to detect changes to the agent config
|
static java.lang.String |
LOG_SENDER_SERVICE |
static java.lang.String |
METHOD |
protected ExtendedTransactionListener |
transactionListener
Lifecycle listener for log events associated with a transaction
|
logger| Constructor and Description |
|---|
LogSenderServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addHarvestableToService(java.lang.String appName)
Register LogSenderHarvestable
|
void |
clearReservoir()
Reset the event reservoir to allow for the next harvest to start
|
void |
clearReservoir(java.lang.String appName) |
protected void |
doStart()
Start the LogSenderService
|
protected void |
doStop()
Stop the LogSenderService
|
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.
|
java.lang.String |
getReportPeriodInSecondsMetric()
Returns the metric name for this service that records the expected report period.
|
DistributedSamplingPriorityQueue<com.newrelic.agent.model.LogEvent> |
getReservoir(java.lang.String appName)
Get the LogEvent reservoir
|
com.newrelic.api.agent.Logs |
getTransactionLogs(AgentConfig config)
Returns an insights instance used to track events created during a transaction.
|
void |
harvestEvents(java.lang.String appName)
Harvest and send the LogEvents
|
void |
harvestHarvestables() |
void |
harvestPendingEvents() |
boolean |
isEnabled()
Whether the LogSenderService is enabled or not
|
void |
recordApplicationLoggingSupportabilityMetrics(boolean forwardingEnabled,
boolean metricsEnabled,
boolean localDecoratingEnabled,
boolean logLabelsEnabled) |
void |
recordLogEvent(java.util.Map<com.newrelic.agent.bridge.logging.LogAttributeKey,?> attributes)
Records a LogEvent.
|
void |
setMaxSamplesStored(int maxSamplesStored)
Update the current limit of events to store per harvest interval.
|
void |
setReportPeriodInMillis(long reportPeriodInMillis)
Update the reporting period for harvesting, in case it is needed for config changes.
|
void |
storeEvent(java.lang.String appName,
com.newrelic.agent.model.LogEvent event)
Store a LogEvent instance
|
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 static final java.lang.String METHOD
public static final java.lang.String LOG_SENDER_SERVICE
protected final ExtendedTransactionListener transactionListener
protected final AgentConfigListener configListener
public void recordApplicationLoggingSupportabilityMetrics(boolean forwardingEnabled,
boolean metricsEnabled,
boolean localDecoratingEnabled,
boolean logLabelsEnabled)
public boolean isEnabled()
protected void doStart()
throws java.lang.Exception
doStart in class AbstractServicejava.lang.Exception - if service fails to startprotected void doStop()
throws java.lang.Exception
doStop in class AbstractServicejava.lang.Exception - if service fails to stoppublic void recordLogEvent(java.util.Map<com.newrelic.agent.bridge.logging.LogAttributeKey,?> attributes)
recordLogEvent in interface com.newrelic.api.agent.Logsattributes - A map of log event data (e.g. log message, log timestamp, log level)
Each key should be a String and each value should be a String, Number, or Boolean.
For map values that are not String, Number, or Boolean object types the toString value will be used.public void addHarvestableToService(java.lang.String appName)
addHarvestableToService in interface LogSenderServiceappName - application namepublic int getMaxSamplesStored()
EventServicegetMaxSamplesStored in interface EventServicepublic void setMaxSamplesStored(int maxSamplesStored)
EventServicesetMaxSamplesStored in interface EventServicemaxSamplesStored - the new maximum number of events to store per harvest interval.public void setReportPeriodInMillis(long reportPeriodInMillis)
EventServicesetReportPeriodInMillis in interface EventServicereportPeriodInMillis - the number of millis between reporting/harvesting cyclespublic void clearReservoir()
EventServiceclearReservoir in interface EventServicepublic void clearReservoir(java.lang.String appName)
public void harvestHarvestables()
public void harvestPendingEvents()
public void storeEvent(java.lang.String appName,
com.newrelic.agent.model.LogEvent event)
storeEvent in interface LogSenderServiceappName - application nameevent - log eventpublic DistributedSamplingPriorityQueue<com.newrelic.agent.model.LogEvent> getReservoir(java.lang.String appName)
appName - app namepublic void harvestEvents(java.lang.String appName)
harvestEvents 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 com.newrelic.api.agent.Logs getTransactionLogs(AgentConfig config)
LogSenderServicegetTransactionLogs in interface LogSenderService