private boolean matchPatterns(Map<String, Pattern> matchingPatterns) {
        return matchingPatterns.entrySet().stream()
            .allMatch(entry -> {
                String attribute = attributesMap.get(entry.getKey());
                return attribute != null && entry.getValue().matcher(attribute).matches();
            });
    }
Information from the client's metadata is gathered from the client's request.
server/src/main/java/org/apache/kafka/server/metrics/ClientMetricsInstanceMetadata.java