https://prometheus.io/docs/instrumenting/writing_clientlibs/#labels
Client libraries MUST NOT allow users to have different label names for the same metric for Gauge/Counter/Summary/Histogram or any other Collector offered by the library.
This check is not occurring and enabling the following behavior:
# initialize metric 'foo' and cache it $m = getStatsFactory()->getCounter('foo')->setLabel('bar', 'a'); $m->increment(); # MediaWiki_foo{bar=a} 1 # now fetch same metric from cache, but forget to set the label $m = getStatsFactory()->getCounter('foo'); $m->getLabelKeys(); # ['bar'] $m->increment(); # MediaWiki_foo{} 1 # now set a new label on the same metric # this is caught by setLabel() disallowing adding labels when samples are recorded $m = getStatsFactory()->getCounter('foo')->setLabel('baz', 'a'); # NullMetric $m->increment(); # no effect