Error handling, max line length

Improve error handling throughout the code base.

Log the first time that a metric can't be retrieved but be silent on
future attempts.

Add configurable max line length and batching of metrics per job up to
the max line length (then continue on the next line).