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

    https://github.com/apache/flink/pull/4188#discussion_r124219665
  
    --- Diff: 
flink-metrics/flink-metrics-statsd/src/main/java/org/apache/flink/metrics/statsd/StatsDReporter.java
 ---
    @@ -90,6 +109,45 @@ public void close() {
     
        // 
------------------------------------------------------------------------
     
    +   /**
    +    * Removes leading and trailing angle brackets.
    +    */
    +   private String stripBrackets(String str) {
    +           return str.substring(1, str.length() - 1);
    +   }
    +
    +   @Override
    +   public void notifyOfAddedMetric(Metric metric, String metricName, 
MetricGroup group) {
    +           if (dogstatsdMode) {
    +                   // memoize dogstatsd tag section: 
"|#tag:val,tag:val,tag:val"
    +                   StringBuilder statsdTagLine = new StringBuilder();
    +                   Map<String, String> orderedTags = new 
TreeMap<>(group.getAllVariables());
    +                   for (Map.Entry<String, String> entry: 
orderedTags.entrySet()) {
    +                           String k = stripBrackets(entry.getKey());
    +                           String v = filterCharacters(entry.getValue());
    +                           
statsdTagLine.append(",").append(k).append(":").append(v);
    +                   }
    +                   if (statsdTagLine.length() > 0) {
    --- End diff --
    
    this check can be omitted since the tab line can never be empty.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to