Add comments explaining escapeMetricName

Signed-off-by: Brian Akins <brian@akins.org>
This commit is contained in:
Brian Akins 2019-04-09 14:10:26 -04:00
parent 7f70979120
commit cfcf3c9ba5

View file

@ -288,6 +288,10 @@ func escapeMetricName(metricName string) string {
out := make([]byte, len(metricName))
j := 0
for _, c := range metricName {
// check if the rune is valid for a metric name
// and replace it if it is not.
// As only certain ASCII characters are valid in metric names,
// we can use a byte.
if (c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z') ||
(c >= '0' && c <= '9') {