Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kes: fix uptime in status en/decoding #11

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions kes/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (s State) MarshalJSON() ([]byte, error) {
Version string `json:"version,omitempty"`
OS string `json:"os,omitempty"`
Arch string `json:"arch,omitempty"`
UpTime time.Duration `json:"uptime,omitempty"`
UpTime float64 `json:"uptime,omitempty"`
CPUs int `json:"num_cpu,omitempty"`
UsableCPUs int `json:"num_cpu_used,omitempty"`
HeapAlloc uint64 `json:"mem_heap_used,omitempty"`
Expand All @@ -55,7 +55,7 @@ func (s State) MarshalJSON() ([]byte, error) {
Version: s.Version,
OS: s.OS,
Arch: s.Arch,
UpTime: s.UpTime,
UpTime: s.UpTime.Round(time.Second).Seconds(),
CPUs: s.CPUs,
UsableCPUs: s.UsableCPUs,
HeapAlloc: s.HeapAlloc,
Expand All @@ -72,7 +72,7 @@ func (s *State) UnmarshalJSON(data []byte) error {
Version string `json:"version"`
OS string `json:"os"`
Arch string `json:"arch"`
UpTime time.Duration `json:"uptime"`
UpTime float64 `json:"uptime"`
CPUs int `json:"num_cpu"`
UsableCPUs int `json:"num_cpu_used"`
HeapAlloc uint64 `json:"mem_heap_used"`
Expand All @@ -99,7 +99,7 @@ func (s *State) UnmarshalJSON(data []byte) error {
s.Version = v.Version
s.OS = v.OS
s.Arch = v.Arch
s.UpTime = v.UpTime
s.UpTime = time.Duration(v.UpTime * float64(time.Second))
s.CPUs = v.CPUs
s.UsableCPUs = v.UsableCPUs
s.HeapAlloc = v.HeapAlloc
Expand Down
Loading