apoorvmittal10 opened a new pull request, #14632:
URL: https://github.com/apache/kafka/pull/14632

   The PR adds support of alter/describe configs for client-metrics as defined 
in 
[KIP-714](https://cwiki.apache.org/confluence/display/KAFKA/KIP-714%3A+Client+metrics+and+observability#KIP714:Clientmetricsandobservability-kafka-configs.sh)
   
   Below are the results of the commands:
   
   #### Help section adds details for `client-metrics`:
   ```
   ./bin/kafka-configs.sh --help
   
   This tool helps to manipulate and describe entity config for a topic, 
client, user, broker, ip or client-metrics
   .
   .
   .
   --add-config <String>                  Key Value pairs of configs to add.
                                            Square brackets can be used to group
                                            values which contain commas: 'k1=v1,
                                            k2=[v1,v2,v2],k3=v3'. The following
                                            is a list of valid configurations:
                                            For entity-type 'topics':
                                                .
                                           .
                                           .
                                           controller_mutation_rate
                                                producer_byte_rate
                                                request_percentage
                                          For entity-type 'clients':
                                                consumer_byte_rate
                                                controller_mutation_rate
                                                producer_byte_rate
                                                request_percentage
                                          For entity-type 'ips':
                                                connection_creation_rate
                                          For entity-type 'client-metrics':
                                                interval.ms
                                                match
                                                metrics
                                          Entity types 'users' and 'clients' may
                                            be specified together to update
                                            config for clients of a specific
                                            user.
   
   --entity-type <String>                 Type of entity
                                            
(topics/clients/users/brokers/broker-
                                            loggers/ips/client-metrics)
   
   
   --entity-name <String>                 Name of entity (topic name/client
                                            id/user principal name/broker
                                            id/ip/client metrics subscription
                                            name)
   ```
   
   #### Incorrect entity type:
   ```
   ./bin/kafka-configs.sh --bootstrap-server localhost:9092 --entity-type 
client-metrics1 --describe --entity-name METRICSUB
   
   Invalid entity type client-metrics1, the entity type must be one of topics, 
clients, users, brokers, ips, client-metrics, broker-loggers with a 
--bootstrap-server or --bootstrap-controller argument
   ```
   
   #### Describe wihout entity name:
   ```
   ./bin/kafka-configs.sh --bootstrap-server localhost:9092 --entity-type 
client-metrics --describe
   
   an entity name must be specified with --describe of client-metrics
   ```
   
   #### Describe with blank entity name:
   ```
   ./bin/kafka-configs.sh --bootstrap-server localhost:9092 --entity-type 
client-metrics --describe --entity-name ""
   
   an entity name must be specified with --describe of client-metrics
   ```
   
   #### Invalid entity name. Omitted to throw exception as the describe 
response is further needed in alter to construct if the new subscription to be 
added or altered.
   ```
   ./bin/kafka-configs.sh --bootstrap-server localhost:9092 --entity-type 
client-metrics --describe --entity-name "random"
   
   Dynamic configs for client-metric random are:
   ```
   
   #### Successful alter of `client-metrics`:
   ```
   ./bin/kafka-configs.sh --bootstrap-server localhost:9092 --alter 
--entity-type client-metrics --entity-name METRICSUB --add-config 
"metrics=org.apache.kafka.consumer.,interval.ms=60000,match=[client_software_name=kafka.python,client_software_version=1\.2\..*]"
   
   Completed updating config for client-metric METRICSUB.
   ```
   
   #### Successful describe of `client-metrics`:
   ```
   ./bin/kafka-configs.sh --bootstrap-server localhost:9092 --entity-type 
client-metrics --describe --entity-name METRICSUB
   
   Dynamic configs for client-metric METRICSUB are:
     interval.ms=60000 sensitive=false synonyms={}
     match=client_software_name=kafka.python,client_software_version=1\.2\..* 
sensitive=false synonyms={}
     metrics=org.apache.kafka.consumer. sensitive=false synonyms={}
   ```
   
   ### With Zookeper:
   
   #### Without making change in `ZKConfigRepository`, throws 
UnknownServerException:
   ```
   ./bin/kafka-configs.sh --bootstrap-server localhost:9092 --entity-type 
client-metrics --describe --entity-name "random"
   
   
   Dynamic configs for client-metric random are:
   
   Error while executing config command with args '--bootstrap-server 
localhost:9092 --entity-type client-metrics --describe --entity-name random'
   java.util.concurrent.ExecutionException: 
org.apache.kafka.common.errors.UnknownServerException: The server experienced 
an unexpected error when processing the request.
        at 
java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
        at 
java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
        at 
org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:180)
        at kafka.admin.ConfigCommand$.getResourceConfig(ConfigCommand.scala:614)
        at 
kafka.admin.ConfigCommand$.$anonfun$describeResourceConfig$5(ConfigCommand.scala:572)
        at 
kafka.admin.ConfigCommand$.$anonfun$describeResourceConfig$5$adapted(ConfigCommand.scala:564)
        at scala.collection.immutable.List.foreach(List.scala:333)
        at 
kafka.admin.ConfigCommand$.describeResourceConfig(ConfigCommand.scala:564)
        at kafka.admin.ConfigCommand$.describeConfig(ConfigCommand.scala:542)
        at kafka.admin.ConfigCommand$.processCommand(ConfigCommand.scala:343)
        at kafka.admin.ConfigCommand$.main(ConfigCommand.scala:97)
        at kafka.admin.ConfigCommand.main(ConfigCommand.scala)
   Caused by: org.apache.kafka.common.errors.UnknownServerException: The server 
experienced an unexpected error when processing the request.
   ```
   
   #### After the change in `ZKConfigRepository`:
   
   #### Describe:
   
   ```
   ./bin/kafka-configs.sh --bootstrap-server localhost:9092 --entity-type 
client-metrics --describe --entity-name "random"
   
   
   Dynamic configs for client-metric random are:
   
   Error while executing config command with args '--bootstrap-server 
localhost:9092 --entity-type client-metrics --describe --entity-name random'
   java.util.concurrent.ExecutionException: 
org.apache.kafka.common.errors.InvalidRequestException: Config type 
client-metrics is only supported on KRaft clusters
        at 
java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
        at 
java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
        at 
org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:180)
        at kafka.admin.ConfigCommand$.getResourceConfig(ConfigCommand.scala:614)
        at 
kafka.admin.ConfigCommand$.$anonfun$describeResourceConfig$5(ConfigCommand.scala:572)
        at 
kafka.admin.ConfigCommand$.$anonfun$describeResourceConfig$5$adapted(ConfigCommand.scala:564)
        at scala.collection.immutable.List.foreach(List.scala:333)
        at 
kafka.admin.ConfigCommand$.describeResourceConfig(ConfigCommand.scala:564)
        at kafka.admin.ConfigCommand$.describeConfig(ConfigCommand.scala:542)
        at kafka.admin.ConfigCommand$.processCommand(ConfigCommand.scala:343)
        at kafka.admin.ConfigCommand$.main(ConfigCommand.scala:97)
        at kafka.admin.ConfigCommand.main(ConfigCommand.scala)
   Caused by: org.apache.kafka.common.errors.InvalidRequestException: Config 
type client-metrics is only supported on KRaft clusters
   ```
   
   #### Alter:
   
   ```
   ./bin/kafka-configs.sh --bootstrap-server localhost:9092 --alter 
--entity-type client-metrics --entity-name METRICSUB2 --add-config 
"interval.ms=1000"
   
   Error while executing config command with args '--bootstrap-server 
localhost:9092 --alter --entity-type client-metrics --entity-name METRICSUB2 
--add-config interval.ms=1000'
   java.util.concurrent.ExecutionException: 
org.apache.kafka.common.errors.InvalidRequestException: Config type 
client-metrics is only supported on KRaft clusters
        at 
java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
        at 
java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
        at 
org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:180)
        at kafka.admin.ConfigCommand$.getResourceConfig(ConfigCommand.scala:610)
        at kafka.admin.ConfigCommand$.alterConfig(ConfigCommand.scala:450)
        at kafka.admin.ConfigCommand$.processCommand(ConfigCommand.scala:341)
        at kafka.admin.ConfigCommand$.main(ConfigCommand.scala:97)
        at kafka.admin.ConfigCommand.main(ConfigCommand.scala)
   Caused by: org.apache.kafka.common.errors.InvalidRequestException: Config 
type client-metrics is only supported on KRaft clusters
   ```
   
   #### With zookeeper as arg:
   
   ```
   ./bin/kafka-configs.sh -zookeeper localhost:9071 --describe --entity-type 
client-metrics --entity-name METRICSUB2
   
   Invalid entity type client-metrics, the entity type must be one of users, 
brokers with a --zookeeper argument
   ```
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
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

Reply via email to