mreutegg commented on code in PR #690: URL: https://github.com/apache/jackrabbit-oak/pull/690#discussion_r970686461
########## oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/CreateStatsConsumer.java: ########## @@ -0,0 +1,31 @@ +/* + * 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.jackrabbit.oak.plugins.document.util; + +import java.util.List; + +/** + * {@link FunctionalInterface} to consume Metric Stats for create/upsert operation + * @param <T> the type of the first argument to the consumer + * @param <U> the type of the second argument to the consumer + * @param <V> the type of the third argument to the consumer + */ +public interface CreateStatsConsumer<T, U, V> { + void accept(T t, U u, V v, List<String> ids, long tTN); Review Comment: I would not use generics here and in the other consumer interfaces, but simply define the parameter types explicitly in accept(). I think it would make it easier to read when all the parameters would have an explicit type and intended use is documented. Currently it just says first, second and third argument and it could be anything. ########## oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentStoreStats.java: ########## @@ -157,6 +203,41 @@ public DocumentStoreStats(StatisticsProvider provider) { prefetchNodes = provider.getMeter(NODES_PREFETCH, StatsOptions.DEFAULT); prefetchNodesTimer = provider.getTimer(NODES_PREFETCH_TIMER, StatsOptions.METRICS_ONLY); + + // metrics for throttling + MeterStats createSplitNodeWithThrottlingMeter = provider.getMeter(NODES_CREATE_SPLIT_WITH_THROTTLING, StatsOptions.DEFAULT); Review Comment: I'm not sure, but I would rather keep the operation and throttling time separate. That is no matter if throttling is on or off, we always have a metric for the operation with the underlying DocumentStore implementation. When throttling is on and in effect, then we'd see it in a newly introduced metric. For this case here, I would name it `NODES_CREATE_SPLIT_THROTTLING`. This metric would only reflect/cover the throttling part of the operation. Another advantage of this design is backward compatibility. With the proposed change the current metric would not get any updates as soon as throttling kicks in. It will look as if there were no operations at all while throttling was in effect. -- 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]
