Documentation
¶
Index ¶
- Constants
- func AssertHealthReportEqual(t *testing.T, expected, actual *health.HealthReport)
- func AssertHealthResultEqual(t *testing.T, expected, actual *health.HealthResult)
- func BenchmarkHealthCheck(b *testing.B, check health.HealthCheck)
- func BenchmarkHealthService(b *testing.B, service health.HealthService)
- func CreateHealthEndpoints(router shared.Router, healthService shared.HealthManager, logger logger.Logger, ...) error
- func CreateHealthEndpointsWithConfig(router shared.Router, healthService shared.HealthManager, logger logger.Logger, ...) error
- func CreateTestHealthReport(overall health.HealthStatus, services map[string]*health.HealthResult) *health.HealthReport
- func CreateTestHealthResult(name string, status health.HealthStatus, message string) *health.HealthResult
- func ExampleHealthTest(t *testing.T)
- func GetHealthServiceFromContainer(container shared.Container) (healthcore.HealthService, error)
- func New(config *HealthConfig, logger logger.Logger, metrics shared.Metrics, ...) shared.HealthManager
- func NewHealthChecker(config *HealthConfig, logger logger.Logger, metrics shared.Metrics, ...) shared.HealthManager
- func NewNoOpHealthManager() shared.HealthManager
- func RegisterHealthEndpointsWithContainer(container shared.Container, router shared.Router) error
- func RegisterHealthService(container shared.Container, conf *HealthConfig) error
- func WaitForHealthStatus(t *testing.T, service health.HealthService, expected health.HealthStatus, ...)
- type AggregatorConfig
- type AsyncHealthCheck
- type BaseHealthCheck
- type CompositeHealthCheck
- type EndpointConfig
- type HealthAggregator
- type HealthCallback
- type HealthCheck
- type HealthCheckConfig
- type HealthCheckFunc
- type HealthCheckWrapper
- type HealthChecker
- type HealthCheckerStats
- type HealthConfig
- type HealthEndpointHandlers
- type HealthEndpointManager
- type HealthPrediction
- type HealthReport
- type HealthReportCallback
- type HealthResult
- type HealthStatus
- type HealthStatusSnapshot
- type HealthTestBuilder
- func (htb *HealthTestBuilder) Build() *HealthTestSuite
- func (htb *HealthTestBuilder) WithCriticalCheck(name string, status health.HealthStatus) *HealthTestBuilder
- func (htb *HealthTestBuilder) WithCustomCheck(name string, checkFunc func(ctx context.Context) *health.HealthResult) *HealthTestBuilder
- func (htb *HealthTestBuilder) WithDegradedCheck(name string) *HealthTestBuilder
- func (htb *HealthTestBuilder) WithHealthyCheck(name string) *HealthTestBuilder
- func (htb *HealthTestBuilder) WithSlowCheck(name string, delay time.Duration) *HealthTestBuilder
- func (htb *HealthTestBuilder) WithUnhealthyCheck(name string) *HealthTestBuilder
- type HealthTestSuite
- func (hts *HealthTestSuite) AddHealthCheck(name string, status health.HealthStatus, message string) *MockHealthCheck
- func (hts *HealthTestSuite) AssertCheckCalled(name string, expectedCalls int)
- func (hts *HealthTestSuite) AssertDegraded()
- func (hts *HealthTestSuite) AssertHealthy()
- func (hts *HealthTestSuite) AssertMethodCalled(method string, expectedCalls int)
- func (hts *HealthTestSuite) AssertUnhealthy()
- func (hts *HealthTestSuite) Cleanup()
- func (hts *HealthTestSuite) GetHealthCheck(name string) *MockHealthCheck
- func (hts *HealthTestSuite) GetHealthService() *TestHealthService
- func (hts *HealthTestSuite) Start()
- func (hts *HealthTestSuite) Stop()
- type ManagerImpl
- func (hc *ManagerImpl) Check(ctx context.Context) *healthinternal.HealthReport
- func (hc *ManagerImpl) CheckOne(ctx context.Context, name string) *healthinternal.HealthResult
- func (hc *ManagerImpl) Environment() string
- func (hc *ManagerImpl) GetChecks() map[string]healthinternal.HealthCheck
- func (hc *ManagerImpl) GetLastReport() *healthinternal.HealthReport
- func (hc *ManagerImpl) GetStats() *healthinternal.HealthCheckerStats
- func (hc *ManagerImpl) GetStatus() healthinternal.HealthStatus
- func (hc *ManagerImpl) Hostname() string
- func (hc *ManagerImpl) Name() string
- func (hc *ManagerImpl) OnHealthCheck(ctx context.Context) error
- func (hc *ManagerImpl) Register(check healthinternal.HealthCheck) error
- func (hc *ManagerImpl) RegisterFn(name string, checkFn healthinternal.HealthCheckFunc) error
- func (hc *ManagerImpl) Reload(config *HealthConfig) error
- func (hc *ManagerImpl) SetContainer(container shared.Container)
- func (hc *ManagerImpl) SetEnvironment(name string)
- func (hc *ManagerImpl) SetHostname(hostname string)
- func (hc *ManagerImpl) SetVersion(version string)
- func (hc *ManagerImpl) Start(ctx context.Context) error
- func (hc *ManagerImpl) StartTime() time.Time
- func (hc *ManagerImpl) Stop(ctx context.Context) error
- func (hc *ManagerImpl) Subscribe(callback healthinternal.HealthCallback) error
- func (hc *ManagerImpl) Unregister(name string) error
- func (hc *ManagerImpl) Version() string
- type MockHealthCheck
- func (mhc *MockHealthCheck) Check(ctx context.Context) *health.HealthResult
- func (mhc *MockHealthCheck) Critical() bool
- func (mhc *MockHealthCheck) Dependencies() []string
- func (mhc *MockHealthCheck) GetCallCount() int
- func (mhc *MockHealthCheck) GetLastCall() time.Time
- func (mhc *MockHealthCheck) Name() string
- func (mhc *MockHealthCheck) ResetCallCount()
- func (mhc *MockHealthCheck) SetCheckFunc(fn func(ctx context.Context) *health.HealthResult)
- func (mhc *MockHealthCheck) SetCritical(critical bool)
- func (mhc *MockHealthCheck) SetDependencies(deps []string)
- func (mhc *MockHealthCheck) SetMessage(message string)
- func (mhc *MockHealthCheck) SetResult(result *health.HealthResult)
- func (mhc *MockHealthCheck) SetStatus(status health.HealthStatus)
- func (mhc *MockHealthCheck) SetTimeout(timeout time.Duration)
- func (mhc *MockHealthCheck) Timeout() time.Duration
- type PredictiveAggregator
- type SimpleHealthCheck
- type SmartAggregator
- type TestHealthChecker
- type TestHealthService
- func (ths *TestHealthService) CheckAll(ctx context.Context) *health.HealthReport
- func (ths *TestHealthService) CheckOne(ctx context.Context, name string) *health.HealthResult
- func (ths *TestHealthService) Checker() shared.HealthManager
- func (ths *TestHealthService) Dependencies() []string
- func (ths *TestHealthService) GetCallCount(method string) int
- func (ths *TestHealthService) GetCheck(name string) (health.HealthCheck, error)
- func (ths *TestHealthService) GetConfiguration() *health.HealthConfig
- func (ths *TestHealthService) GetEnvironment() string
- func (ths *TestHealthService) GetLastReport() *health.HealthReport
- func (ths *TestHealthService) GetMethodCalls() []string
- func (ths *TestHealthService) GetStats() *health.HealthCheckerStats
- func (ths *TestHealthService) GetStatus() health.HealthStatus
- func (ths *TestHealthService) GetVersion() string
- func (ths *TestHealthService) IsDegraded() bool
- func (ths *TestHealthService) IsHealthy() bool
- func (ths *TestHealthService) ListChecks() []string
- func (ths *TestHealthService) Name() string
- func (ths *TestHealthService) OnHealthCheck(ctx context.Context) error
- func (ths *TestHealthService) RegisterCheck(name string, check health.HealthCheck) error
- func (ths *TestHealthService) ResetCalls()
- func (ths *TestHealthService) SetError(method string, err error)
- func (ths *TestHealthService) SetLastReport(report *health.HealthReport)
- func (ths *TestHealthService) SetStatus(status health.HealthStatus)
- func (ths *TestHealthService) Start(ctx context.Context) error
- func (ths *TestHealthService) Stop(ctx context.Context) error
- func (ths *TestHealthService) Subscribe(callback health.HealthCallback) error
- func (ths *TestHealthService) UnregisterCheck(name string) error
Constants ¶
const ( HealthStatusHealthy = shared.HealthStatusHealthy HealthStatusDegraded = shared.HealthStatusDegraded HealthStatusUnhealthy = shared.HealthStatusUnhealthy HealthStatusUnknown = shared.HealthStatusUnknown )
const CheckerKey = shared.HealthCheckerKey
const ManagerKey = shared.HealthManagerKey
const ServiceKey = shared.HealthServiceKey
Variables ¶
This section is empty.
Functions ¶
func AssertHealthReportEqual ¶
func AssertHealthReportEqual(t *testing.T, expected, actual *health.HealthReport)
AssertHealthReportEqual asserts that two health reports are equal.
func AssertHealthResultEqual ¶
func AssertHealthResultEqual(t *testing.T, expected, actual *health.HealthResult)
AssertHealthResultEqual asserts that two health results are equal.
func BenchmarkHealthCheck ¶
func BenchmarkHealthCheck(b *testing.B, check health.HealthCheck)
BenchmarkHealthCheck benchmarks a health check.
func BenchmarkHealthService ¶
func BenchmarkHealthService(b *testing.B, service health.HealthService)
BenchmarkHealthService benchmarks a health service.
func CreateHealthEndpoints ¶
func CreateHealthEndpoints(router shared.Router, healthService shared.HealthManager, logger logger.Logger, metrics shared.Metrics) error
CreateHealthEndpoints creates health endpoints for a router.
func CreateHealthEndpointsWithConfig ¶
func CreateHealthEndpointsWithConfig(router shared.Router, healthService shared.HealthManager, logger logger.Logger, metrics shared.Metrics, config *EndpointConfig) error
CreateHealthEndpointsWithConfig creates health endpoints with custom configuration.
func CreateTestHealthReport ¶
func CreateTestHealthReport(overall health.HealthStatus, services map[string]*health.HealthResult) *health.HealthReport
CreateTestHealthReport creates a test health report.
func CreateTestHealthResult ¶
func CreateTestHealthResult(name string, status health.HealthStatus, message string) *health.HealthResult
CreateTestHealthResult creates a test health result.
func ExampleHealthTest ¶
ExampleHealthTest demonstrates how to use the health testing utilities.
func GetHealthServiceFromContainer ¶
func GetHealthServiceFromContainer(container shared.Container) (healthcore.HealthService, error)
GetHealthServiceFromContainer retrieves the health service from the container.
func New ¶
func New(config *HealthConfig, logger logger.Logger, metrics shared.Metrics, container shared.Container) shared.HealthManager
New creates a new health checker.
func NewHealthChecker ¶
func NewHealthChecker(config *HealthConfig, logger logger.Logger, metrics shared.Metrics, container shared.Container) shared.HealthManager
NewHealthChecker creates a new health checker.
func NewNoOpHealthManager ¶
func NewNoOpHealthManager() shared.HealthManager
NewNoOpHealthManager creates a no-op health manager that implements the full HealthManager interface but performs no actual health checking or monitoring. Useful for testing, benchmarking, or when health checks are disabled.
func RegisterHealthEndpointsWithContainer ¶
RegisterHealthEndpointsWithContainer registers health endpoints using the DI container.
func RegisterHealthService ¶
func RegisterHealthService(container shared.Container, conf *HealthConfig) error
RegisterHealthService registers the health service with the DI container.
func WaitForHealthStatus ¶
func WaitForHealthStatus(t *testing.T, service health.HealthService, expected health.HealthStatus, timeout time.Duration)
WaitForHealthStatus waits for a specific health status with timeout.
Types ¶
type AggregatorConfig ¶
type AggregatorConfig = healthcore.AggregatorConfig
AggregatorConfig contains configuration for the health aggregator.
func DefaultAggregatorConfig ¶
func DefaultAggregatorConfig() *AggregatorConfig
DefaultAggregatorConfig returns default configuration for the health aggregator.
type AsyncHealthCheck ¶
type AsyncHealthCheck = healthcore.AsyncHealthCheck
AsyncHealthCheck implements an asynchronous health check.
func NewAsyncHealthCheck ¶
func NewAsyncHealthCheck(config *HealthCheckConfig, checkFunc HealthCheckFunc) *AsyncHealthCheck
NewAsyncHealthCheck creates a new asynchronous health check.
type BaseHealthCheck ¶
type BaseHealthCheck = healthcore.BaseHealthCheck
BaseHealthCheck provides base functionality for health checks.
func NewBaseHealthCheck ¶
func NewBaseHealthCheck(config *HealthCheckConfig) *BaseHealthCheck
NewBaseHealthCheck creates a new base health check.
type CompositeHealthCheck ¶
type CompositeHealthCheck = healthcore.CompositeHealthCheck
CompositeHealthCheck implements a health check that combines multiple checks.
func NewCompositeHealthCheck ¶
func NewCompositeHealthCheck(config *HealthCheckConfig, checks ...HealthCheck) *CompositeHealthCheck
NewCompositeHealthCheck creates a new composite health check.
type EndpointConfig ¶
type EndpointConfig = healthcore.EndpointConfig
EndpointConfig contains configuration for health endpoints.
func DefaultEndpointConfig ¶
func DefaultEndpointConfig() *EndpointConfig
DefaultEndpointConfig returns default configuration for health endpoints.
type HealthAggregator ¶
type HealthAggregator = healthcore.HealthAggregator
HealthAggregator aggregates health check results into an overall health status.
func NewHealthAggregator ¶
func NewHealthAggregator(config *AggregatorConfig) *HealthAggregator
NewHealthAggregator creates a new health aggregator.
type HealthCallback ¶
type HealthCallback = healthcore.HealthCallback
HealthCallback is a callback function for health status changes.
type HealthCheck ¶
type HealthCheck = healthcore.HealthCheck
HealthCheck defines the interface for health checks.
type HealthCheckConfig ¶
type HealthCheckConfig = healthcore.HealthCheckConfig
HealthCheckConfig contains configuration for health checks.
func DefaultHealthCheckConfig ¶
func DefaultHealthCheckConfig() *HealthCheckConfig
DefaultHealthCheckConfig returns default configuration for health checks.
type HealthCheckFunc ¶
type HealthCheckFunc = healthcore.HealthCheckFunc
HealthCheckFunc is a function type for simple health checks.
type HealthCheckWrapper ¶
type HealthCheckWrapper = healthcore.HealthCheckWrapper
HealthCheckWrapper wraps a health check with additional functionality.
func NewHealthCheckWrapper ¶
func NewHealthCheckWrapper(check HealthCheck) *HealthCheckWrapper
NewHealthCheckWrapper creates a new health check wrapper.
type HealthChecker ¶
type HealthChecker = healthcore.HealthService
HealthChecker implements comprehensive health monitoring for all services.
type HealthCheckerStats ¶
type HealthCheckerStats = healthcore.HealthCheckerStats
HealthCheckerStats contains statistics about the health checker.
type HealthConfig ¶
type HealthConfig = healthinternal.HealthConfig
HealthConfig contains configuration for the health checker.
func DefaultHealthConfig ¶
func DefaultHealthConfig() *HealthConfig
DefaultHealthConfig returns default configuration.
type HealthEndpointHandlers ¶
type HealthEndpointHandlers = healthcore.HealthEndpointHandlers
HealthEndpointHandlers provides direct handler functions for integration.
func NewHealthEndpointHandlers ¶
func NewHealthEndpointHandlers(manager *HealthEndpointManager) *HealthEndpointHandlers
NewHealthEndpointHandlers creates new health endpoint handlers.
type HealthEndpointManager ¶
type HealthEndpointManager = healthcore.HealthEndpointManager
HealthEndpointManager manages HTTP endpoints for health checks.
func NewHealthEndpointManager ¶
func NewHealthEndpointManager(healthService shared.HealthManager, logger logger.Logger, metrics shared.Metrics, config *EndpointConfig) *HealthEndpointManager
NewHealthEndpointManager creates a new health endpoint manager.
type HealthPrediction ¶
type HealthPrediction = healthcore.HealthPrediction
HealthPrediction represents a health prediction.
type HealthReport ¶
type HealthReport = healthcore.HealthReport
HealthReport represents a comprehensive health report.
func NewHealthReport ¶
func NewHealthReport() *HealthReport
NewHealthReport creates a new health report.
type HealthReportCallback ¶
type HealthReportCallback = healthcore.HealthReportCallback
HealthReportCallback is a callback function for health report changes.
type HealthResult ¶
type HealthResult = healthcore.HealthResult
HealthResult represents the result of a health check.
func NewHealthResult ¶
func NewHealthResult(name string, status HealthStatus, message string) *HealthResult
NewHealthResult creates a new health result.
type HealthStatus ¶
type HealthStatus = shared.HealthStatus
HealthStatus represents the health status of a service or component.
type HealthStatusSnapshot ¶
type HealthStatusSnapshot = healthcore.HealthStatusSnapshot
HealthStatusSnapshot represents a point-in-time health status.
type HealthTestBuilder ¶
type HealthTestBuilder struct {
// contains filtered or unexported fields
}
HealthTestBuilder helps build health test scenarios.
func NewHealthTestBuilder ¶
func NewHealthTestBuilder(t *testing.T) *HealthTestBuilder
NewHealthTestBuilder creates a new health test builder.
func (*HealthTestBuilder) Build ¶
func (htb *HealthTestBuilder) Build() *HealthTestSuite
Build builds the test suite.
func (*HealthTestBuilder) WithCriticalCheck ¶
func (htb *HealthTestBuilder) WithCriticalCheck(name string, status health.HealthStatus) *HealthTestBuilder
WithCriticalCheck adds a critical check.
func (*HealthTestBuilder) WithCustomCheck ¶
func (htb *HealthTestBuilder) WithCustomCheck(name string, checkFunc func(ctx context.Context) *health.HealthResult) *HealthTestBuilder
WithCustomCheck adds a custom check.
func (*HealthTestBuilder) WithDegradedCheck ¶
func (htb *HealthTestBuilder) WithDegradedCheck(name string) *HealthTestBuilder
WithDegradedCheck adds a degraded check.
func (*HealthTestBuilder) WithHealthyCheck ¶
func (htb *HealthTestBuilder) WithHealthyCheck(name string) *HealthTestBuilder
WithHealthyCheck adds a healthy check.
func (*HealthTestBuilder) WithSlowCheck ¶
func (htb *HealthTestBuilder) WithSlowCheck(name string, delay time.Duration) *HealthTestBuilder
WithSlowCheck adds a slow check for timeout testing.
func (*HealthTestBuilder) WithUnhealthyCheck ¶
func (htb *HealthTestBuilder) WithUnhealthyCheck(name string) *HealthTestBuilder
WithUnhealthyCheck adds an unhealthy check.
type HealthTestSuite ¶
type HealthTestSuite struct {
// contains filtered or unexported fields
}
HealthTestSuite provides a test suite for health checks.
func NewHealthTestSuite ¶
func NewHealthTestSuite(t *testing.T) *HealthTestSuite
NewHealthTestSuite creates a new health test suite.
func (*HealthTestSuite) AddHealthCheck ¶
func (hts *HealthTestSuite) AddHealthCheck(name string, status health.HealthStatus, message string) *MockHealthCheck
AddHealthCheck adds a health check to the test suite.
func (*HealthTestSuite) AssertCheckCalled ¶
func (hts *HealthTestSuite) AssertCheckCalled(name string, expectedCalls int)
AssertCheckCalled asserts that a specific check was called.
func (*HealthTestSuite) AssertDegraded ¶
func (hts *HealthTestSuite) AssertDegraded()
AssertDegraded asserts that the service is degraded.
func (*HealthTestSuite) AssertHealthy ¶
func (hts *HealthTestSuite) AssertHealthy()
AssertHealthy asserts that the service is healthy.
func (*HealthTestSuite) AssertMethodCalled ¶
func (hts *HealthTestSuite) AssertMethodCalled(method string, expectedCalls int)
AssertMethodCalled asserts that a service method was called.
func (*HealthTestSuite) AssertUnhealthy ¶
func (hts *HealthTestSuite) AssertUnhealthy()
AssertUnhealthy asserts that the service is unhealthy.
func (*HealthTestSuite) Cleanup ¶
func (hts *HealthTestSuite) Cleanup()
Cleanup cleans up the test suite.
func (*HealthTestSuite) GetHealthCheck ¶
func (hts *HealthTestSuite) GetHealthCheck(name string) *MockHealthCheck
GetHealthCheck returns a specific health check.
func (*HealthTestSuite) GetHealthService ¶
func (hts *HealthTestSuite) GetHealthService() *TestHealthService
GetHealthService returns the test health service.
func (*HealthTestSuite) Start ¶
func (hts *HealthTestSuite) Start()
Start starts the health service.
type ManagerImpl ¶
type ManagerImpl struct {
// contains filtered or unexported fields
}
ManagerImpl implements comprehensive health monitoring for all services.
func (*ManagerImpl) Check ¶
func (hc *ManagerImpl) Check(ctx context.Context) *healthinternal.HealthReport
CheckAll performs all health checks and returns a comprehensive report.
func (*ManagerImpl) CheckOne ¶
func (hc *ManagerImpl) CheckOne(ctx context.Context, name string) *healthinternal.HealthResult
CheckOne performs a single health check.
func (*ManagerImpl) Environment ¶
func (hc *ManagerImpl) Environment() string
func (*ManagerImpl) GetChecks ¶
func (hc *ManagerImpl) GetChecks() map[string]healthinternal.HealthCheck
GetChecks returns all registered health checks.
func (*ManagerImpl) GetLastReport ¶
func (hc *ManagerImpl) GetLastReport() *healthinternal.HealthReport
GetLastReport returns the last health report.
func (*ManagerImpl) GetStats ¶
func (hc *ManagerImpl) GetStats() *healthinternal.HealthCheckerStats
GetStats returns health checker statistics.
func (*ManagerImpl) GetStatus ¶
func (hc *ManagerImpl) GetStatus() healthinternal.HealthStatus
GetStatus returns the current overall health status.
func (*ManagerImpl) Hostname ¶
func (hc *ManagerImpl) Hostname() string
func (*ManagerImpl) OnHealthCheck ¶
func (hc *ManagerImpl) OnHealthCheck(ctx context.Context) error
OnHealthCheck performs a health check on the health checker itself.
func (*ManagerImpl) Register ¶
func (hc *ManagerImpl) Register(check healthinternal.HealthCheck) error
Register registers a health check.
func (*ManagerImpl) RegisterFn ¶
func (hc *ManagerImpl) RegisterFn(name string, checkFn healthinternal.HealthCheckFunc) error
RegisterFn registers a function-based health check.
func (*ManagerImpl) Reload ¶
func (hc *ManagerImpl) Reload(config *HealthConfig) error
Reload reloads the health configuration at runtime.
func (*ManagerImpl) SetContainer ¶
func (hc *ManagerImpl) SetContainer(container shared.Container)
SetContainer sets the container reference for health checks.
func (*ManagerImpl) SetEnvironment ¶
func (hc *ManagerImpl) SetEnvironment(name string)
SetEnvironment sets the environment name for the HealthManagerImpl instance.
func (*ManagerImpl) SetHostname ¶
func (hc *ManagerImpl) SetHostname(hostname string)
func (*ManagerImpl) SetVersion ¶
func (hc *ManagerImpl) SetVersion(version string)
func (*ManagerImpl) Start ¶
func (hc *ManagerImpl) Start(ctx context.Context) error
Start starts the health checker service.
func (*ManagerImpl) StartTime ¶
func (hc *ManagerImpl) StartTime() time.Time
func (*ManagerImpl) Stop ¶
func (hc *ManagerImpl) Stop(ctx context.Context) error
Stop stops the health checker service.
func (*ManagerImpl) Subscribe ¶
func (hc *ManagerImpl) Subscribe(callback healthinternal.HealthCallback) error
Subscribe adds a callback for health status changes.
func (*ManagerImpl) Unregister ¶
func (hc *ManagerImpl) Unregister(name string) error
Unregister unregisters a health check.
func (*ManagerImpl) Version ¶
func (hc *ManagerImpl) Version() string
type MockHealthCheck ¶
type MockHealthCheck struct {
// contains filtered or unexported fields
}
MockHealthCheck is a mock health check for testing.
func NewMockHealthCheck ¶
func NewMockHealthCheck(name string, status health.HealthStatus, message string) *MockHealthCheck
NewMockHealthCheck creates a new mock health check.
func (*MockHealthCheck) Check ¶
func (mhc *MockHealthCheck) Check(ctx context.Context) *health.HealthResult
func (*MockHealthCheck) Critical ¶
func (mhc *MockHealthCheck) Critical() bool
func (*MockHealthCheck) Dependencies ¶
func (mhc *MockHealthCheck) Dependencies() []string
func (*MockHealthCheck) GetCallCount ¶
func (mhc *MockHealthCheck) GetCallCount() int
func (*MockHealthCheck) GetLastCall ¶
func (mhc *MockHealthCheck) GetLastCall() time.Time
func (*MockHealthCheck) Name ¶
func (mhc *MockHealthCheck) Name() string
func (*MockHealthCheck) ResetCallCount ¶
func (mhc *MockHealthCheck) ResetCallCount()
func (*MockHealthCheck) SetCheckFunc ¶
func (mhc *MockHealthCheck) SetCheckFunc(fn func(ctx context.Context) *health.HealthResult)
func (*MockHealthCheck) SetCritical ¶
func (mhc *MockHealthCheck) SetCritical(critical bool)
func (*MockHealthCheck) SetDependencies ¶
func (mhc *MockHealthCheck) SetDependencies(deps []string)
func (*MockHealthCheck) SetMessage ¶
func (mhc *MockHealthCheck) SetMessage(message string)
func (*MockHealthCheck) SetResult ¶
func (mhc *MockHealthCheck) SetResult(result *health.HealthResult)
func (*MockHealthCheck) SetStatus ¶
func (mhc *MockHealthCheck) SetStatus(status health.HealthStatus)
Test helpers for MockHealthCheck.
func (*MockHealthCheck) SetTimeout ¶
func (mhc *MockHealthCheck) SetTimeout(timeout time.Duration)
func (*MockHealthCheck) Timeout ¶
func (mhc *MockHealthCheck) Timeout() time.Duration
type PredictiveAggregator ¶
type PredictiveAggregator = healthcore.PredictiveAggregator
PredictiveAggregator implements predictive health aggregation.
func NewPredictiveAggregator ¶
func NewPredictiveAggregator(config *AggregatorConfig) *PredictiveAggregator
NewPredictiveAggregator creates a new predictive health aggregator.
type SimpleHealthCheck ¶
type SimpleHealthCheck = healthcore.SimpleHealthCheck
SimpleHealthCheck implements a simple function-based health check.
func NewSimpleHealthCheck ¶
func NewSimpleHealthCheck(config *HealthCheckConfig, checkFunc HealthCheckFunc) *SimpleHealthCheck
NewSimpleHealthCheck creates a new simple health check.
type SmartAggregator ¶
type SmartAggregator = healthcore.SmartAggregator
SmartAggregator implements advanced aggregation logic with machine learning-like features.
func NewSmartAggregator ¶
func NewSmartAggregator(config *AggregatorConfig) *SmartAggregator
NewSmartAggregator creates a new smart health aggregator.
type TestHealthChecker ¶
type TestHealthChecker struct {
shared.HealthManager
// contains filtered or unexported fields
}
TestHealthChecker is a test-friendly health checker.
func NewTestHealthChecker ¶
func NewTestHealthChecker() *TestHealthChecker
NewTestHealthChecker creates a new test health checker.
func (*TestHealthChecker) SetCheckResult ¶
func (thc *TestHealthChecker) SetCheckResult(name string, result *health.HealthResult)
SetCheckResult sets a predefined result for a specific check.
type TestHealthService ¶
type TestHealthService struct {
// contains filtered or unexported fields
}
TestHealthService is a mock health service for testing.
func NewTestHealthService ¶
func NewTestHealthService(name string) *TestHealthService
NewTestHealthService creates a new test health service.
func (*TestHealthService) CheckAll ¶
func (ths *TestHealthService) CheckAll(ctx context.Context) *health.HealthReport
Health checking.
func (*TestHealthService) CheckOne ¶
func (ths *TestHealthService) CheckOne(ctx context.Context, name string) *health.HealthResult
func (*TestHealthService) Checker ¶
func (ths *TestHealthService) Checker() shared.HealthManager
func (*TestHealthService) Dependencies ¶
func (ths *TestHealthService) Dependencies() []string
func (*TestHealthService) GetCallCount ¶
func (ths *TestHealthService) GetCallCount(method string) int
func (*TestHealthService) GetCheck ¶
func (ths *TestHealthService) GetCheck(name string) (health.HealthCheck, error)
func (*TestHealthService) GetConfiguration ¶
func (ths *TestHealthService) GetConfiguration() *health.HealthConfig
func (*TestHealthService) GetEnvironment ¶
func (ths *TestHealthService) GetEnvironment() string
func (*TestHealthService) GetLastReport ¶
func (ths *TestHealthService) GetLastReport() *health.HealthReport
func (*TestHealthService) GetMethodCalls ¶
func (ths *TestHealthService) GetMethodCalls() []string
func (*TestHealthService) GetStats ¶
func (ths *TestHealthService) GetStats() *health.HealthCheckerStats
func (*TestHealthService) GetStatus ¶
func (ths *TestHealthService) GetStatus() health.HealthStatus
func (*TestHealthService) GetVersion ¶
func (ths *TestHealthService) GetVersion() string
Service info.
func (*TestHealthService) IsDegraded ¶
func (ths *TestHealthService) IsDegraded() bool
func (*TestHealthService) IsHealthy ¶
func (ths *TestHealthService) IsHealthy() bool
func (*TestHealthService) ListChecks ¶
func (ths *TestHealthService) ListChecks() []string
func (*TestHealthService) Name ¶
func (ths *TestHealthService) Name() string
Service lifecycle methods.
func (*TestHealthService) OnHealthCheck ¶
func (ths *TestHealthService) OnHealthCheck(ctx context.Context) error
func (*TestHealthService) RegisterCheck ¶
func (ths *TestHealthService) RegisterCheck(name string, check health.HealthCheck) error
Health check management.
func (*TestHealthService) ResetCalls ¶
func (ths *TestHealthService) ResetCalls()
func (*TestHealthService) SetError ¶
func (ths *TestHealthService) SetError(method string, err error)
func (*TestHealthService) SetLastReport ¶
func (ths *TestHealthService) SetLastReport(report *health.HealthReport)
func (*TestHealthService) SetStatus ¶
func (ths *TestHealthService) SetStatus(status health.HealthStatus)
Test helpers.
func (*TestHealthService) Subscribe ¶
func (ths *TestHealthService) Subscribe(callback health.HealthCallback) error
Health monitoring.
func (*TestHealthService) UnregisterCheck ¶
func (ths *TestHealthService) UnregisterCheck(name string) error