dannycranmer commented on code in PR #22901: URL: https://github.com/apache/flink/pull/22901#discussion_r1251666590
########## flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/job/checkpoints/AbstractCheckpointStatsHandler.java: ########## @@ -0,0 +1,117 @@ +/* + * 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.runtime.rest.handler.job.checkpoints; + +import org.apache.flink.api.common.JobID; +import org.apache.flink.api.common.time.Time; +import org.apache.flink.runtime.checkpoint.CheckpointStatsSnapshot; +import org.apache.flink.runtime.messages.FlinkJobNotFoundException; +import org.apache.flink.runtime.rest.NotFoundException; +import org.apache.flink.runtime.rest.handler.AbstractRestHandler; +import org.apache.flink.runtime.rest.handler.HandlerRequest; +import org.apache.flink.runtime.rest.handler.RestHandlerException; +import org.apache.flink.runtime.rest.messages.EmptyRequestBody; +import org.apache.flink.runtime.rest.messages.JobIDPathParameter; +import org.apache.flink.runtime.rest.messages.JobMessageParameters; +import org.apache.flink.runtime.rest.messages.MessageHeaders; +import org.apache.flink.runtime.rest.messages.ResponseBody; +import org.apache.flink.runtime.webmonitor.RestfulGateway; +import org.apache.flink.runtime.webmonitor.retriever.GatewayRetriever; +import org.apache.flink.util.ExceptionUtils; + +import org.apache.flink.shaded.guava31.com.google.common.cache.Cache; + +import javax.annotation.Nonnull; + +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executor; + +/** + * Abstract class for checkpoint handlers that will cache the {@link CheckpointStatsSnapshot} + * object. + * + * @param <R> the response type + * @param <M> the message parameters + */ +public abstract class AbstractCheckpointStatsHandler< Review Comment: Missing compatibility annotation ########## docs/layouts/shortcodes/generated/expert_rest_section.html: ########## @@ -20,6 +20,18 @@ <td>Long</td> <td>The time in ms that the client waits for the leader address, e.g., Dispatcher or WebMonitorEndpoint</td> </tr> + <tr> + <td><h5>rest.cache.checkpoint-statistics.size</h5></td> + <td style="word-wrap: break-word;">1000</td> + <td>Integer</td> + <td>Maximum number of entries in the checkpoint statistics cache.</td> + </tr> + <tr> + <td><h5>rest.cache.checkpoint-statistics.timeout</h5></td> + <td style="word-wrap: break-word;">3 s</td> + <td>Duration</td> + <td>Duration from write after which cached checkpoints statistics are cleaned up. It can be specified using notation: "500 ms", "1 s".</td> + </tr> Review Comment: Are these configs backwards compatible? Seems like `rest.cache.checkpoint-statistics.timeout` is a new config split for `web.refresh-interval`? ########## docs/layouts/shortcodes/generated/rest_configuration.html: ########## @@ -38,6 +38,18 @@ <td>String</td> <td>The port that the server binds itself. Accepts a list of ports (“50100,50101”), ranges (“50100-50200”) or a combination of both. It is recommended to set a range of ports to avoid collisions when multiple Rest servers are running on the same machine.</td> </tr> + <tr> + <td><h5>rest.cache.checkpoint-statistics.size</h5></td> + <td style="word-wrap: break-word;">1000</td> + <td>Integer</td> + <td>Maximum number of entries in the checkpoint statistics cache.</td> + </tr> + <tr> + <td><h5>rest.cache.checkpoint-statistics.timeout</h5></td> + <td style="word-wrap: break-word;">3 s</td> + <td>Duration</td> + <td>Duration from write after which cached checkpoints statistics are cleaned up. It can be specified using notation: "500 ms", "1 s".</td> Review Comment: ```suggestion <td>Duration from write after which cached checkpoints statistics are cleaned up.</td> ``` ########## docs/layouts/shortcodes/generated/expert_rest_section.html: ########## @@ -20,6 +20,18 @@ <td>Long</td> <td>The time in ms that the client waits for the leader address, e.g., Dispatcher or WebMonitorEndpoint</td> </tr> + <tr> + <td><h5>rest.cache.checkpoint-statistics.size</h5></td> + <td style="word-wrap: break-word;">1000</td> + <td>Integer</td> + <td>Maximum number of entries in the checkpoint statistics cache.</td> + </tr> + <tr> + <td><h5>rest.cache.checkpoint-statistics.timeout</h5></td> + <td style="word-wrap: break-word;">3 s</td> + <td>Duration</td> + <td>Duration from write after which cached checkpoints statistics are cleaned up. It can be specified using notation: "500 ms", "1 s".</td> Review Comment: ```suggestion <td>Duration from write after which cached checkpoints statistics are cleaned up.</td> ``` ########## flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/RestHandlerConfiguration.java: ########## @@ -46,6 +51,8 @@ public class RestHandlerConfiguration { public RestHandlerConfiguration( long refreshInterval, int maxCheckpointStatisticCacheEntries, + Duration checkpointStatsSnapshotCacheExpireAfterWrite, + int checkpointStatsSnapshotCacheSize, Review Comment: It is confusing to understand the difference between `maxCheckpointStatisticCacheEntries` and `checkpointStatsSnapshotCacheSize` without reading the code. Can the variable names be improved? -- 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]
