final AsyncFunction<MetricsCollection, List<List<IMetric>>> batchSplitter;
final AsyncFunction<List<List<IMetric>>, List<Boolean>> batchWriter;
final AsyncFunction<MetricsCollection, MetricsCollection> rollupTypeCacher;
typeAndUnitProcessor = new TypeAndUnitProcessor(
new ThreadPoolBuilder()
.withName("Metric type and unit processing")
.withCorePoolSize(HTTP_MAX_TYPE_UNIT_PROCESSOR_THREADS)
.withMaxPoolSize(HTTP_MAX_TYPE_UNIT_PROCESSOR_THREADS)
.build(),
metricMetadataAnalyzer
).withLogger(log);
batchSplitter = new BatchSplitter(
new ThreadPoolBuilder().withName("Metric batching").build(),
BATCH_SIZE
).withLogger(log);
batchWriter = new BatchWriter(
new ThreadPoolBuilder()
.withName("Metric Batch Writing")
.withCorePoolSize(WRITE_THREADS)
.withMaxPoolSize(WRITE_THREADS)
.withUnboundedQueue()
.build(),
writer,
timeout,
bufferedMetrics,
context
).withLogger(log);
discoveryWriter =
new DiscoveryWriter(new ThreadPoolBuilder()
.withName("Metric Discovery Writing")
.withCorePoolSize(Configuration.getInstance().getIntegerProperty(CoreConfig.DISCOVERY_WRITER_MIN_THREADS))
.withMaxPoolSize(Configuration.getInstance().getIntegerProperty(CoreConfig.DISCOVERY_WRITER_MAX_THREADS))
.withUnboundedQueue()
.build());
// RollupRunnable keeps a static one of these. It would be nice if we could register it and share.
MetadataCache rollupTypeCache = MetadataCache.createLoadingCacheInstance(
new TimeValue(48, TimeUnit.HOURS),
Configuration.getInstance().getIntegerProperty(CoreConfig.MAX_ROLLUP_READ_THREADS));
rollupTypeCacher = new RollupTypeCacher(
new ThreadPoolBuilder().withName("Rollup type persistence").build(),
rollupTypeCache,
true
).withLogger(log);
this.defaultProcessorChain = AsyncChain