health

package
v0.0.0-...-d5eddb0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2018 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeAllHealthChecksEndpoint

func MakeAllHealthChecksEndpoint(hc HealthChecker) endpoint.Endpoint

MakeAllHealthChecksEndpoint makes an endpoint that does all health checks.

func MakeComponentLoggingMW

func MakeComponentLoggingMW(logger log.Logger) func(HealthChecker) HealthChecker

MakeComponentLoggingMW makes a logging middleware at component level.

func MakeEndpointCorrelationIDMW

func MakeEndpointCorrelationIDMW(g IDGenerator) endpoint.Middleware

MakeEndpointCorrelationIDMW makes a middleware that adds a correlation ID in the context if there is not already one.

func MakeEndpointLoggingMW

func MakeEndpointLoggingMW(logger log.Logger) endpoint.Middleware

MakeEndpointLoggingMW makes a logging middleware.

func MakeExecInfluxHealthCheckEndpoint

func MakeExecInfluxHealthCheckEndpoint(hc HealthChecker) endpoint.Endpoint

MakeExecInfluxHealthCheckEndpoint makes the InfluxHealthCheck endpoint that forces the execution of the health checks.

func MakeExecJaegerHealthCheckEndpoint

func MakeExecJaegerHealthCheckEndpoint(hc HealthChecker) endpoint.Endpoint

MakeExecJaegerHealthCheckEndpoint makes the JaegerHealthCheck endpoint that forces the execution of the health checks.

func MakeExecRedisHealthCheckEndpoint

func MakeExecRedisHealthCheckEndpoint(hc HealthChecker) endpoint.Endpoint

MakeExecRedisHealthCheckEndpoint makes the RedisHealthCheck endpoint that forces the execution of the health checks.

func MakeExecSentryHealthCheckEndpoint

func MakeExecSentryHealthCheckEndpoint(hc HealthChecker) endpoint.Endpoint

MakeExecSentryHealthCheckEndpoint makes the SentryHealthCheck endpoint that forces the execution of the health checks.

func MakeHealthCheckHandler

func MakeHealthCheckHandler(e endpoint.Endpoint) *http_transport.Server

MakeHealthCheckHandler make an HTTP handler for an HealthCheck endpoint.

func MakeReadInfluxHealthCheckEndpoint

func MakeReadInfluxHealthCheckEndpoint(hc HealthChecker) endpoint.Endpoint

MakeReadInfluxHealthCheckEndpoint makes the InfluxHealthCheck endpoint that read the last health check status in DB.

func MakeReadJaegerHealthCheckEndpoint

func MakeReadJaegerHealthCheckEndpoint(hc HealthChecker) endpoint.Endpoint

MakeReadJaegerHealthCheckEndpoint makes the JaegerHealthCheck endpoint that read the last health check status in DB.

func MakeReadRedisHealthCheckEndpoint

func MakeReadRedisHealthCheckEndpoint(hc HealthChecker) endpoint.Endpoint

MakeReadRedisHealthCheckEndpoint makes the RedisHealthCheck endpoint that read the last health check status in DB.

func MakeReadSentryHealthCheckEndpoint

func MakeReadSentryHealthCheckEndpoint(hc HealthChecker) endpoint.Endpoint

MakeReadSentryHealthCheckEndpoint makes the SentryHealthCheck endpoint that read the last health check status in DB.

Types

type Component

type Component struct {
	// contains filtered or unexported fields
}

Component is the Health component.

func NewComponent

func NewComponent(influx InfluxHealthChecker, jaeger JaegerHealthChecker, redis RedisHealthChecker, sentry SentryHealthChecker, storage StoreModule, healthCheckValidity map[string]time.Duration) *Component

NewComponent returns the health component.

func (*Component) AllHealthChecks

func (c *Component) AllHealthChecks(ctx context.Context) json.RawMessage

AllHealthChecks call all component checks and build a general health report.

func (*Component) ExecInfluxHealthChecks

func (c *Component) ExecInfluxHealthChecks(ctx context.Context) json.RawMessage

ExecInfluxHealthChecks executes the health checks for Influx.

func (*Component) ExecJaegerHealthChecks

func (c *Component) ExecJaegerHealthChecks(ctx context.Context) json.RawMessage

ExecJaegerHealthChecks executes the health checks for Jaeger.

func (*Component) ExecRedisHealthChecks

func (c *Component) ExecRedisHealthChecks(ctx context.Context) json.RawMessage

ExecRedisHealthChecks executes the health checks for Redis.

func (*Component) ExecSentryHealthChecks

func (c *Component) ExecSentryHealthChecks(ctx context.Context) json.RawMessage

ExecSentryHealthChecks executes the health checks for Sentry.

func (*Component) ReadInfluxHealthChecks

func (c *Component) ReadInfluxHealthChecks(ctx context.Context) json.RawMessage

ReadInfluxHealthChecks read the health checks status in DB.

func (*Component) ReadJaegerHealthChecks

func (c *Component) ReadJaegerHealthChecks(ctx context.Context) json.RawMessage

ReadJaegerHealthChecks read the health checks status in DB.

func (*Component) ReadRedisHealthChecks

func (c *Component) ReadRedisHealthChecks(ctx context.Context) json.RawMessage

ReadRedisHealthChecks read the health checks status in DB.

func (*Component) ReadSentryHealthChecks

func (c *Component) ReadSentryHealthChecks(ctx context.Context) json.RawMessage

ReadSentryHealthChecks read the health checks status in DB.

type Endpoints

type Endpoints struct {
	InfluxExecHealthCheck endpoint.Endpoint
	InfluxReadHealthCheck endpoint.Endpoint
	JaegerExecHealthCheck endpoint.Endpoint
	JaegerReadHealthCheck endpoint.Endpoint
	RedisExecHealthCheck  endpoint.Endpoint
	RedisReadHealthCheck  endpoint.Endpoint
	SentryExecHealthCheck endpoint.Endpoint
	SentryReadHealthCheck endpoint.Endpoint
	AllHealthChecks       endpoint.Endpoint
}

Endpoints wraps a service behind a set of endpoints.

type HealthChecker

type HealthChecker interface {
	ExecInfluxHealthChecks(context.Context) json.RawMessage
	ReadInfluxHealthChecks(context.Context) json.RawMessage
	ExecJaegerHealthChecks(context.Context) json.RawMessage
	ReadJaegerHealthChecks(context.Context) json.RawMessage
	ExecRedisHealthChecks(context.Context) json.RawMessage
	ReadRedisHealthChecks(context.Context) json.RawMessage
	ExecSentryHealthChecks(context.Context) json.RawMessage
	ReadSentryHealthChecks(context.Context) json.RawMessage
	AllHealthChecks(context.Context) json.RawMessage
}

HealthChecker is the health component interface.

type IDGenerator

type IDGenerator interface {
	NextValidID(context.Context) string
}

IDGenerator is the interface of the distributed unique IDs generator.

type InfluxHealthChecker

type InfluxHealthChecker interface {
	HealthChecks(context.Context) []common.InfluxReport
}

InfluxHealthChecker is the interface of the influx health check module.

type JaegerHealthChecker

type JaegerHealthChecker interface {
	HealthChecks(context.Context) []common.JaegerReport
}

JaegerHealthChecker is the interface of the jaeger health check module.

type RedisHealthChecker

type RedisHealthChecker interface {
	HealthChecks(context.Context) []common.RedisReport
}

RedisHealthChecker is the interface of the redis health check module.

type SentryHealthChecker

type SentryHealthChecker interface {
	HealthChecks(context.Context) []common.SentryReport
}

SentryHealthChecker is the interface of the sentry health check module.

type Storage

type Storage interface {
	Exec(query string, args ...interface{}) (sql.Result, error)
	Query(query string, args ...interface{}) (*sql.Rows, error)
}

type StorageModule

type StorageModule struct {
	// contains filtered or unexported fields
}

StorageModule is the module that save health checks results in Storage DB.

func NewStorageModule

func NewStorageModule(componentName, componentID string, db Storage) *StorageModule

NewStorageModule returns the storage module.

func (*StorageModule) Clean

func (c *StorageModule) Clean() error

Clean deletes the old test reports that are no longer valid from the health DB table.

func (*StorageModule) Read

func (c *StorageModule) Read(unit string) (StoredReport, error)

Read reads the reports in DB.

func (*StorageModule) Update

func (c *StorageModule) Update(unit string, validity time.Duration, jsonReports json.RawMessage) error

Update updates the health checks reports stored in DB with the values 'jsonReports'.

type StoreModule

type StoreModule interface {
	Read(name string) (StoredReport, error)
	Update(unit string, validity time.Duration, reports json.RawMessage) error
}

StoreModule is the interface of the module that stores the health reports in the DB.

type StoredReport

type StoredReport struct {
	ComponentName   string
	ComponentID     string
	HealthcheckUnit string
	Reports         json.RawMessage
	LastUpdated     time.Time
	ValidUntil      time.Time
}

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL