func EscapeMetricName(metricName string) string {
	metricLen := len(metricName)
	if metricLen == 0 {
		return ""
	}
	escaped := false
	var sb strings.Builder
	if metricName[0] >= '0' && metricName[0] <= '9' {
		escaped = true
		sb.Grow(metricLen + 1)
		sb.WriteByte('_')
	}
	offset := 0
	var prevChar rune
	for i, c := range metricName {
		if (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
			(c >= '0' && c <= '9') || (c == '_') {
		} else {
			if c == '-' && prevChar == '-' {
				offset = i + utf8.RuneLen(c)
				continue
			}
			if !escaped {
				escaped = true
				sb.Grow(metricLen)
			}
			sb.WriteString(metricName[offset:i])
			offset = i + utf8.RuneLen(c)
			sb.WriteByte('_')
		}
		prevChar = c
	}
	if !escaped {
		return metricName
	}
	if offset < metricLen {
		sb.WriteString(metricName[offset:])
	}
	return sb.String()
}
EscapeMetricName replaces invalid characters in the metric name with "_"
Valid characters are a-z, A-Z, 0-9, and _
package mapper
import (
	"strings"
	"unicode/utf8"
)