Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HostMetricsRegistry ¶
type HostMetricsRegistry interface { HostMetrics(serviceName string, hostname string, port string) HostStatus AllServices() map[ServiceName]map[HostPort]HostStatus }
func NewHostRegistry ¶
func NewHostRegistry(windowSize time.Duration) HostMetricsRegistry
NewHostRegistry returns a new HostMetricsRegistry that is safe for concurrent use and should generally be used as a singleton per application. Metrics are used for internal tracking and not registered on the default registry emitted by witchcraft.
type HostStatus ¶
type ServiceDependencyHealthCheck ¶
type ServiceDependencyHealthCheck struct {
// contains filtered or unexported fields
}
func NewServiceDependencyHealthCheck ¶
func NewServiceDependencyHealthCheck() *ServiceDependencyHealthCheck
NewServiceDependencyHealthCheck returns the SERVICE_DEPENDENCY health check. For each service, it measures the ratio of submitted results representing errors from each host. When a host returns fewer 2xx responses than 5xx and network errors, it is unhealthy.
This should be a singleton within an application. No (known) support exists for merging multiple service dependency checks.
func (*ServiceDependencyHealthCheck) HealthStatus ¶
func (h *ServiceDependencyHealthCheck) HealthStatus(context.Context) health.HealthStatus
HealthStatus iterates through all tracked hosts for each service. If there are both healthy and unhealthy hosts, the check is HEALTHY but details are included in the message and params. If there are only unhealthy hosts for at least one service, the check is WARNING.
func (*ServiceDependencyHealthCheck) Middleware ¶
func (h *ServiceDependencyHealthCheck) Middleware(serviceName string) httpclient.Middleware
type ServiceDependencyMiddleware ¶
type ServiceDependencyMiddleware struct {
// contains filtered or unexported fields
}
func (ServiceDependencyMiddleware) RoundTrip ¶
func (m ServiceDependencyMiddleware) RoundTrip(req *http.Request, next http.RoundTripper) (*http.Response, error)
type ServiceName ¶
type ServiceName string