Only use statsd if configured.

Fixes bug 1116542.

Wrap any references to statsd's methods in a check for the statsd
object, since it will be None and thus evaluate False when not
configured.

Change-Id: Ia07afd9dde6a30b3f7bdcb2bc336494d28e714a3