code: public static ServiceMetadata create(BuildInfo buildInfo) {
      String hostName = null;
      try {
        hostName = InetAddress.getLocalHost().getHostName();
      } catch (UnknownHostException e) {
        LOGGER.warn("Unable to determine host name", e);
      }
      return builder()
          .setBuildInfo(buildInfo)
          .setHostName(hostName)
          .setStartupTime(Instant.now())
          .build();
    }
docs: Creates an instance of {@code ServiceMetadata} with the given build info, using the current
  time for startup time and determining the host name automatically.