Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-13744

Quota metric tags are inconsistent

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Problem
    • None
    • None
    • core, metrics

    Description

      When enabling metrics for quotas the metrics apply to all clients (see https://issues.apache.org/jira/browse/KAFKA-13742).

      Though, the tags are calculated depending on the quotas registered and applied to all clients: https://github.com/apache/kafka/blob/0b9a8bac36f16b5397e9ec3a0441758e4b60a384/core/src/main/scala/kafka/server/ClientQuotaManager.scala#L649-L694

      This causes different metric tags result depending on which quota is registered first.

      For instance, if a quota is registered with userId and clientId, then metrics are tagged with both, though if then a quota is registered with only tagged with clientId, then all metrics are only tagged by clientId — even though user principal is available.

      I managed to reproduce this behavior here:

      • From 10:30 to 10:45, there was a quota with both client-id and user-id
      • It was removed by 10:45, so no metrics were exposed.
      • After, a quota with client id was created, and metrics were collected only with client id, even though the user was available.

      I'd expect metrics to always contain both, if available — and simplify the logic here https://github.com/apache/kafka/blob/0b9a8bac36f16b5397e9ec3a0441758e4b60a384/core/src/main/scala/kafka/server/ClientQuotaManager.scala#L649-L694.

      Attachments

        1. image-2022-03-15-16-57-12-583.png
          524 kB
          Jorge Esteban Quilcate Otoya

        Activity

          People

            Unassigned Unassigned
            jeqo Jorge Esteban Quilcate Otoya
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: