Bug: T232907
Change-Id: Ia61256e24fe35803e69a83a1ca235e18297c75cd
*/
private function determineKeyClassForStats( $key ) {
$parts = explode( ':', $key, 3 );
-
- return $parts[1] ?? $parts[0]; // sanity
+ // Sanity fallback in case the key was not made by makeKey.
+ // Replace dots because they are special in StatsD (T232907)
+ return strtr( $parts[1] ?? $parts[0], '.', '_' );
}
/**
[ 'domain:page:5', 'page' ],
[ 'domain:main-key', 'main-key' ],
[ 'domain:page:history', 'page' ],
+ // Regression test for T232907
+ [ 'domain:foo-bar-1.2:abc:v2', 'foo-bar-1_2' ],
[ 'missingdomainkey', 'missingdomainkey' ]
];
}