Limit collect-metrics hook to fire only on charms that have metrics declared.

This is a backport of fix for https://bugs.launchpad.net/juju-core/+bug/1392507, already landed in master.