Class PipelineConfig
- java.lang.Object
-
- com.github.loki4j.client.pipeline.PipelineConfig
-
public class PipelineConfig extends java.lang.ObjectConfiguration properties for Loki4j pipeline.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPipelineConfig.Builderstatic classPipelineConfig.WriterFactoryA factory for Writer.
-
Field Summary
Fields Modifier and Type Field Description intbatchMaxBytesMax number of bytes a single batch can contain (as counted by Loki).intbatchMaxItemsMax number of events to put into a single batch before sending it to Loki.longbatchTimeoutMsMax time in milliseconds to keep a batch before sending it to Loki, even if max items/bytes limits for this batch are not reached.static java.util.function.Function<HttpConfig,Loki4jHttpClient>defaultHttpClientFactorybooleandrainOnStopIf true, the pipeline will try to send all the remaining events on shutdown, so the proper shutdown procedure might take longer.booleandropRateLimitedBatchesIf true, batches that Loki responds to with a 429 status code (TooManyRequests) will be dropped rather than retried.java.util.function.Function<HttpConfig,Loki4jHttpClient>httpClientFactoryA factory for HTTP client for sending logs to Loki.HttpConfighttpConfigConfiguration properties for HTTP clients.java.util.function.Function<java.lang.Object,Loki4jLogger>internalLoggingFactoryA factory for an internal logger.longinternalQueuesCheckTimeoutMsA timeout for Loki4j threads to sleep if encode or send queues are empty.static PipelineConfig.WriterFactoryjsonintmaxRetriesMax number of attempts to send a batch to Loki before it will be dropped.longmaxRetryBackoffMsMaximum backoff delay before the next attempt to re-send a failed batch.intmaxRetryJitterMsUpper bound for a jitter added to the retry delays.booleanmetricsEnabledIf true, the pipeline will report its metrics using Micrometer.longminRetryBackoffMsInitial backoff delay before the next attempt to re-send a failed batch.java.lang.StringnameName of this pipeline.static PipelineConfig.WriterFactoryprotobuflongsendQueueMaxBytesMax number of bytes to keep in the send queue.booleansortByTimeIf true, log records in batch are sorted by timestamp.booleanstaticLabelsIf you use only one label for all log records, you can set this flag to true and save some CPU time on grouping records by label.booleanuseDirectBuffersUse off-heap memory for storing intermediate data.PipelineConfig.WriterFactorywriterFactoryA factory for Writer.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static HttpConfig.Builderapache(int maxConnections, long connectionKeepAliveMs)static PipelineConfig.Builderbuilder()static HttpConfig.Builderjava(long innerThreadsExpirationMs)
-
-
-
Field Detail
-
json
public static final PipelineConfig.WriterFactory json
-
protobuf
public static final PipelineConfig.WriterFactory protobuf
-
defaultHttpClientFactory
public static final java.util.function.Function<HttpConfig,Loki4jHttpClient> defaultHttpClientFactory
-
name
public final java.lang.String name
Name of this pipeline.
-
batchMaxItems
public final int batchMaxItems
Max number of events to put into a single batch before sending it to Loki.
-
batchMaxBytes
public final int batchMaxBytes
Max number of bytes a single batch can contain (as counted by Loki). This value should not be greater than server.grpc_server_max_recv_msg_size in your Loki config.
-
batchTimeoutMs
public final long batchTimeoutMs
Max time in milliseconds to keep a batch before sending it to Loki, even if max items/bytes limits for this batch are not reached.
-
sortByTime
public final boolean sortByTime
If true, log records in batch are sorted by timestamp. If false, records will be sent to Loki in arrival order. Turn this on if you see 'entry out of order' error from Loki.
-
staticLabels
public final boolean staticLabels
If you use only one label for all log records, you can set this flag to true and save some CPU time on grouping records by label.
-
sendQueueMaxBytes
public final long sendQueueMaxBytes
Max number of bytes to keep in the send queue. When the queue is full, incoming log events are dropped.
-
maxRetries
public final int maxRetries
Max number of attempts to send a batch to Loki before it will be dropped. A failed batch send could be retried only in case of ConnectException, or receiving statuses 429, 503 from Loki. All other exceptions and 4xx-5xx statuses do not cause a retry in order to avoid duplicates.
-
minRetryBackoffMs
public final long minRetryBackoffMs
Initial backoff delay before the next attempt to re-send a failed batch. Batches are retried with an exponential backoff (e.g. 0.5s, 1s, 2s, 4s, etc.) and jitter.
-
maxRetryBackoffMs
public final long maxRetryBackoffMs
Maximum backoff delay before the next attempt to re-send a failed batch.
-
maxRetryJitterMs
public final int maxRetryJitterMs
Upper bound for a jitter added to the retry delays.
-
dropRateLimitedBatches
public final boolean dropRateLimitedBatches
If true, batches that Loki responds to with a 429 status code (TooManyRequests) will be dropped rather than retried.
-
internalQueuesCheckTimeoutMs
public final long internalQueuesCheckTimeoutMs
A timeout for Loki4j threads to sleep if encode or send queues are empty. Decreasing this value means lower latency at cost of higher CPU usage.
-
useDirectBuffers
public final boolean useDirectBuffers
Use off-heap memory for storing intermediate data.
-
drainOnStop
public final boolean drainOnStop
If true, the pipeline will try to send all the remaining events on shutdown, so the proper shutdown procedure might take longer. Otherwise, the pipeline will drop the unsent events.
-
metricsEnabled
public final boolean metricsEnabled
If true, the pipeline will report its metrics using Micrometer.
-
writerFactory
public final PipelineConfig.WriterFactory writerFactory
A factory for Writer.
-
httpConfig
public final HttpConfig httpConfig
Configuration properties for HTTP clients.
-
httpClientFactory
public final java.util.function.Function<HttpConfig,Loki4jHttpClient> httpClientFactory
A factory for HTTP client for sending logs to Loki. Argument is a config required for constructing an HTTP client.
-
internalLoggingFactory
public final java.util.function.Function<java.lang.Object,Loki4jLogger> internalLoggingFactory
A factory for an internal logger. Argument is a source class to report log messages from.
-
-
Method Detail
-
apache
public static HttpConfig.Builder apache(int maxConnections, long connectionKeepAliveMs)
-
java
public static HttpConfig.Builder java(long innerThreadsExpirationMs)
-
builder
public static final PipelineConfig.Builder builder()
-
-