From 848ad3d990a6758cee83aa7c804e6fd318c77985 Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Tue, 21 Jul 2015 12:40:20 -0700 Subject: [PATCH] Allow numeric statsd key name components Make sure BufferingStatsdDataFactory::normalizeMetricKey() doesn't delete digits in key names. Change-Id: I22baa81a88a3e0bc0d5b8b58bd6bb922c58a3255 --- includes/libs/BufferingStatsdDataFactory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/libs/BufferingStatsdDataFactory.php b/includes/libs/BufferingStatsdDataFactory.php index 192b119faf..3d7fad5179 100644 --- a/includes/libs/BufferingStatsdDataFactory.php +++ b/includes/libs/BufferingStatsdDataFactory.php @@ -42,7 +42,7 @@ class BufferingStatsdDataFactory extends StatsdDataFactory { /** * Normalize a metric key for StatsD * - * Replace occurences of '::' with dots and any other non-alphabetic + * Replace occurences of '::' with dots and any other non-alphanumeric * characters with underscores. Combine runs of dots or underscores. * Then trim leading or trailing dots or underscores. * @@ -51,7 +51,7 @@ class BufferingStatsdDataFactory extends StatsdDataFactory { */ private static function normalizeMetricKey( $key ) { $key = preg_replace( '/[:.]+/', '.', $key ); - $key = preg_replace( '/[^a-z.]+/i', '_', $key ); + $key = preg_replace( '/[^a-z0-9.]+/i', '_', $key ); $key = trim( $key, '_.' ); return str_replace( array( '._', '_.' ), '.', $key ); } -- 2.20.1