wiki.techinc.nl/tests/phpunit/unit/includes/libs/stats
Timo Tijhof 143a532b41 stats: Simplify normalizeMetricKey() and fix bad output for edge cases
This simplification effort is the result of a (failed) attempt to
micro-optimize this method. I submit it, despite it not being any
faster or slower, because I noticed that the simpler code actually
resulted in behaviours that I consider "less surprising".

* The method previously (I believe, unintentionally) treated all
  colons as segment separators. It now only treats double-colon (::)
  as segment separator.

  Thus "foo.bar:baz" became "foo.bar.baz", now "foo.bar_baz".

* Leading and trailing underscores are no longer removed from
  segments. This makes the former-presence of invalid characters
  more obvious to consumers and seems helpful.
  This also fixed two bugs:
  - In some cases, a segment could become the empty string, which is
    invalid for Graphite as each segment must be a directory name.
  - In some cases, segments could dissappear entirely, thus changing
    the hierarchy specified by the producer in ways they probably
    didn't expect.

* Avoid use of empty().

Change-Id: I8601faf1fe45124370a92d43e854608e623c1214
2021-09-10 19:39:30 +00:00
..
BufferingStatsdDataFactoryTest.php stats: Simplify normalizeMetricKey() and fix bad output for edge cases 2021-09-10 19:39:30 +00:00
PrefixingStatsdDataFactoryProxyTest.php