Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Status

Current state"Under Discussion"Accepted

Discussion thread: here [Change the link from the KIP proposal email archive to your own email thread]

JIRA: here [Change the link from KAFKA-1 to your own ticket]15831

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

...

ListClientMetricsResources RPC

Client metrics configuration is only supported for KRaft clusters. This KIP is only supported for KRaft clusters.

Code Block
{
  "apiKey": XX,
  "type": "request",
  "listeners": ["broker", "zkBroker", "controller"],
  "name": "ListClientMetricsResourcesRequest",
  "validVersions": "0",
  "flexibleVersions": "0+",
  "fields": [
  ]}
}

{
  "apiKey": XX,
  "type": "response",
  "name": "ListClientMetricsResourcesResponse",
  "validVersions": "0",
  "flexibleVersions": "0+",
  "fields": [
      { "name": "ThrottleTimeMs", "type": "int32", "versions": "0+",
        "about": "The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota." },
      { "name": "ErrorCode", "type": "int16", "versions": "0+" },
      { "name": "ClientMetricsResources", "type": "[]ClientMetricsResourcesListClientMetricsResource", "versions": "0+", "fields": [
        { "name": "Name", "type": "string", "versions": "0+" }
      ]}
  ]
}

Admin Client

The following methods are added to the org.apache.kafka.client.admin.Admin interface.

...

The options are defined as follows:

Code Block
languagejava
package org.apache.kafka.client.admin;

/**
 * Options for {@link Admin#listClientMetricsResources()}.
 *
 * The API of this class is evolving, see {@link Admin} for details.
 */
@InterfaceStability.Evolving
public class ListClientMetricsResourcesOptions extends AbstractOptions<ListClientMetricsResourcesOptions> {
}

The result is defined as follows:

Code Block
languagejava
package org.apache.kafka.clients.admin;

/**
 * The result of the {@link Admin#listClientMetricsResources()} call.
 * <p>
 * The API of this class is evolving, see {@link Admin} for details.
 */
@InterfaceStability.Evolving
public class ListClientMetricsResourcesResult {
    /**
     * Returns a future that yields either an exception, or the full set of client metrics
     * resource listings.
     *
     * In the event of a failure, the future yields nothing but the first exception which
     * occurred.
     */
    public KafkaFuture<Collection<ClientMetricsResourceListing>> all() {
    }
}

And finally the listing itself, which is initially only the name:

Code Block
languagejava
package org.apache.kafka.clients.admin;

@InterfaceStability.Evolving
public class ClientMetricsResourceListing {
    private final String name;

    public ClientMetricsResourceListing(
        String name
    ) {
        this.name = name;
    }

    public String name() {
        return name;
    }
}

Tools

kafka-client-metrics.sh

A new option --list  is added to kafka-client-metrics.sh which lists the client metrics resources without describing them.

Code Block
languagebash
$ kafka-client-metrics.sh --bootstrap-server $BROKERS --list

Security

Client metrics configuration resources are secured using the CLUSTER resource.

...