package hello;

import lombok.Data;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.UnknownHostException;

import static java.net.InetAddress.getLocalHost;
import static java.time.OffsetDateTime.now;
import static org.springframework.web.bind.annotation.RequestMethod.GET;

/**
 * {@code Heartbeat} <strong>needs documentation</strong>.
 *
 * @author <a href="mailto:boxley@thoughtworks.com">Brian Oxley</a>
 * @todo Needs documentation
 */
@RestController
public class HeartbeatController {
    @RequestMapping(value = "/heartbeat", method = GET)
    public Heartbeat beat()
            throws UnknownHostException {
        return new Heartbeat();
    }

    @Data
    public static class Heartbeat {
        private final String hostname;
        private final String timestamp = now().toString();

        public Heartbeat()
                throws UnknownHostException {
            hostname = getLocalHost().getCanonicalHostName();
        }
    }
}

@@ -218,80 +218,293 @@
 ava.
-net.InetAddress.getLocalHost;%0Aimport static java.time.OffsetDateTime.now
+lang.management.ManagementFactory.getRuntimeMXBean;%0Aimport static java.net.InetAddress.getLocalHost;%0Aimport static java.time.Instant.ofEpochMilli;%0Aimport static java.time.OffsetDateTime.now;%0Aimport static java.time.OffsetDateTime.ofInstant;%0Aimport static java.time.ZoneId.systemDefault
 ;%0Aim
@@ -1101,16 +1101,178 @@
 tring();
+%0A        private final String startTime = ofInstant(%0A                ofEpochMilli(getRuntimeMXBean().getStartTime()),%0A                systemDefault()).toString();
 %0A%0A      
@@ -1330,32 +1330,32 @@
 HostException %7B%0A
+
             host
@@ -1383,17 +1383,8 @@
 .get
-Canonical
 Host

Add start time to heartbeat.