github.com/MetalBlockchain/metalgo@v1.11.9/api/health/result.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package health
     5  
     6  import "time"
     7  
     8  // notYetRunResult is the result that is returned when a HealthCheck hasn't been
     9  // run yet.
    10  var notYetRunResult Result
    11  
    12  func init() {
    13  	err := "not yet run"
    14  	notYetRunResult = Result{
    15  		Error: &err,
    16  	}
    17  }
    18  
    19  type Result struct {
    20  	// Details of the HealthCheck.
    21  	Details interface{} `json:"message,omitempty"`
    22  
    23  	// Error is the string representation of the error returned by the failing
    24  	// HealthCheck. The value is nil if the check passed.
    25  	Error *string `json:"error,omitempty"`
    26  
    27  	// Timestamp of the last HealthCheck.
    28  	Timestamp time.Time `json:"timestamp,omitempty"`
    29  
    30  	// Duration is the amount of time this HealthCheck last took to evaluate.
    31  	Duration time.Duration `json:"duration"`
    32  
    33  	// ContiguousFailures the HealthCheck has returned.
    34  	ContiguousFailures int64 `json:"contiguousFailures,omitempty"`
    35  
    36  	// TimeOfFirstFailure of the HealthCheck,
    37  	TimeOfFirstFailure *time.Time `json:"timeOfFirstFailure,omitempty"`
    38  }