health

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BotStatus added in v1.13.0

type BotStatus struct {
	Status BotkubeStatus `json:"status,omitempty"`
}

type BotkubeStatus

type BotkubeStatus string
const (
	BotkubeStatusHealthy   BotkubeStatus = "Healthy"
	BotkubeStatusUnhealthy BotkubeStatus = "Unhealthy"
)

type Checker

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

Checker gives health bot agent status.

func NewChecker

func NewChecker(ctx context.Context, config *config.Config, stats *plugin.HealthStats) Checker

NewChecker create new health checker.

func (*Checker) AddNotifier added in v1.13.0

func (h *Checker) AddNotifier(key string, notifier Notifier)

AddNotifier add platform bot instance

func (*Checker) GetStatus added in v1.13.0

func (h *Checker) GetStatus() *Status

func (*Checker) IsReady

func (h *Checker) IsReady() bool

IsReady gets info if bot is ready

func (*Checker) MarkAsReady

func (h *Checker) MarkAsReady()

MarkAsReady marks bot as ready

func (*Checker) NewServer

func (h *Checker) NewServer(log logrus.FieldLogger, port string) *httpx.Server

NewServer creates http server for health checker.

func (*Checker) ServeHTTP

func (h *Checker) ServeHTTP(resp http.ResponseWriter, _ *http.Request)

ServeHTTP serves status on health endpoint.

type Failed added in v1.13.0

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

Failed represents failed platform.

func NewFailed added in v1.13.0

func NewFailed(failureReason FailureReasonMsg, errorMsg string) *Failed

NewFailed creates a new Failed instance.

func (*Failed) GetStatus added in v1.13.0

func (b *Failed) GetStatus() PlatformStatus

GetStatus gets bot status.

type FailureReasonMsg

type FailureReasonMsg string
const (
	FailureReasonQuotaExceeded      FailureReasonMsg = "Quota exceeded"
	FailureReasonMaxRetriesExceeded FailureReasonMsg = "Max retries exceeded"
	FailureReasonConnectionError    FailureReasonMsg = "Connection error"
)

type Notifier

type Notifier interface {
	GetStatus() PlatformStatus
}

Notifier represents notifier interface

type PlatformStatus

type PlatformStatus struct {
	Status   PlatformStatusMsg `json:"status,omitempty"`
	Restarts string            `json:"restarts,omitempty"`
	Reason   FailureReasonMsg  `json:"reason,omitempty"`
	ErrorMsg string            `json:"errorMsg,omitempty"`
}

PlatformStatus defines single platform status

type PlatformStatusMsg

type PlatformStatusMsg string
const (
	StatusUnknown   PlatformStatusMsg = "Unknown"
	StatusHealthy   PlatformStatusMsg = "Healthy"
	StatusUnHealthy PlatformStatusMsg = "Unhealthy"
)

type PluginStatus added in v1.13.0

type PluginStatus struct {
	Enabled  bool   `json:"enabled,omitempty"`
	Status   string `json:"status,omitempty"`
	Restarts string `json:"restarts,omitempty"`
}

type Status added in v1.13.0

type Status struct {
	Botkube   BotStatus               `json:"botkube"`
	Plugins   map[string]PluginStatus `json:"plugins,omitempty"`
	Platforms platformStatuses        `json:"platforms,omitempty"`
}

Status defines bot agent status.

Jump to

Keyboard shortcuts

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