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

Omit empty fields of State struct #64

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions health.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ type Config struct {
// run of a particular check.
type State struct {
// Name of the health check
Name string `json:"name"`
Name string `json:"name,omitempty"`

// Status of the health check state ("ok" or "failed")
Status string `json:"status"`
Expand All @@ -101,17 +101,17 @@ type State struct {
Err string `json:"error,omitempty"`

// Fatal shows if the check will affect global result
Fatal bool `json:"fatal,omitempty"`
Fatal bool `json:"fatal"`

// Details contains more contextual detail about a
// failing health check.
Details interface{} `json:"details,omitempty"` // contains JSON message (that can be marshaled)

// CheckTime is the time of the last health check
CheckTime time.Time `json:"check_time"`
CheckTime time.Time `json:"check_time,omitempty"`

ContiguousFailures int64 `json:"num_failures"` // the number of failures that occurred in a row
TimeOfFirstFailure time.Time `json:"first_failure_at"` // the time of the initial transitional failure for any given health check
ContiguousFailures int64 `json:"num_failures,omitempty"` // the number of failures that occurred in a row
TimeOfFirstFailure time.Time `json:"first_failure_at,omitempty"` // the time of the initial transitional failure for any given health check
}

// indicates state is failure
Expand Down