checks

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCustomHealthCheckFromFunction

func CreateCustomHealthCheckFromFunction(name string, fn func(ctx context.Context) error) health.HealthCheck

CreateCustomHealthCheckFromFunction creates a health check from a simple function.

func CreateCustomHealthCheckFromMethod

func CreateCustomHealthCheckFromMethod(name string, obj any, methodName string) (health.HealthCheck, error)

CreateCustomHealthCheckFromMethod creates a health check from a method.

func RegisterCPUHealthChecks

func RegisterCPUHealthChecks(healthService health.HealthService) error

RegisterCPUHealthChecks registers CPU health checks with the health service.

func RegisterDatabaseHealthChecks

func RegisterDatabaseHealthChecks(healthService health.HealthService, container shared.Container) error

RegisterDatabaseHealthChecks registers database health checks with the health service.

func RegisterDiskHealthChecks

func RegisterDiskHealthChecks(healthService health.HealthService) error

RegisterDiskHealthChecks registers disk health checks with the health service.

func RegisterEventBusHealthChecks

func RegisterEventBusHealthChecks(healthService health.HealthService, container shared.Container) error

RegisterEventBusHealthChecks registers event bus health checks with the health service.

func RegisterExternalAPIHealthChecks

func RegisterExternalAPIHealthChecks(healthService health.HealthService, container shared.Container) error

RegisterExternalAPIHealthChecks registers external API health checks.

func RegisterMemoryHealthChecks

func RegisterMemoryHealthChecks(healthService health.HealthService) error

RegisterMemoryHealthChecks registers memory health checks with the health service.

func RegisterStreamingHealthChecks

func RegisterStreamingHealthChecks(healthService health.HealthService, container shared.Container) error

RegisterStreamingHealthChecks registers streaming health checks with the health service.

Types

type CPUContextSwitchHealthCheck

type CPUContextSwitchHealthCheck struct {
	*health.BaseHealthCheck
	// contains filtered or unexported fields
}

CPUContextSwitchHealthCheck performs health checks on CPU context switches.

func NewCPUContextSwitchHealthCheck

func NewCPUContextSwitchHealthCheck(config *CPUHealthCheckConfig) *CPUContextSwitchHealthCheck

NewCPUContextSwitchHealthCheck creates a new CPU context switch health check.

func (*CPUContextSwitchHealthCheck) Check

Check performs the CPU context switch health check.

type CPUHealthCheck

type CPUHealthCheck struct {
	*health.BaseHealthCheck
	// contains filtered or unexported fields
}

CPUHealthCheck performs health checks on CPU usage.

func NewCPUHealthCheck

func NewCPUHealthCheck(config *CPUHealthCheckConfig) *CPUHealthCheck

NewCPUHealthCheck creates a new CPU health check.

func (*CPUHealthCheck) Check

Check performs the CPU health check.

type CPUHealthCheckComposite

type CPUHealthCheckComposite struct {
	*health.CompositeHealthCheck
	// contains filtered or unexported fields
}

CPUHealthCheckComposite combines multiple CPU health checks.

func CreateCPUHealthCheckComposite

func CreateCPUHealthCheckComposite() *CPUHealthCheckComposite

CreateCPUHealthCheckComposite creates a composite CPU health check with all sub-checks.

func NewCPUHealthCheckComposite

func NewCPUHealthCheckComposite(name string, checks ...health.HealthCheck) *CPUHealthCheckComposite

NewCPUHealthCheckComposite creates a composite CPU health check.

func (*CPUHealthCheckComposite) AddCPUCheck

func (chcc *CPUHealthCheckComposite) AddCPUCheck(check health.HealthCheck)

AddCPUCheck adds a CPU check to the composite.

func (*CPUHealthCheckComposite) GetCPUChecks

func (chcc *CPUHealthCheckComposite) GetCPUChecks() []health.HealthCheck

GetCPUChecks returns the individual CPU checks.

type CPUHealthCheckConfig

type CPUHealthCheckConfig struct {
	Name              string
	WarningThreshold  float64 // Percentage (0-100)
	CriticalThreshold float64 // Percentage (0-100)
	LoadAvgThreshold  float64 // Load average threshold
	CheckLoadAvg      bool
	CheckCPUCount     bool
	Samples           int
	SampleInterval    time.Duration
	Timeout           time.Duration
	Critical          bool
	Tags              map[string]string
}

CPUHealthCheckConfig contains configuration for CPU health checks.

type CPULoadHealthCheck

type CPULoadHealthCheck struct {
	*health.BaseHealthCheck
	// contains filtered or unexported fields
}

CPULoadHealthCheck performs health checks on CPU load.

func NewCPULoadHealthCheck

func NewCPULoadHealthCheck(config *CPUHealthCheckConfig) *CPULoadHealthCheck

NewCPULoadHealthCheck creates a new CPU load health check.

func (*CPULoadHealthCheck) Check

Check performs the CPU load health check.

type CPUThrottlingHealthCheck

type CPUThrottlingHealthCheck struct {
	*health.BaseHealthCheck
	// contains filtered or unexported fields
}

CPUThrottlingHealthCheck performs health checks on CPU throttling.

func NewCPUThrottlingHealthCheck

func NewCPUThrottlingHealthCheck(config *CPUHealthCheckConfig) *CPUThrottlingHealthCheck

NewCPUThrottlingHealthCheck creates a new CPU throttling health check.

func (*CPUThrottlingHealthCheck) Check

Check performs the CPU throttling health check.

type CircuitBreakerHealthCheck

type CircuitBreakerHealthCheck struct {
	*ExternalAPIHealthCheck
	// contains filtered or unexported fields
}

CircuitBreakerHealthCheck wraps external API checks with circuit breaker pattern.

func NewCircuitBreakerHealthCheck

func NewCircuitBreakerHealthCheck(config *ExternalAPIHealthCheckConfig) *CircuitBreakerHealthCheck

NewCircuitBreakerHealthCheck creates a new circuit breaker health check.

func (*CircuitBreakerHealthCheck) Check

Check performs health check with circuit breaker pattern.

type ConditionalHealthCheck

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

ConditionalHealthCheck runs a health check only if a condition is met.

func NewConditionalHealthCheck

func NewConditionalHealthCheck(check health.HealthCheck, condition func(ctx context.Context) bool, logger logger.Logger) *ConditionalHealthCheck

NewConditionalHealthCheck creates a new conditional health check.

func (*ConditionalHealthCheck) Check

Check performs the health check if the condition is met.

func (*ConditionalHealthCheck) Critical

func (c *ConditionalHealthCheck) Critical() bool

Critical returns whether the health check is critical.

func (*ConditionalHealthCheck) Dependencies

func (c *ConditionalHealthCheck) Dependencies() []string

Dependencies returns the dependencies of the health check.

func (*ConditionalHealthCheck) Name

func (c *ConditionalHealthCheck) Name() string

Name returns the name of the health check.

func (*ConditionalHealthCheck) Timeout

func (c *ConditionalHealthCheck) Timeout() time.Duration

Timeout returns the timeout for the health check.

type CronSchedule

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

CronSchedule implements Schedule using cron expressions.

type CustomHealthCheckBuilder

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

CustomHealthCheckBuilder provides a fluent interface for building custom health checks.

func NewCustomHealthCheckBuilder

func NewCustomHealthCheckBuilder(name string, checkFunc health.HealthCheckFunc) *CustomHealthCheckBuilder

NewCustomHealthCheckBuilder creates a new custom health check builder.

func (*CustomHealthCheckBuilder) Build

Build creates the custom health check.

func (*CustomHealthCheckBuilder) WithAfter

func (b *CustomHealthCheckBuilder) WithAfter(afterFunc func(ctx context.Context, result *health.HealthResult) error) *CustomHealthCheckBuilder

WithAfter sets a function to run after the health check.

func (*CustomHealthCheckBuilder) WithBefore

func (b *CustomHealthCheckBuilder) WithBefore(beforeFunc func(ctx context.Context) error) *CustomHealthCheckBuilder

WithBefore sets a function to run before the health check.

func (*CustomHealthCheckBuilder) WithCritical

func (b *CustomHealthCheckBuilder) WithCritical(critical bool) *CustomHealthCheckBuilder

WithCritical marks the health check as critical.

func (*CustomHealthCheckBuilder) WithDependencies

func (b *CustomHealthCheckBuilder) WithDependencies(dependencies ...string) *CustomHealthCheckBuilder

WithDependencies sets the dependencies for the health check.

func (*CustomHealthCheckBuilder) WithInterval

WithInterval sets the check interval.

func (*CustomHealthCheckBuilder) WithLogger

WithLogger sets the logger for the health check.

func (*CustomHealthCheckBuilder) WithMetadata

func (b *CustomHealthCheckBuilder) WithMetadata(metadata map[string]any) *CustomHealthCheckBuilder

WithMetadata sets metadata for the health check.

func (*CustomHealthCheckBuilder) WithRetries

func (b *CustomHealthCheckBuilder) WithRetries(retries int) *CustomHealthCheckBuilder

WithRetries sets the number of retries.

func (*CustomHealthCheckBuilder) WithRetryDelay

WithRetryDelay sets the retry delay.

func (*CustomHealthCheckBuilder) WithTag

WithTag adds a single tag.

func (*CustomHealthCheckBuilder) WithTags

WithTags sets tags for the health check.

func (*CustomHealthCheckBuilder) WithTimeout

WithTimeout sets the timeout for the health check.

type DatabaseAPIHealthCheck

type DatabaseAPIHealthCheck struct {
	*ExternalAPIHealthCheck
	// contains filtered or unexported fields
}

DatabaseAPIHealthCheck is a specialized health check for database APIs.

func NewDatabaseAPIHealthCheck

func NewDatabaseAPIHealthCheck(config *ExternalAPIHealthCheckConfig) *DatabaseAPIHealthCheck

NewDatabaseAPIHealthCheck creates a new database API health check.

func (*DatabaseAPIHealthCheck) Check

Check performs database API health checks.

type DatabaseHealthCheck

type DatabaseHealthCheck struct {
	*health.BaseHealthCheck
	// contains filtered or unexported fields
}

DatabaseHealthCheck performs health checks on database connections.

func NewDatabaseHealthCheck

func NewDatabaseHealthCheck(config *DatabaseHealthCheckConfig) *DatabaseHealthCheck

NewDatabaseHealthCheck creates a new database health check.

func (*DatabaseHealthCheck) Check

Check performs the database health check.

type DatabaseHealthCheckConfig

type DatabaseHealthCheckConfig struct {
	Name            string
	DB              *sql.DB
	PingQuery       string
	Timeout         time.Duration
	Critical        bool
	MaxOpenConns    int
	MaxIdleConns    int
	ConnMaxLifetime time.Duration
	Tags            map[string]string
}

DatabaseHealthCheckConfig contains configuration for database health checks.

type DatabaseHealthCheckFactory

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

DatabaseHealthCheckFactory creates database health checks based on configuration.

func NewDatabaseHealthCheckFactory

func NewDatabaseHealthCheckFactory(container shared.Container) *DatabaseHealthCheckFactory

NewDatabaseHealthCheckFactory creates a new factory.

func (*DatabaseHealthCheckFactory) CreateDatabaseHealthCheck

func (factory *DatabaseHealthCheckFactory) CreateDatabaseHealthCheck(name string, dbType string, critical bool) (health.HealthCheck, error)

CreateDatabaseHealthCheck creates a database health check.

type DiskHealthCheck

type DiskHealthCheck struct {
	*health.BaseHealthCheck
	// contains filtered or unexported fields
}

DiskHealthCheck performs health checks on disk usage.

func NewDiskHealthCheck

func NewDiskHealthCheck(config *DiskHealthCheckConfig) *DiskHealthCheck

NewDiskHealthCheck creates a new disk health check.

func (*DiskHealthCheck) AddPath

func (dhc *DiskHealthCheck) AddPath(path string)

AddPath adds a path to monitor.

func (*DiskHealthCheck) Check

Check performs the disk health check.

func (*DiskHealthCheck) GetPaths

func (dhc *DiskHealthCheck) GetPaths() []string

GetPaths returns the paths being monitored.

func (*DiskHealthCheck) RemovePath

func (dhc *DiskHealthCheck) RemovePath(path string)

RemovePath removes a path from monitoring.

type DiskHealthCheckConfig

type DiskHealthCheckConfig struct {
	Name              string
	Paths             []string
	WarningThreshold  float64 // Percentage (0-100)
	CriticalThreshold float64 // Percentage (0-100)
	CheckInodes       bool
	CheckIO           bool
	Timeout           time.Duration
	Critical          bool
	Tags              map[string]string
}

DiskHealthCheckConfig contains configuration for disk health checks.

type DiskIOHealthCheck

type DiskIOHealthCheck struct {
	*health.BaseHealthCheck
	// contains filtered or unexported fields
}

DiskIOHealthCheck performs health checks on disk I/O performance.

func NewDiskIOHealthCheck

func NewDiskIOHealthCheck(config *DiskHealthCheckConfig) *DiskIOHealthCheck

NewDiskIOHealthCheck creates a new disk I/O health check.

func (*DiskIOHealthCheck) Check

Check performs the disk I/O health check.

type EventBusHealthCheck

type EventBusHealthCheck struct {
	*health.BaseHealthCheck
	// contains filtered or unexported fields
}

EventBusHealthCheck performs health checks on event bus systems.

func NewEventBusHealthCheck

func NewEventBusHealthCheck(config *EventBusHealthCheckConfig) *EventBusHealthCheck

NewEventBusHealthCheck creates a new event bus health check.

func (*EventBusHealthCheck) Check

Check performs the event bus health check.

type EventBusHealthCheckComposite

type EventBusHealthCheckComposite struct {
	*health.CompositeHealthCheck
	// contains filtered or unexported fields
}

EventBusHealthCheckComposite combines multiple event bus health checks.

func NewEventBusHealthCheckComposite

func NewEventBusHealthCheckComposite(name string, checks ...health.HealthCheck) *EventBusHealthCheckComposite

NewEventBusHealthCheckComposite creates a composite event bus health check.

func (*EventBusHealthCheckComposite) AddEventBusCheck

func (ebhcc *EventBusHealthCheckComposite) AddEventBusCheck(check health.HealthCheck)

AddEventBusCheck adds an event bus check to the composite.

func (*EventBusHealthCheckComposite) GetEventBusChecks

func (ebhcc *EventBusHealthCheckComposite) GetEventBusChecks() []health.HealthCheck

GetEventBusChecks returns the individual event bus checks.

type EventBusHealthCheckConfig

type EventBusHealthCheckConfig struct {
	Name        string
	EventBus    any
	TestTopic   string
	TestMessage string
	BrokerType  string
	Timeout     time.Duration
	Critical    bool
	Tags        map[string]string
}

EventBusHealthCheckConfig contains configuration for event bus health checks.

type EventBusHealthCheckFactory

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

EventBusHealthCheckFactory creates event bus health checks based on configuration.

func NewEventBusHealthCheckFactory

func NewEventBusHealthCheckFactory(container shared.Container) *EventBusHealthCheckFactory

NewEventBusHealthCheckFactory creates a new factory.

func (*EventBusHealthCheckFactory) CreateEventBusHealthCheck

func (factory *EventBusHealthCheckFactory) CreateEventBusHealthCheck(name string, brokerType string, critical bool) (health.HealthCheck, error)

CreateEventBusHealthCheck creates an event bus health check.

type ExternalAPIHealthCheck

type ExternalAPIHealthCheck struct {
	*health.BaseHealthCheck
	// contains filtered or unexported fields
}

ExternalAPIHealthCheck performs health checks on external APIs.

func NewExternalAPIHealthCheck

func NewExternalAPIHealthCheck(config *ExternalAPIHealthCheckConfig) *ExternalAPIHealthCheck

NewExternalAPIHealthCheck creates a new external API health check.

func (*ExternalAPIHealthCheck) Check

Check performs the external API health check.

type ExternalAPIHealthCheckComposite

type ExternalAPIHealthCheckComposite struct {
	*health.CompositeHealthCheck
	// contains filtered or unexported fields
}

ExternalAPIHealthCheckComposite combines multiple external API health checks.

func NewExternalAPIHealthCheckComposite

func NewExternalAPIHealthCheckComposite(name string, checks ...health.HealthCheck) *ExternalAPIHealthCheckComposite

NewExternalAPIHealthCheckComposite creates a composite external API health check.

func (*ExternalAPIHealthCheckComposite) AddAPICheck

func (eahcc *ExternalAPIHealthCheckComposite) AddAPICheck(check health.HealthCheck)

AddAPICheck adds an API check to the composite.

func (*ExternalAPIHealthCheckComposite) GetAPIChecks

func (eahcc *ExternalAPIHealthCheckComposite) GetAPIChecks() []health.HealthCheck

GetAPIChecks returns the individual API checks.

type ExternalAPIHealthCheckConfig

type ExternalAPIHealthCheckConfig struct {
	Name           string
	URL            string
	Method         string
	Headers        map[string]string
	ExpectedStatus int
	ExpectedBody   string
	Timeout        time.Duration
	Critical       bool
	Tags           map[string]string
	Client         *http.Client
}

ExternalAPIHealthCheckConfig contains configuration for external API health checks.

type ExternalAPIHealthCheckFactory

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

ExternalAPIHealthCheckFactory creates external API health checks.

func NewExternalAPIHealthCheckFactory

func NewExternalAPIHealthCheckFactory(container shared.Container) *ExternalAPIHealthCheckFactory

NewExternalAPIHealthCheckFactory creates a new factory.

func (*ExternalAPIHealthCheckFactory) CreateExternalAPIHealthCheck

func (factory *ExternalAPIHealthCheckFactory) CreateExternalAPIHealthCheck(name string, url string, apiType string, critical bool) (health.HealthCheck, error)

CreateExternalAPIHealthCheck creates an external API health check.

type GCHealthCheck

type GCHealthCheck struct {
	*health.BaseHealthCheck
	// contains filtered or unexported fields
}

GCHealthCheck performs garbage collection health checks.

func NewGCHealthCheck

func NewGCHealthCheck(config *MemoryHealthCheckConfig) *GCHealthCheck

NewGCHealthCheck creates a new garbage collection health check.

func (*GCHealthCheck) Check

func (gchc *GCHealthCheck) Check(ctx context.Context) *health.HealthResult

Check performs the garbage collection health check.

func (*GCHealthCheck) SetGCCPUThreshold

func (gchc *GCHealthCheck) SetGCCPUThreshold(threshold float64)

SetGCCPUThreshold sets the GC CPU usage threshold.

func (*GCHealthCheck) SetGCFrequencyThreshold

func (gchc *GCHealthCheck) SetGCFrequencyThreshold(threshold uint32)

SetGCFrequencyThreshold sets the GC frequency threshold.

func (*GCHealthCheck) SetGCPauseThreshold

func (gchc *GCHealthCheck) SetGCPauseThreshold(threshold time.Duration)

SetGCPauseThreshold sets the GC pause time threshold.

type GoRoutineHealthCheck

type GoRoutineHealthCheck struct {
	*health.BaseHealthCheck
	// contains filtered or unexported fields
}

GoRoutineHealthCheck performs health checks on goroutine usage.

func NewGoRoutineHealthCheck

func NewGoRoutineHealthCheck(config *MemoryHealthCheckConfig) *GoRoutineHealthCheck

NewGoRoutineHealthCheck creates a new goroutine health check.

func (*GoRoutineHealthCheck) Check

Check performs the goroutine health check.

func (*GoRoutineHealthCheck) SetCriticalThreshold

func (ghc *GoRoutineHealthCheck) SetCriticalThreshold(threshold int)

SetCriticalThreshold sets the critical threshold for goroutine count.

func (*GoRoutineHealthCheck) SetWarningThreshold

func (ghc *GoRoutineHealthCheck) SetWarningThreshold(threshold int)

SetWarningThreshold sets the warning threshold for goroutine count.

type GraphQLHealthCheck

type GraphQLHealthCheck struct {
	*ExternalAPIHealthCheck
	// contains filtered or unexported fields
}

GraphQLHealthCheck is a specialized health check for GraphQL endpoints.

func NewGraphQLHealthCheck

func NewGraphQLHealthCheck(config *ExternalAPIHealthCheckConfig) *GraphQLHealthCheck

NewGraphQLHealthCheck creates a new GraphQL health check.

func (*GraphQLHealthCheck) Check

Check performs GraphQL-specific health checks.

type HTTPHealthCheckBuilder

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

HTTPHealthCheckBuilder creates health checks for HTTP endpoints.

func NewHTTPHealthCheckBuilder

func NewHTTPHealthCheckBuilder(logger logger.Logger) *HTTPHealthCheckBuilder

NewHTTPHealthCheckBuilder creates a new HTTP health check builder.

func (*HTTPHealthCheckBuilder) BuildForEndpoint

func (b *HTTPHealthCheckBuilder) BuildForEndpoint(name, url string, options ...HTTPHealthCheckOption) health.HealthCheck

BuildForEndpoint creates a health check for an HTTP endpoint.

type HTTPHealthCheckConfig

type HTTPHealthCheckConfig struct {
	URL            string
	Method         string
	ExpectedStatus int
	Headers        map[string]string
	Body           string
	Timeout        time.Duration
	ValidateBody   func(body string) error
}

HTTPHealthCheckConfig contains configuration for HTTP health checks.

type HTTPHealthCheckOption

type HTTPHealthCheckOption func(*HTTPHealthCheckConfig)

HTTPHealthCheckOption is a functional option for HTTP health checks.

func WithBody

func WithBody(body string) HTTPHealthCheckOption

WithBody sets the request body.

func WithBodyValidator

func WithBodyValidator(validator func(body string) error) HTTPHealthCheckOption

WithBodyValidator sets a function to validate the response body.

func WithExpectedStatus

func WithExpectedStatus(status int) HTTPHealthCheckOption

WithExpectedStatus sets the expected HTTP status code.

func WithHeaders

func WithHeaders(headers map[string]string) HTTPHealthCheckOption

WithHeaders sets HTTP headers.

func WithMethod

func WithMethod(method string) HTTPHealthCheckOption

WithMethod sets the HTTP method.

type HTTPSHealthCheck

type HTTPSHealthCheck struct {
	*ExternalAPIHealthCheck
	// contains filtered or unexported fields
}

HTTPSHealthCheck is a specialized health check for HTTPS endpoints.

func NewHTTPSHealthCheck

func NewHTTPSHealthCheck(config *ExternalAPIHealthCheckConfig) *HTTPSHealthCheck

NewHTTPSHealthCheck creates a new HTTPS health check.

func (*HTTPSHealthCheck) Check

Check performs HTTPS-specific health checks.

type HealthCheckRegistry

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

HealthCheckRegistry manages a collection of health checks.

func NewHealthCheckRegistry

func NewHealthCheckRegistry(logger logger.Logger) *HealthCheckRegistry

NewHealthCheckRegistry creates a new health check registry.

func (*HealthCheckRegistry) BuildAll

func (r *HealthCheckRegistry) BuildAll() error

BuildAll builds all registered health check builders.

func (*HealthCheckRegistry) Get

Get returns a health check by name.

func (*HealthCheckRegistry) GetAll

func (r *HealthCheckRegistry) GetAll() []health.HealthCheck

GetAll returns all registered health checks.

func (*HealthCheckRegistry) Register

func (r *HealthCheckRegistry) Register(check health.HealthCheck) error

Register registers a health check.

func (*HealthCheckRegistry) RegisterBuilder

func (r *HealthCheckRegistry) RegisterBuilder(name string, builder func() health.HealthCheck) error

RegisterBuilder registers a health check builder.

type HeapHealthCheck

type HeapHealthCheck struct {
	*health.BaseHealthCheck
	// contains filtered or unexported fields
}

HeapHealthCheck performs detailed heap health checks.

func NewHeapHealthCheck

func NewHeapHealthCheck(config *MemoryHealthCheckConfig) *HeapHealthCheck

NewHeapHealthCheck creates a new heap health check.

func (*HeapHealthCheck) Check

Check performs the heap health check.

func (*HeapHealthCheck) SetMaxHeapSize

func (hhc *HeapHealthCheck) SetMaxHeapSize(size uint64)

SetMaxHeapSize sets the maximum heap size for calculations.

type IntervalSchedule

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

IntervalSchedule implements Schedule using fixed intervals.

func NewIntervalSchedule

func NewIntervalSchedule(interval time.Duration) *IntervalSchedule

NewIntervalSchedule creates a new interval schedule.

func (*IntervalSchedule) Next

func (s *IntervalSchedule) Next(after time.Time) time.Time

Next returns the next time the check should run.

func (*IntervalSchedule) ShouldRun

func (s *IntervalSchedule) ShouldRun(now time.Time, lastRun time.Time) bool

ShouldRun returns true if the check should run now.

type KafkaHealthCheck

type KafkaHealthCheck struct {
	*EventBusHealthCheck
	// contains filtered or unexported fields
}

KafkaHealthCheck is a specialized health check for Kafka.

func NewKafkaHealthCheck

func NewKafkaHealthCheck(config *EventBusHealthCheckConfig) *KafkaHealthCheck

NewKafkaHealthCheck creates a new Kafka health check.

func (*KafkaHealthCheck) Check

Check performs Kafka-specific health checks.

type LogDirHealthCheck

type LogDirHealthCheck struct {
	*health.BaseHealthCheck
	// contains filtered or unexported fields
}

LogDirHealthCheck performs health checks on log directories.

func NewLogDirHealthCheck

func NewLogDirHealthCheck(config *DiskHealthCheckConfig) *LogDirHealthCheck

NewLogDirHealthCheck creates a new log directory health check.

func (*LogDirHealthCheck) Check

Check performs the log directory health check.

type MemoryHealthCheck

type MemoryHealthCheck struct {
	*health.BaseHealthCheck
	// contains filtered or unexported fields
}

MemoryHealthCheck performs health checks on memory usage.

func NewMemoryHealthCheck

func NewMemoryHealthCheck(config *MemoryHealthCheckConfig) *MemoryHealthCheck

NewMemoryHealthCheck creates a new memory health check.

func (*MemoryHealthCheck) Check

Check performs the memory health check.

type MemoryHealthCheckComposite

type MemoryHealthCheckComposite struct {
	*health.CompositeHealthCheck
	// contains filtered or unexported fields
}

MemoryHealthCheckComposite combines multiple memory health checks.

func CreateMemoryHealthCheckComposite

func CreateMemoryHealthCheckComposite() *MemoryHealthCheckComposite

CreateMemoryHealthCheckComposite creates a composite memory health check with all sub-checks.

func NewMemoryHealthCheckComposite

func NewMemoryHealthCheckComposite(name string, checks ...health.HealthCheck) *MemoryHealthCheckComposite

NewMemoryHealthCheckComposite creates a composite memory health check.

func (*MemoryHealthCheckComposite) AddMemoryCheck

func (mhcc *MemoryHealthCheckComposite) AddMemoryCheck(check health.HealthCheck)

AddMemoryCheck adds a memory check to the composite.

func (*MemoryHealthCheckComposite) GetMemoryChecks

func (mhcc *MemoryHealthCheckComposite) GetMemoryChecks() []health.HealthCheck

GetMemoryChecks returns the individual memory checks.

type MemoryHealthCheckConfig

type MemoryHealthCheckConfig struct {
	Name              string
	WarningThreshold  float64 // Percentage (0-100)
	CriticalThreshold float64 // Percentage (0-100)
	CheckGCStats      bool
	CheckAllocStats   bool
	Timeout           time.Duration
	Critical          bool
	Tags              map[string]string
}

MemoryHealthCheckConfig contains configuration for memory health checks.

type MongoDBHealthCheck

type MongoDBHealthCheck struct {
	*health.BaseHealthCheck
}

MongoDBHealthCheck is a health check for MongoDB (placeholder).

func NewMongoDBHealthCheck

func NewMongoDBHealthCheck(config *health.HealthCheckConfig) *MongoDBHealthCheck

NewMongoDBHealthCheck creates a new MongoDB health check.

func (*MongoDBHealthCheck) Check

Check performs MongoDB health check.

type MySQLHealthCheck

type MySQLHealthCheck struct {
	*DatabaseHealthCheck
	// contains filtered or unexported fields
}

MySQLHealthCheck is a specialized health check for MySQL.

func NewMySQLHealthCheck

func NewMySQLHealthCheck(config *DatabaseHealthCheckConfig) *MySQLHealthCheck

NewMySQLHealthCheck creates a new MySQL health check.

func (*MySQLHealthCheck) Check

Check performs MySQL-specific health checks.

type NATSHealthCheck

type NATSHealthCheck struct {
	*EventBusHealthCheck
	// contains filtered or unexported fields
}

NATSHealthCheck is a specialized health check for NATS.

func NewNATSHealthCheck

func NewNATSHealthCheck(config *EventBusHealthCheckConfig) *NATSHealthCheck

NewNATSHealthCheck creates a new NATS health check.

func (*NATSHealthCheck) Check

Check performs NATS-specific health checks.

type PostgreSQLHealthCheck

type PostgreSQLHealthCheck struct {
	*DatabaseHealthCheck
	// contains filtered or unexported fields
}

PostgreSQLHealthCheck is a specialized health check for PostgreSQL.

func NewPostgreSQLHealthCheck

func NewPostgreSQLHealthCheck(config *DatabaseHealthCheckConfig) *PostgreSQLHealthCheck

NewPostgreSQLHealthCheck creates a new PostgreSQL health check.

func (*PostgreSQLHealthCheck) Check

Check performs PostgreSQL-specific health checks.

type RabbitMQHealthCheck

type RabbitMQHealthCheck struct {
	*EventBusHealthCheck
	// contains filtered or unexported fields
}

RabbitMQHealthCheck is a specialized health check for RabbitMQ.

func NewRabbitMQHealthCheck

func NewRabbitMQHealthCheck(config *EventBusHealthCheckConfig) *RabbitMQHealthCheck

NewRabbitMQHealthCheck creates a new RabbitMQ health check.

func (*RabbitMQHealthCheck) Check

Check performs RabbitMQ-specific health checks.

type RedisHealthCheck

type RedisHealthCheck struct {
	*health.BaseHealthCheck
}

RedisHealthCheck is a health check for Redis (placeholder).

func NewRedisHealthCheck

func NewRedisHealthCheck(config *health.HealthCheckConfig) *RedisHealthCheck

NewRedisHealthCheck creates a new Redis health check.

func (*RedisHealthCheck) Check

Check performs Redis health check.

type RedisStreamHealthCheck

type RedisStreamHealthCheck struct {
	*EventBusHealthCheck
	// contains filtered or unexported fields
}

RedisStreamHealthCheck is a specialized health check for Redis Streams.

func NewRedisStreamHealthCheck

func NewRedisStreamHealthCheck(config *EventBusHealthCheckConfig) *RedisStreamHealthCheck

NewRedisStreamHealthCheck creates a new Redis Stream health check.

func (*RedisStreamHealthCheck) Check

Check performs Redis Stream-specific health checks.

type ResourceHealthCheckBuilder

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

ResourceHealthCheckBuilder creates health checks for system resources.

func NewResourceHealthCheckBuilder

func NewResourceHealthCheckBuilder(logger logger.Logger) *ResourceHealthCheckBuilder

NewResourceHealthCheckBuilder creates a new resource health check builder.

func (*ResourceHealthCheckBuilder) BuildFileSystemCheck

func (b *ResourceHealthCheckBuilder) BuildFileSystemCheck(name, path string, minFreeSpace int64) health.HealthCheck

BuildFileSystemCheck creates a filesystem health check.

func (*ResourceHealthCheckBuilder) BuildPortCheck

func (b *ResourceHealthCheckBuilder) BuildPortCheck(name, host string, port int) health.HealthCheck

BuildPortCheck creates a port availability health check.

type RestAPIHealthCheck

type RestAPIHealthCheck struct {
	*ExternalAPIHealthCheck
	// contains filtered or unexported fields
}

RestAPIHealthCheck is a specialized health check for REST APIs.

func NewRestAPIHealthCheck

func NewRestAPIHealthCheck(config *ExternalAPIHealthCheckConfig) *RestAPIHealthCheck

NewRestAPIHealthCheck creates a new REST API health check.

func (*RestAPIHealthCheck) AddEndpoint

func (rahc *RestAPIHealthCheck) AddEndpoint(endpoint string)

AddEndpoint adds an endpoint to check.

func (*RestAPIHealthCheck) Check

Check performs REST API health checks.

func (*RestAPIHealthCheck) SetCheckAll

func (rahc *RestAPIHealthCheck) SetCheckAll(checkAll bool)

SetCheckAll sets whether to check all endpoints.

type SSEHealthCheck

type SSEHealthCheck struct {
	*StreamingHealthCheck
	// contains filtered or unexported fields
}

SSEHealthCheck is a specialized health check for Server-Sent Events.

func NewSSEHealthCheck

func NewSSEHealthCheck(config *StreamingHealthCheckConfig) *SSEHealthCheck

NewSSEHealthCheck creates a new SSE health check.

func (*SSEHealthCheck) Check

func (ssehc *SSEHealthCheck) Check(ctx context.Context) *health.HealthResult

Check performs SSE-specific health checks.

type Schedule

type Schedule interface {
	Next(after time.Time) time.Time
	ShouldRun(now time.Time, lastRun time.Time) bool
}

Schedule defines when a health check should run.

type ScheduledHealthCheck

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

ScheduledHealthCheck allows health checks to run on a custom schedule.

func NewScheduledHealthCheck

func NewScheduledHealthCheck(check health.HealthCheck, schedule Schedule, logger logger.Logger) *ScheduledHealthCheck

NewScheduledHealthCheck creates a new scheduled health check.

func (*ScheduledHealthCheck) Check

Check performs the health check if it's time to run.

func (*ScheduledHealthCheck) Critical

func (s *ScheduledHealthCheck) Critical() bool

Critical returns whether the health check is critical.

func (*ScheduledHealthCheck) Dependencies

func (s *ScheduledHealthCheck) Dependencies() []string

Dependencies returns the dependencies of the health check.

func (*ScheduledHealthCheck) Name

func (s *ScheduledHealthCheck) Name() string

Name returns the name of the health check.

func (*ScheduledHealthCheck) Timeout

func (s *ScheduledHealthCheck) Timeout() time.Duration

Timeout returns the timeout for the health check.

type ServiceHealthCheckBuilder

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

ServiceHealthCheckBuilder creates health checks for services.

func NewServiceHealthCheckBuilder

func NewServiceHealthCheckBuilder(container shared.Container, logger logger.Logger) *ServiceHealthCheckBuilder

NewServiceHealthCheckBuilder creates a new service health check builder.

func (*ServiceHealthCheckBuilder) BuildForAllServices

func (b *ServiceHealthCheckBuilder) BuildForAllServices() []health.HealthCheck

BuildForAllServices creates health checks for all registered services.

func (*ServiceHealthCheckBuilder) BuildForService

func (b *ServiceHealthCheckBuilder) BuildForService(serviceName string) health.HealthCheck

BuildForService creates a health check for a service.

type StreamingClusterHealthCheck

type StreamingClusterHealthCheck struct {
	*StreamingHealthCheck
	// contains filtered or unexported fields
}

StreamingClusterHealthCheck checks the health of streaming clusters.

func NewStreamingClusterHealthCheck

func NewStreamingClusterHealthCheck(config *StreamingHealthCheckConfig) *StreamingClusterHealthCheck

NewStreamingClusterHealthCheck creates a new streaming cluster health check.

func (*StreamingClusterHealthCheck) Check

Check performs streaming cluster health checks.

type StreamingHealthCheck

type StreamingHealthCheck struct {
	*health.BaseHealthCheck
	// contains filtered or unexported fields
}

StreamingHealthCheck performs health checks on streaming services.

func NewStreamingHealthCheck

func NewStreamingHealthCheck(config *StreamingHealthCheckConfig) *StreamingHealthCheck

NewStreamingHealthCheck creates a new streaming health check.

func (*StreamingHealthCheck) Check

Check performs the streaming health check.

type StreamingHealthCheckComposite

type StreamingHealthCheckComposite struct {
	*health.CompositeHealthCheck
	// contains filtered or unexported fields
}

StreamingHealthCheckComposite combines multiple streaming health checks.

func NewStreamingHealthCheckComposite

func NewStreamingHealthCheckComposite(name string, checks ...health.HealthCheck) *StreamingHealthCheckComposite

NewStreamingHealthCheckComposite creates a composite streaming health check.

func (*StreamingHealthCheckComposite) AddStreamingCheck

func (shcc *StreamingHealthCheckComposite) AddStreamingCheck(check health.HealthCheck)

AddStreamingCheck adds a streaming check to the composite.

func (*StreamingHealthCheckComposite) GetStreamingChecks

func (shcc *StreamingHealthCheckComposite) GetStreamingChecks() []health.HealthCheck

GetStreamingChecks returns the individual streaming checks.

type StreamingHealthCheckConfig

type StreamingHealthCheckConfig struct {
	Name             string
	StreamingManager any
	CheckConnections bool
	CheckRooms       bool
	CheckPresence    bool
	CheckScaling     bool
	Timeout          time.Duration
	Critical         bool
	Tags             map[string]string
}

StreamingHealthCheckConfig contains configuration for streaming health checks.

type StreamingHealthCheckFactory

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

StreamingHealthCheckFactory creates streaming health checks based on configuration.

func NewStreamingHealthCheckFactory

func NewStreamingHealthCheckFactory(container shared.Container) *StreamingHealthCheckFactory

NewStreamingHealthCheckFactory creates a new factory.

func (*StreamingHealthCheckFactory) CreateStreamingHealthCheck

func (factory *StreamingHealthCheckFactory) CreateStreamingHealthCheck(name string, checkType string, critical bool) (health.HealthCheck, error)

CreateStreamingHealthCheck creates a streaming health check.

type StreamingPerformanceHealthCheck

type StreamingPerformanceHealthCheck struct {
	*StreamingHealthCheck
	// contains filtered or unexported fields
}

StreamingPerformanceHealthCheck checks streaming performance metrics.

func NewStreamingPerformanceHealthCheck

func NewStreamingPerformanceHealthCheck(config *StreamingHealthCheckConfig) *StreamingPerformanceHealthCheck

NewStreamingPerformanceHealthCheck creates a new streaming performance health check.

func (*StreamingPerformanceHealthCheck) Check

Check performs streaming performance health checks.

type TempDirHealthCheck

type TempDirHealthCheck struct {
	*health.BaseHealthCheck
	// contains filtered or unexported fields
}

TempDirHealthCheck performs health checks on temporary directories.

func NewTempDirHealthCheck

func NewTempDirHealthCheck(config *DiskHealthCheckConfig) *TempDirHealthCheck

NewTempDirHealthCheck creates a new temporary directory health check.

func (*TempDirHealthCheck) Check

Check performs the temporary directory health check.

type WebSocketHealthCheck

type WebSocketHealthCheck struct {
	*StreamingHealthCheck
	// contains filtered or unexported fields
}

WebSocketHealthCheck is a specialized health check for WebSocket connections.

func NewWebSocketHealthCheck

func NewWebSocketHealthCheck(config *StreamingHealthCheckConfig) *WebSocketHealthCheck

NewWebSocketHealthCheck creates a new WebSocket health check.

func (*WebSocketHealthCheck) Check

Check performs WebSocket-specific health checks.

Jump to

Keyboard shortcuts

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