wu-sheng commented on code in PR #13405: URL: https://github.com/apache/skywalking/pull/13405#discussion_r2262298242
########## oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsPersistentWorkerMin.java: ########## @@ -0,0 +1,142 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.oap.server.core.analysis.worker; + +import java.util.Arrays; +import java.util.List; +import lombok.extern.slf4j.Slf4j; +import org.apache.skywalking.oap.server.core.CoreModule; +import org.apache.skywalking.oap.server.core.UnexpectedException; +import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics; +import org.apache.skywalking.oap.server.core.exporter.ExportEvent; +import org.apache.skywalking.oap.server.core.status.ServerStatusService; +import org.apache.skywalking.oap.server.core.status.ServerStatusWatcher; +import org.apache.skywalking.oap.server.core.storage.IMetricsDAO; +import org.apache.skywalking.oap.server.core.storage.model.Model; +import org.apache.skywalking.oap.server.core.worker.AbstractWorker; +import org.apache.skywalking.oap.server.library.datacarrier.DataCarrier; +import org.apache.skywalking.oap.server.library.datacarrier.buffer.QueueBuffer; +import org.apache.skywalking.oap.server.library.datacarrier.consumer.BulkConsumePool; +import org.apache.skywalking.oap.server.library.datacarrier.consumer.ConsumerPoolFactory; +import org.apache.skywalking.oap.server.library.datacarrier.consumer.IConsumer; +import org.apache.skywalking.oap.server.library.module.ModuleDefineHolder; +import org.apache.skywalking.oap.server.telemetry.TelemetryModule; +import org.apache.skywalking.oap.server.telemetry.api.GaugeMetrics; +import org.apache.skywalking.oap.server.telemetry.api.MetricsCreator; +import org.apache.skywalking.oap.server.telemetry.api.MetricsTag; + +/** + * MetricsPersistentWorkerMin is an extension of {@link MetricsPersistentWorker} and focuses on the Minute Metrics data persistent. + */ +@Slf4j +public class MetricsPersistentWorkerMin extends MetricsPersistentWorker implements ServerStatusWatcher { + private final DataCarrier<Metrics> dataCarrier; + + /** + * The percentage of queue used in aggregation + */ + private final GaugeMetrics queuePercentageGauge; + + /** + * @since 9.4.0 + */ + private final ServerStatusService serverStatusService; + + // Not going to expose this as a configuration, only for testing purpose + private final boolean isTestingTTL = "true".equalsIgnoreCase(System.getenv("TESTING_TTL")); + private final int queueTotalSize; + + MetricsPersistentWorkerMin(ModuleDefineHolder moduleDefineHolder, Model model, IMetricsDAO metricsDAO, + AbstractWorker<Metrics> nextAlarmWorker, AbstractWorker<ExportEvent> nextExportWorker, + MetricsTransWorker transWorker, boolean supportUpdate, + long storageSessionTimeout, int metricsDataTTL, MetricStreamKind kind) { + super( + moduleDefineHolder, model, metricsDAO, nextAlarmWorker, nextExportWorker, transWorker, supportUpdate, + storageSessionTimeout, metricsDataTTL, kind + ); + + String name = "METRICS_L2_AGGREGATION"; Review Comment: Only new min worker creates a queue now. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
