Found while working on T374048: Migrate GrowthExperiments.Mentorship Module to statslib. It seems the statsd client is checking for all metric names to end with _total (see source). While that is correct for counter metrics, the recommendations docs state that _seconds should be used for timing metrics.
Steps to replicate the issue (include links if applicable):
- Make a call to mw.track with stats. prefix and _seconds suffix, eg: mw.track( 'stats.mediawiki_growth_experiments_navigation_duration_seconds', 123 )
What happens?:
An error is thrown:
TypeError: Invalid stat name mediawiki_growth_experiments_navigation_duration_seconds
at formatDogstatsd (statsd.js:115:17)
at statsd.js:151:15
at Object.handler (mediawiki.base.js:416:5)
at fire (jquery.js:3223:31)
at Object.fireWith (jquery.js:3353:7)
at Object.fire (jquery.js:3361:10)
at mw.track (mediawiki.base.js:386:17)
...What should have happened instead?:
The track call should succeed