diff --git a/client.go b/client.go index cd0c2dd5..81387739 100644 --- a/client.go +++ b/client.go @@ -163,6 +163,8 @@ func (c *Client) Status(ctx context.Context) (State, error) { type Response struct { Version string `json:"version"` + OS string `json:"os"` + Arch string `json:"arch"` UpTime time.Duration `json:"uptime"` CPUs int `json:"num_cpu"` diff --git a/cmd/kes/status.go b/cmd/kes/status.go index 6cffa7fb..80d7ee80 100644 --- a/cmd/kes/status.go +++ b/cmd/kes/status.go @@ -149,9 +149,14 @@ func statusCmd(args []string) { faint.Render(fmt.Sprintf(" %-8s", "Latency")), latency.Round(time.Millisecond), ) + fmt.Println( + faint.Render(fmt.Sprintf(" %-8s", "OS")), + status.OS, + ) fmt.Println( faint.Render(fmt.Sprintf(" %-8s", "CPUs")), strconv.Itoa(status.UsableCPUs), + status.Arch, ) fmt.Println(faint.Render(fmt.Sprintf(" %-8s", "Memory"))) fmt.Println( diff --git a/internal/http/generic-api.go b/internal/http/generic-api.go index 5497f298..5dce7721 100644 --- a/internal/http/generic-api.go +++ b/internal/http/generic-api.go @@ -50,6 +50,8 @@ func status(mux *http.ServeMux, config *ServerConfig) API { ) type Response struct { Version string `json:"version"` + OS string `json:"os"` + Arch string `json:"arch"` UpTime time.Duration `json:"uptime"` CPUs int `json:"num_cpu"` @@ -86,6 +88,8 @@ func status(mux *http.ServeMux, config *ServerConfig) API { w.Header().Set("Content-Type", ContentType) json.NewEncoder(w).Encode(Response{ Version: sys.BinaryInfo().Version, + OS: runtime.GOOS, + Arch: runtime.GOARCH, UpTime: time.Since(startTime).Round(time.Second), CPUs: runtime.NumCPU(), diff --git a/server.go b/server.go index 867ac20f..4f91d341 100644 --- a/server.go +++ b/server.go @@ -8,17 +8,14 @@ import "time" // State is a KES server status snapshot. type State struct { - Version string `json:"version"` // The KES server version - - UpTime time.Duration `json:"uptime"` // The time the KES server has been up and running - - CPUs int `json:"num_cpu"` - - UsableCPUs int `json:"num_cpu_used"` - - HeapAlloc uint64 `json:"num_heap_used"` - - StackAlloc uint64 `json:"num_stack_used"` + Version string `json:"version"` // KES server version + OS string `json:"os"` // OS running the KES server + Arch string `json:"arch"` // CPU architecture the KES server is running on + UpTime time.Duration `json:"uptime"` // Time the KES server has been up and running + CPUs int `json:"num_cpu"` // Number of available logical CPU cores + UsableCPUs int `json:"num_cpu_used"` // Number of usbale logical CPU cores + HeapAlloc uint64 `json:"num_heap_used"` // Number of bytes currently allocated on the heap + StackAlloc uint64 `json:"num_stack_used"` // Number of bytes currently allocated on the stack } // API describes a KES server API.