com.codahale.metrics.graphite.GraphiteSanitize Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of metrics-graphite Show documentation
Show all versions of metrics-graphite Show documentation
A reporter for Metrics which announces measurements to a Graphite server.
package com.codahale.metrics.graphite;
import java.util.regex.Pattern;
class GraphiteSanitize {
private static final Pattern WHITESPACE = Pattern.compile("[\\s]+");
private static final String DASH = "-";
/**
* Trims the string and replaces all whitespace characters with the provided symbol
*/
static String sanitize(String string) {
return WHITESPACE.matcher(string.trim()).replaceAll(DASH);
}
}