yulei0824 commented on a change in pull request #16645:
URL: https://github.com/apache/flink/pull/16645#discussion_r679799052
##########
File path:
flink-metrics/flink-metrics-influxdb/src/main/java/org/apache/flink/metrics/influxdb/MetricMapper.java
##########
@@ -71,8 +75,24 @@ static Point map(MeasurementInfo info, Instant timestamp,
Meter meter) {
}
private static Point.Builder builder(MeasurementInfo info, Instant
timestamp) {
- return Point.measurement(info.getName())
- .tag(info.getTags())
+ return Point.measurement(normalize(info.getName()))
+ .tag(normalize(info.getTags()))
.time(timestamp.toEpochMilli(), TimeUnit.MILLISECONDS);
}
+
+ private static String normalize(String value) {
+ return value != null ? value.replace(POINT_DELIMITER, "") : null;
+ }
+
+ private static Map<String, String> normalize(Map<String, String> map) {
+ if (map != null) {
+ Map<String, String> normalizedMap = new HashMap<>(map.size() * 4 /
3 + 1);
+ for (Map.Entry<String, String> entry : map.entrySet()) {
+ normalizedMap.put(normalize(entry.getKey()),
normalize(entry.getValue()));
+ }
+ return normalizedMap;
+ } else {
+ return null;
+ }
+ }
Review comment:
ok
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]