Github user NicoK commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4110#discussion_r126442516
  
    --- Diff: 
flink-metrics/flink-metrics-dropwizard/src/main/java/org/apache/flink/dropwizard/ScheduledDropwizardReporter.java
 ---
    @@ -184,7 +188,10 @@ public void notifyOfRemovedMetric(Metric metric, 
String metricName, MetricGroup
        @Override
        public String filterCharacters(String metricName) {
                char[] chars = null;
    -           final int strLen = metricName.length();
    +           if (metricName.length() > maxComponentLength) {
    +                   log.warn("The metric name component {} exceeded the {} 
characters length limit and was truncated.", metricName, maxComponentLength);
    +           }
    +           final int strLen = Math.min(metricName.length(), 
maxComponentLength);
    --- End diff --
    
    You actually don't need to call `Math.min()` anymore after you already 
checked the condition for the warning message. You could thus assign `strLen` 
yourself.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to