Status

Current state: Under Discussion

Discussion thread: https://lists.apache.org/thread/r35hd66pvqcmhn9f4cdjzqrszydk44yp

JIRA: TODO

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

Motivation

KIP-896 made added metrics which help monitor if there are any clients using Deprecated APIs.

The metric at present however falls short in identifying which user is sending Deprecated API requests.

This identification is specially useful in Kafka deployments where multiple users may use the same Kafka client and the principal is the only way to disambiguate between them.

Public Interfaces

Update metric kafka.network:type=RequestMetrics,name=DeprecatedRequestsPerSec,request=(api-name),version=(api-version),clientSoftwareName=(client-software-name),clientSoftwareVersion=(client-software-version) and add a user tag whose value is the sanitized KafkaPrincipal name.


Gate the addition of the user  tag on a configuration


MetricConfigs.java
// ...
public static final String DEPRECATED_REQUESTS_TAG_USER_ENABLED_CONFIG = "kafka.metrics.deprecated.requests.tag.user.enabled";
public static final String DEPRECATED_REQUESTS_TAG_USER_ENABLED_DOC = "Whether to add the KafkaPrincipal as a tag in Deprecated API Requests metrics";
public static final Boolean DEPRECATED_REQUESTS_TAG_USER_ENABLED_DEFAULT = false;

// ...


Proposed Changes

  1. record DeprecatedRequestRateKey will be updated to accept a String principalName field.
  2. RequestMetrics#deprecatedRequestRate will be updated to accept a String principalName field and call-sites will be updated to pass the appropriate value using RequestContext.
  3. The tag will be conditially added only if kafka.metrics.deprecated.requests.tag.user.enabled  is true 

Compatibility, Deprecation, and Migration Plan

  • The change remains backwards compatible.

Test Plan

A unit test will be added to ensure the tag is set properly.

Rejected Alternatives

Unconditionally adding the principal tag

Always adding the principal tag may lead to high cardinality issues as the Kafka cluster may potentially be used by a lot of users running on Deprecated API versions. We therefore gate the change behind a config so that administrators can opt into it.

  • No labels