cuishuang created KAFKA-21041:
---------------------------------

             Summary: ClientMetricsConfigs rejects match patterns whose regex 
contains an equals sign
                 Key: KAFKA-21041
                 URL: https://issues.apache.org/jira/browse/KAFKA-21041
             Project: Kafka
          Issue Type: Bug
    Affects Versions: 4.3.1
            Reporter: cuishuang


ClientMetricsConfigs.parseMatchingPatterns currently splits client match 
patterns using String.split("="), which splits on every equals sign.

The method Javadoc specifies that a client match pattern is split into two 
parts at the first occurrence of '='.

For example:

    client_id=foo=bar

should be parsed as:

    parameter: client_id
    regex:    foo=bar

However, the current implementation produces three parts and throws 
InvalidConfigurationException.

Expected behavior:


The first '=' separates the parameter name from the regular expression, and 
additional '=' characters remain part of the regular expression.

Actual behavior:


Patterns whose regular expression contains '=' are rejected.

A fix using split("=", 2), together with a regression test, restores the 
behavior described by the existing Javadoc.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to