Zakelly commented on code in PR #25837: URL: https://github.com/apache/flink/pull/25837#discussion_r1901451065
########## flink-core/src/main/java/org/apache/flink/configuration/StateSizeTrackOptions.java: ########## @@ -0,0 +1,62 @@ +/* + * 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.flink.configuration; + +import org.apache.flink.annotation.PublicEvolving; +import org.apache.flink.annotation.docs.Documentation; + +/** A collection of all configuration options that relate to the size tracking for state access. */ +@PublicEvolving +public class StateSizeTrackOptions { + + @Documentation.Section(Documentation.Sections.STATE_SIZE_TRACKING) + public static final ConfigOption<Boolean> SIZE_TRACK_ENABLED = + ConfigOptions.key("state.backend.size-track.keyed-state-enabled") Review Comment: Please use `state.size-track` as prefix. ########## flink-runtime/src/main/java/org/apache/flink/runtime/state/metrics/LatencyTrackingStateFactory.java: ########## @@ -34,35 +35,47 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -/** Factory to create {@link AbstractLatencyTrackState}. */ +/** Factory to create {@link AbstractMetricsTrackState}. */ public class LatencyTrackingStateFactory< K, N, V, S extends State, IS extends InternalKvState<K, N, ?>> { private final InternalKvState<K, N, ?> kvState; private final StateDescriptor<S, V> stateDescriptor; private final LatencyTrackingStateConfig latencyTrackingStateConfig; + private final SizeTrackingStateConfig sizeTrackingStateConfig; private final Map<StateDescriptor.Type, SupplierWithException<IS, Exception>> stateFactories; + private final KeyedStateBackend keyedStateBackend; private LatencyTrackingStateFactory( InternalKvState<K, N, ?> kvState, + KeyedStateBackend<K> keyedStateBackend, StateDescriptor<S, V> stateDescriptor, - LatencyTrackingStateConfig latencyTrackingStateConfig) { + LatencyTrackingStateConfig latencyTrackingStateConfig, + SizeTrackingStateConfig sizeTrackingStateConfig) { this.kvState = kvState; + this.keyedStateBackend = keyedStateBackend; this.stateDescriptor = stateDescriptor; this.latencyTrackingStateConfig = latencyTrackingStateConfig; + this.sizeTrackingStateConfig = sizeTrackingStateConfig; this.stateFactories = createStateFactories(); } /** Create latency tracking state if enabled. */ public static <K, N, V, S extends State> InternalKvState<K, N, ?> createStateAndWrapWithLatencyTrackingIfEnabled( InternalKvState<K, N, ?> kvState, + KeyedStateBackend<K> keyedStateBackend, StateDescriptor<S, V> stateDescriptor, - LatencyTrackingStateConfig latencyTrackingStateConfig) + LatencyTrackingStateConfig latencyTrackingStateConfig, + SizeTrackingStateConfig sizeTrackingStateConfig) throws Exception { - if (latencyTrackingStateConfig.isEnabled()) { + if (latencyTrackingStateConfig.isEnabled() || sizeTrackingStateConfig.isEnabled()) { Review Comment: It seems the `LatencyTrackingStateFactory` is still used, why this is not renamed? ########## flink-runtime/src/main/java/org/apache/flink/runtime/state/metrics/AbstractMetricsTrackState.java: ########## @@ -36,16 +38,52 @@ * @param <S> Type of the internal kv state * @param <LSM> Type of the latency tracking state metrics Review Comment: Please change the description accordingly. -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org