Wikia/app — pull request #5837 by macbre (2014-12-19 15:20:00+00:00)
Title: PLATFORM-292 memcache monitoring

Gather memcache operations statistics (**number of gets, sets, deletes, misses and hits**) and more detailed keys stats to get **the list of top hits and misses**.

Memcache **keys are normalized**:

* wiki-specific prefix is removed (replaced with ``*``)
* all IDs and hashes key parts (`[a-f0-9]+`) are replaced with ``*`` as well

Example stats packet:

```php
Array
(
[0] => Array
(
[time] => 1418994389.3468
[event] => memcache_stats_counters
[data] => Array
(
[name] => get
[value] => 92
)

)

[1] => Array
(
[time] => 1418994389.3469
[event] => memcache_stats_counters
[data] => Array
(
[name] => miss
[value] => 72
)

)

[2] => Array
(
[time] => 1418994389.3471
[event] => memcache_stats_counters
[data] => Array
(
[name] => set
[value] => 73
)

)

[3] => Array
(
[time] => 1418994389.3472
[event] => memcache_stats_counters
[data] => Array
(
[name] => add
[value] => 4
)

)

[4] => Array
(
[time] => 1418994389.3473
[event] => memcache_stats_counters
[data] => Array
(
[name] => delete
[value] => 3
)

)

[5] => Array
(
[time] => 1418994389.3474
[event] => memcache_stats_keys
[data] => Array
(
[bucket] => hits
[key] => WikiFactory::getCategories:*
)

)

[6] => Array
(
[time] => 1418994389.3475
[event] => memcache_stats_keys
[data] => Array
(
[bucket] => hits
[key] => *:user:id:*
)

)

[7] => Array
(
[time] => 1418994389.3475
[event] => memcache_stats_keys
[data] => Array
(
[bucket] => hits
[key] => wikicities:user_touched:*
)

)
)
```

$wgMemcacheStatsSampling will be used to set a sampling rate of stats being sent to InfluxDB.

@wladekb / @jcellary / @michalroszka