Vladsz83 commented on code in PR #11223: URL: https://github.com/apache/ignite/pull/11223#discussion_r1542563427
########## modules/core/src/main/java/org/apache/ignite/metric/IgniteMetrics.java: ########## @@ -0,0 +1,71 @@ +/* + * 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.ignite.metric; + +import org.apache.ignite.lang.IgniteExperimental; +import org.apache.ignite.spi.metric.ReadOnlyMetricRegistry; +import org.jetbrains.annotations.Nullable; + +/** + * Allows to manage custom metrics. + * <p> + * Metrics are grouped into registries (groups). Every metric has full name which is the conjunction of registry name + * and the metric short name. Within a registry metric has only its own short name. + * <p> + * Note: Names of custom metric registries are required to start with 'custom.' (lower case) and may have additional + * dot-separated qualifiers. The prefix is automatically added if missed. For example, if provided custom registry name + * is "a.b.c.mname", it is automatically extended to "custom.a.b.c.mname". + * <p> + * Note: Custom metric are registered on demand and aren't stored. If node restarts, the metrics require registration anew. + * <p> + * Any name or dot-separated name part must not be empty and cannot have spaces. + * Examples of custom metric registry names: "custom.admin.sessions", "custom.processes", "custom.processes.proc_1", etc. + * + * @see ReadOnlyMetricRegistry + * @see IgniteMetricRegistry + */ +@IgniteExperimental +public interface IgniteMetrics extends Iterable<ReadOnlyMetricRegistry> { + /** + * Gets or creates custom metric registry named "custom." + {@code registryName}. + * + * @param registryName name part to add to the prefix "custom.". + * @return {@link IgniteMetricRegistry} registry. + */ + IgniteMetricRegistry customRegistry(String registryName); Review Comment: `registry()` or `customRegistry()` always create a metric registry. `findRegistry()` doesn't. Hence, is a way just to take metrics if they exist. `custom` is to emphasize that only custom metrics are affected. In the first ticket implementations we allowed read-only access to the system metrics as suggested in IGNITE-12553. But decided to simplify the first commit. In future we plan to expose read-only system metrics with `findRegistry()` and implement IGNITE-12553. WDYT? -- 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]
