mirror of
https://github.com/prometheus/statsd_exporter.git
synced 2024-12-24 14:30:29 +00:00
Add comments explaining escapeMetricName
Signed-off-by: Brian Akins <brian@akins.org>
This commit is contained in:
parent
7f70979120
commit
cfcf3c9ba5
1 changed files with 4 additions and 0 deletions
|
@ -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') {
|
||||
|
|
Loading…
Reference in a new issue