Improve setting the "metric" field

The "metric" field is now set directly in the main foldr.

Additionally the "host" field now defaults to the system hostname instead of undefined.