apoorvmittal10 commented on code in PR #14621: URL: https://github.com/apache/kafka/pull/14621#discussion_r1372943465
########## core/src/main/scala/kafka/server/ClientMetricsManager.scala: ########## @@ -0,0 +1,38 @@ +/** + * 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. + */ + Review Comment: Done. ########## core/src/main/scala/kafka/metrics/ClientMetricsConfig.scala: ########## @@ -0,0 +1,146 @@ +/* + * 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 kafka.metrics + +import org.apache.kafka.common.config.ConfigDef +import org.apache.kafka.common.config.ConfigDef.Importance.MEDIUM +import org.apache.kafka.common.config.ConfigDef.Type.{INT, LIST} +import org.apache.kafka.common.errors.InvalidRequestException + +import java.util +import java.util.Properties + +/** + * Client metric configuration related parameters and the supporting methods like validation and update methods + * are defined in this class. + * <p> + * SubscriptionInfo: Contains the client metric subscription information. Supported operations from the CLI are + * add/delete/update operations. Every subscription object contains the following parameters that are populated + * during the creation of the subscription. + * <p> + * { + * <ul> + * <li> subscriptionId: Name/ID supplied by CLI during the creation of the client metric subscription. + * <li> subscribedMetrics: List of metric prefixes + * <li> pushIntervalMs: A positive integer value >=0 tells the client that how often a client can push the metrics + * <li> matchingPatternsList: List of client matching patterns, that are used by broker to match the client instance + * with the subscription. + * </ul> + * } + * <p> + * At present, CLI can pass the following parameters in request to add/delete/update the client metrics + * subscription: + * <ul> + * <li> "metrics" value should be comma separated metrics list. A prefix match on the requested metrics + * is performed in clients to determine subscribed metrics. An empty list means no metrics subscribed. + * A list containing just an empty string means all metrics subscribed. + * Ex: "org.apache.kafka.producer.partition.queue.,org.apache.kafka.producer.partition.latency" + * + * <li> "interval.ms" should be between 100 and 3600000 (1 hour). This is the interval at which the client + * should push the metrics to the broker. + * + * <li> "match" is a comma separated list of client match patterns, in case if there is no matching + * pattern specified then broker considers that as all match which means the associated metrics + * applies to all the clients. Ex: "client_software_name = Java, client_software_version = 11.1.*" + * which means all Java clients with any sub versions of 11.1 will be matched i.e. 11.1.1, 11.1.2 etc. + * + * </ul> + * For more information please look at kip-714: + * https://cwiki.apache.org/confluence/display/KAFKA/KIP-714%3A+Client+metrics+and+observability#KIP714:Clientmetricsandobservability-Clientmetricsconfiguration + */ +object ClientMetricsConfig { + + class SubscriptionInfo(subscriptionId: String, Review Comment: SubscriptionId should not be empty. Good suggestion, I ll keep the comment as open for now as I have asked @hachikuji that should we place these new classes in Java itself as I see new code is written there. In case we go with scala then I ll update the code with suggestion. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org