flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From NicoK <...@git.apache.org>
Subject [GitHub] flink pull request #4110: [FLINK-6900] [metrics] Limit size of metric name c...
Date Mon, 10 Jul 2017 14:49:28 GMT
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message