Package ch.rswk.meta.engine
Class LoggingService
java.lang.Object
com.google.common.util.concurrent.AbstractIdleService
ch.rswk.meta.engine.AbstractEngineIdleService<LoggingService.LoggingServiceConfig>
ch.rswk.meta.engine.LoggingService
- All Implemented Interfaces:
EngineServices.ConfigurableService<LoggingService.LoggingServiceConfig>
,EngineServices.InfoProvidingService
,com.google.common.util.concurrent.Service
@Singleton
public class LoggingService
extends AbstractEngineIdleService<LoggingService.LoggingServiceConfig>
LoggingService for storing and searching for logs and metrics. Uses a
LuceneService
instance to store logging data.
Attatches to SLF4J root logger and persists entries Level.INFO
and above on the server side. Clients can use
Logging
or meta-client/logging
module to persist client data as well.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
static final record
static final record
static final record
Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service
com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
private static final String
static final Duration
private static final String
private com.codahale.metrics.Meter
private ch.qos.logback.core.UnsynchronizedAppenderBase
<ch.qos.logback.classic.spi.ILoggingEvent> private static final String
private static final Protocol.ErrorReplyFactory
private com.codahale.metrics.Meter
private final GatewayService
private static final org.slf4j.Logger
private com.codahale.metrics.Meter
private static final com.fasterxml.jackson.databind.ObjectReader
private static final com.fasterxml.jackson.databind.ObjectReader
private com.codahale.metrics.Meter
private com.codahale.metrics.Meter
private final LuceneService
private static final com.fasterxml.jackson.databind.ObjectMapper
private static final Protocol.ErrorReplyFactory
private static final Protocol.ErrorReplyFactory
private String
private static final Protocol.ErrorReplyFactory
private com.codahale.metrics.Meter
private static final Duration
private com.github.benmanes.caffeine.cache.Cache
<String, com.codahale.metrics.Timer.Context> private static final Protocol.ErrorReplyFactory
private com.codahale.metrics.Meter
private com.codahale.metrics.Meter
Fields inherited from class ch.rswk.meta.engine.AbstractEngineIdleService
runtime
-
Constructor Summary
ConstructorsConstructorDescriptionLoggingService
(LoggingService.LoggingServiceConfig config, GatewayService gatewayService, LuceneService luceneService, EngineRuntime runtime) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
private static void
private void
private static float
getMetricSamplingPercentage
(float sampling) void
log
(LoggingMessage request) com.google.common.util.concurrent.ListenableFuture
<LoggingDeleteReply> loggingDelete
(LoggingDeleteRequest request) com.google.common.util.concurrent.ListenableFuture
<LoggingEntrySearchReply> com.google.common.util.concurrent.ListenableFuture
<LoggingMetricSearchReply> com.google.common.util.concurrent.ListenableFuture
<LoggingMetricTimeReply> newMetricFilter
(@Nullable List<String> filter) void
private void
private com.google.common.util.concurrent.ListenableFuture
<LuceneService.SearchResult> searchLucene
(String cursor, int limit, LuceneService luceneService, MetaLucene.QueryContext queryContext) com.google.common.util.concurrent.ListenableFuture
<Boolean> sendAlerts
(List<AlertRegistry.Alert> alerts) protected void
shutDown()
protected void
startUp()
private void
private void
writeLoggingEntry
(LoggingEntry entry) private com.google.common.util.concurrent.ListenableFuture
<Long> Methods inherited from class ch.rswk.meta.engine.AbstractEngineIdleService
configClass, configReference, onConfigWatcherNotification, serviceId, serviceName
Methods inherited from class com.google.common.util.concurrent.AbstractIdleService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, startAsync, state, stopAsync, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.rswk.meta.engine.EngineServices.ConfigurableService
config, handleConfigWatcherNotification
Methods inherited from interface ch.rswk.meta.engine.EngineServices.InfoProvidingService
getServiceInfo
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
ALERT_SCHEDULE
-
ALERT_LOG
private static final org.slf4j.Logger ALERT_LOG -
ALERT_MESSAGE_FORMAT
- See Also:
-
ALERT_SUBJECT
- See Also:
-
DELETE_BEFORE_FORMAT
- See Also:
-
DELETE_ERROR
-
MAPPER
private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER -
LOGGING_ENTRY_READER
private static final com.fasterxml.jackson.databind.ObjectReader LOGGING_ENTRY_READER -
LOGGING_METRIC_READER
private static final com.fasterxml.jackson.databind.ObjectReader LOGGING_METRIC_READER -
METRIC_DEFAULT_FILTER
-
METRIC_NAME_ERROR
-
NO_QUERY_ERROR
-
SEARCH_ERROR
-
TIMER_EXPIRATION
-
WRITE_ERROR
-
gatewayService
-
luceneService
-
alertMeter
private com.codahale.metrics.Meter alertMeter -
appender
private ch.qos.logback.core.UnsynchronizedAppenderBase<ch.qos.logback.classic.spi.ILoggingEvent> appender -
deleteMeter
private com.codahale.metrics.Meter deleteMeter -
logErrorMeter
private com.codahale.metrics.Meter logErrorMeter -
logMetricMeter
private com.codahale.metrics.Meter logMetricMeter -
logWarnMeter
private com.codahale.metrics.Meter logWarnMeter -
previousAlertNames
-
searchMeter
private com.codahale.metrics.Meter searchMeter -
timerCache
private com.github.benmanes.caffeine.cache.Cache<String,com.codahale.metrics.Timer.Context> timerCache -
writeErrorMeter
private com.codahale.metrics.Meter writeErrorMeter -
writeMeter
private com.codahale.metrics.Meter writeMeter
-
-
Constructor Details
-
LoggingService
@Inject public LoggingService(LoggingService.LoggingServiceConfig config, GatewayService gatewayService, @Named("Logging") LuceneService luceneService, EngineRuntime runtime)
-
-
Method Details
-
log
-
writeLoggingEntry
-
loggingEntrySearch
public com.google.common.util.concurrent.ListenableFuture<LoggingEntrySearchReply> loggingEntrySearch(LoggingEntrySearchRequest request) -
searchLucene
private com.google.common.util.concurrent.ListenableFuture<LuceneService.SearchResult> searchLucene(String cursor, int limit, LuceneService luceneService, MetaLucene.QueryContext queryContext) -
loggingMetricSearch
public com.google.common.util.concurrent.ListenableFuture<LoggingMetricSearchReply> loggingMetricSearch(LoggingMetricSearchRequest request) -
newMetricFilter
-
getMetricSamplingPercentage
private static float getMetricSamplingPercentage(float sampling) -
loggingMetricTime
public com.google.common.util.concurrent.ListenableFuture<LoggingMetricTimeReply> loggingMetricTime(LoggingMetricTimeRequest request) -
onConfigChanged
public void onConfigChanged() -
updateLoggers
private void updateLoggers() -
startUp
- Overrides:
startUp
in classAbstractEngineIdleService<LoggingService.LoggingServiceConfig>
- Throws:
Exception
-
shutDown
- Overrides:
shutDown
in classAbstractEngineIdleService<LoggingService.LoggingServiceConfig>
- Throws:
Exception
-
processAlertsAndMetrics
private void processAlertsAndMetrics() -
sendAlerts
public com.google.common.util.concurrent.ListenableFuture<Boolean> sendAlerts(List<AlertRegistry.Alert> alerts) -
writeLoggingMetric
-
checkRetention
private void checkRetention() -
checkRetentionPaths
private void checkRetentionPaths() -
checkRetentionPath
-
loggingDelete
public com.google.common.util.concurrent.ListenableFuture<LoggingDeleteReply> loggingDelete(LoggingDeleteRequest request)
-