Versions Compared

Key

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

...

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

Motivation

Kafka authorization Current authorizer plugin cannot access to Kafka broker metrics information as plugin.  Kafka authorizer plugins need access to runtime broker Metrics instance.  There is disconnection for how to manage Metrics between broker and authorization and authorizer plugins in current Kafka implementation. The authorization The authorizer plugins as plugin of broker could use same Metrics instance as broker, so authorization plugin need not manage tasks like creating and configuring Metrics and JmxReporter. With the feature of this KIP, Authorizer plugin can use Metrics to manage and create Kafka metrics very easy.


Public Interfaces

AuthorizerServerInfo interface provides runtime broker configuration to authorization plugins including cluster resource, broker id, cluster id and endpoint information. A new method 'Metrics metrics()' for accessing to broker Metrics information in broker is added to this interface.

...

Both object and class of Broker in kafka.cluster.Broker.scala will be updated to accept a new parameter referring to Metricsto Kafka Metrics

Code Block
languagescala
titlekafka.cluster.Broker
object Broker {
  private[cluster] case class ServerInfo(clusterResource: ClusterResource,
                                         brokerId: Int,
                                         endpoints: util.List[Endpoint],
                                         interBrokerEndpoint: Endpoint,
										 metrics: Metrics) extends AuthorizerServerInfo
}

case class Broker(id: Int, endPoints: Seq[EndPoint], rack: Option[String]) {
  ......
  def toServerInfo(clusterId: String, config: KafkaConfig, metrics: Metrics): AuthorizerServerInfo = {
    val clusterResource: ClusterResource = new ClusterResource(clusterId)
    val interBrokerEndpoint: Endpoint = endPoint(config.interBrokerListenerName).toJava
    val brokerEndpoints: util.List[Endpoint] = endPoints.toList.map(_.toJava).asJava
    Broker.ServerInfo(clusterResource, id, brokerEndpoints, interBrokerEndpoint, metrics)
  }
}

...

Authorizer plugins create and configure own Metrics and JmxReport. Using this alternative approach make collecting Kafka metrics in Authorizer plugin separate from broker metrics that cause disconnection. Also Authorizer plugins Users need implement and manage own Metrics and JmsReport with extra effort.