migrating udpprofile from subversion
from: svn.wikimedia.org/svnroot/mediawiki/trunk/udpprofile
Last Changed Author: asher
Last Changed Rev: 113114
Last Changed Date: 2012-03-05 16:47:05 -0800 (Mon, 05 Mar 2012)

Change-Id: I76bf228ea95bea8fe47ce7d24749d98b42f64957
fix sort of floating point time samples for correct percentile calcs

Change-Id: Ia792427e05d53c716c2d7d9befbc247028354e94
update package changelog

Change-Id: I2db12092583c4c11be3c74d39fac3bd6b3d23214
moving carbon-collector pidfile somewhere ephemeral to prevent a stale file post-server crash

Change-Id: Ic2934b49b646b37575bfbb2c068e6a8b10eaf6c7
fix divide by zero exception when wfIncrStats(0) is called

Change-Id: I71550eabf27883ef05f1b9765a8b6fa214533ecd
cleanup for greater pep8 compliance

Change-Id: Idd76a8c2daea9bafa9822d355b8280499a38c679
- fix issue where export wouldn't work under high load, leading to graphs flipping between no data and huge spikes when a response was received minutes later

Change-Id: I2bc117d5620b9e545a8e5a6cf3b654ee835b75d7
pep8 cleanup for udpprofile

Change-Id: I3b149ab467e5aae2daf26b14829ec5b6b7d50a1e
Add .gitreview

Change-Id: I5da06952147a84bfefcc20e788158b4300d55368
Remove a line of commented-out code to touch repo for git-deploy

Change-Id: I4bdc31b7c52ca7aa5242e5cb7423f2888a4fe461
collector: allow listen port to be specified via COLLECTOR_PORT env var

Hack.

Change-Id: I1086ea52f98459d5b6abb57e42698d1361106d3d
parametrize profiler-to-carbon

Allow Carbon and collector host / port to be specified as command-line
arguments. Also make web/ a module and import it properly.

Change-Id: Ic731210fd1d77236402d438edd6ede1a0ef70427
Use glib's GHashTable instead of persistent BDB

I'd still like to rework this into something a bit nicer, but this patch takes
the heat off and allows me to finish moving Graphite to eqiad without feeling
like I'm moving an old problem to a new data center. It chugs along at 30-40%
CPU compared to the previous version which maxed out and dropped data.

Dumping stats in a separate thread would be nice but apparently not critical.
I removed the standalone 'exporter' tool as there is no longer a database file
for it to read.

Adds a dependency on libglib2.0-dev. The version in apt is 2.32, so the
relevant docs are: <https://developer.gnome.org/glib/2.32/glib-Hash-Tables.html>.

Change-Id: I47e4ed0bb2ec49cb4472716b21abb01526d0ee49
profiler-to-carbon: prefix profiling stats with 'MediaWiki'

Change-Id: Ifa3e1cdde662fd189744c98b7211105a1a599056
Annotate logging calls with exception info

Change-Id: I436dfadcd3db098f6feaedc1297238bf419b54f0
profiler-to-carbon: read entire socket buffer in one go

Change-Id: I13e02125acdec4ad5a430cf0c2397c6cb807ffcb
Fix typo in profiler-to-carbon and tweak client behavior

Change-Id: I6923ce665889ccd955b02e289c28277a21a87f1c
Delete unused files

Since this is shaping up to be a complete rewrite of udpprofile, get rid of its
cruft and keep only what we need.

Change-Id: I93f1c4030f024d96b592bb64f681cf6cf4e08404
Retab

Change-Id: Ia252de1f3e7980342d7f8fed4c3be20a695073f9
Rewrite for multithreading

My original intention was to use GLib only for its hash table implementation,
but the work acquainted me with GLib's generic C programming facilities, so I
thought I'd try to use it throughout.

* Process incoming stats in a worker thread, and make the UDP socket blocking,
  so that control flow is linear and clear.
* Serve XML via a TCP socket service running on GLib's main event loop. The
  service will handle incoming connections using a pool of up to ten worker
  threads.
* Make dumpData reentrant.
* Use a mutex to protect access to the stats hash table.
* Use a mutex to ensure stats updates are atomic.
* Don't daemonize; let Upstart take care of that.
* Allow listen port to be specified via '--listen-port' command-line argument.

Change-Id: Iad08d752401372ab4b4e7ed3135510f5f557e1ee