fix docker healthcheck formatting

This commit is contained in:
yusing
2024-12-13 12:44:20 +08:00
parent 17e8532e6f
commit 68b2d79700
2 changed files with 8 additions and 12 deletions

View File

@@ -28,6 +28,10 @@ func (jsonRepr *JSONRepresentation) MarshalJSON() ([]byte, error) {
if url == "http://:0" {
url = ""
}
lastSeen := "never"
if !jsonRepr.LastSeen.IsZero() {
lastSeen = strutils.FormatTime(jsonRepr.LastSeen)
}
return json.Marshal(map[string]any{
"name": jsonRepr.Name,
"config": jsonRepr.Config,
@@ -39,7 +43,7 @@ func (jsonRepr *JSONRepresentation) MarshalJSON() ([]byte, error) {
"latency": jsonRepr.Latency.Seconds(),
"latencyStr": strconv.Itoa(int(jsonRepr.Latency.Milliseconds())) + " ms",
"lastSeen": jsonRepr.LastSeen.Unix(),
"lastSeenStr": strutils.FormatTime(jsonRepr.LastSeen),
"lastSeenStr": lastSeen,
"detail": jsonRepr.Detail,
"url": url,
"extra": jsonRepr.Extra,