Hooks: Bump scribunto-stats cache version

The Wikimedia\PSquare class has changed such that its serialization
is incompatible with its prior version. We should probably refactor
this to use an actually supported serialization format, possibly
by enhancing PSquare with some kind of getter method that provides
a plain array that its constructor can accept again instead of relying
on internal PHP serialisation format, but for now we can bump the
cache version.

The side-effect of this will be that the performance stats captured
by Scribunto for visualiation in Grafana, will briefly split its
sampling logic between two versions instead of being global across
all wikis until the train is fully deployed. This does not have any
effect on its business logic or runtime behaviour, and is presumably
by design as that's the only way to bump the cache version, which was
a pre-existing factor in its cache key.

Basically, this means that during the deployment days on weeks where
this is bumped, we will briefly capture fewer samples as there are then
two separate counters trying to reach 1000 before flushing a median
to Graphite. We can remedy that by backporting and deploying to both.

While at it, I'm changing the cache key to conform to our conventions
and make it an explicit, greppable, lowercase and descriptive name
(scribuntu-stats) instead of the implicit __METHOD__ which expanded
to "Scribunto\Hooks::reportTiming". I note that this means the split
brain sampling actually happened at least once before during the week
where the namespace was introduced as that will have implicily changed
the cache-key. Another reason not to use __METHOD__ in a cache key.

Bug: T313341
Change-Id: Ic9dad0f55cba18ec03272b87366a091a396beb74
This commit is contained in:
Timo Tijhof 2022-07-19 14:40:06 -05:00
parent 2dbc3c359e
commit e5362f639e

View file

@ -227,8 +227,8 @@ class Hooks {
return;
}
$cacheVersion = '1';
$key = $cache->makeGlobalKey( __METHOD__, $cacheVersion, (string)$threshold );
$cacheVersion = '2';
$key = $cache->makeGlobalKey( 'scribunto-stats', $cacheVersion, (string)$threshold );
// This is a classic "read-update-write" critical section with no
// mutual exclusion, but the only consequence is that some samples