monitor

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: PostgreSQL Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const ResourceTypeInstanceMonitorResource resource.Type = "monitor.instance"

Variables

This section is empty.

Functions

func InstanceMonitorResourceIdentifier

func InstanceMonitorResourceIdentifier(instanceID string) resource.Identifier

func Provide

func Provide(i *do.Injector)

func RegisterResourceTypes

func RegisterResourceTypes(registry *resource.Registry)

Types

type Check

type Check func(ctx context.Context) error

type HostMonitor

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

func NewHostMonitor

func NewHostMonitor(
	logger zerolog.Logger,
	svc *host.Service,
) *HostMonitor

func (*HostMonitor) Start

func (m *HostMonitor) Start(ctx context.Context)

func (*HostMonitor) Stop

func (m *HostMonitor) Stop()

type InstanceMonitor

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

func NewInstanceMonitor

func NewInstanceMonitor(
	orch database.Orchestrator,
	dbSvc *database.Service,
	certSvc *certificates.Service,
	logger zerolog.Logger,
	databaseID string,
	instanceID string,
	dbName string,
) *InstanceMonitor

func (*InstanceMonitor) Start

func (m *InstanceMonitor) Start(ctx context.Context)

func (*InstanceMonitor) Stop

func (m *InstanceMonitor) Stop()

type InstanceMonitorResource

type InstanceMonitorResource struct {
	DatabaseID   string `json:"database_id"`
	InstanceID   string `json:"instance_id"`
	DatabaseName string `json:"db_name"`
	HostID       string `json:"host_id"`
}

func (*InstanceMonitorResource) Create

func (*InstanceMonitorResource) Delete

func (*InstanceMonitorResource) Dependencies

func (m *InstanceMonitorResource) Dependencies() []resource.Identifier

func (*InstanceMonitorResource) DiffIgnore

func (m *InstanceMonitorResource) DiffIgnore() []string

func (*InstanceMonitorResource) Executor

func (*InstanceMonitorResource) Identifier

func (*InstanceMonitorResource) Refresh

func (*InstanceMonitorResource) ResourceVersion

func (m *InstanceMonitorResource) ResourceVersion() string

func (*InstanceMonitorResource) Update

type InstanceMonitorStore

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

func NewInstanceMonitorStore

func NewInstanceMonitorStore(client *clientv3.Client, root string) *InstanceMonitorStore

func (*InstanceMonitorStore) DeleteByHostID

func (s *InstanceMonitorStore) DeleteByHostID(hostID string) storage.DeleteOp

func (*InstanceMonitorStore) DeleteByKey

func (s *InstanceMonitorStore) DeleteByKey(hostID, instanceID string) storage.DeleteOp

func (*InstanceMonitorStore) GetAllByHostID

func (*InstanceMonitorStore) GetByKey

func (s *InstanceMonitorStore) GetByKey(hostID, instanceID string) storage.GetOp[*StoredInstanceMonitor]

func (*InstanceMonitorStore) HostPrefix

func (s *InstanceMonitorStore) HostPrefix(hostID string) string

func (*InstanceMonitorStore) Key

func (s *InstanceMonitorStore) Key(hostID, instanceID string) string

func (*InstanceMonitorStore) Prefix

func (s *InstanceMonitorStore) Prefix() string

func (*InstanceMonitorStore) Put

type Monitor

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

func NewMonitor

func NewMonitor(
	logger zerolog.Logger,
	interval time.Duration,
	checks ...Check,
) *Monitor

func (*Monitor) Check

func (m *Monitor) Check(ctx context.Context)

func (*Monitor) Start

func (m *Monitor) Start(ctx context.Context)

func (*Monitor) Stop

func (m *Monitor) Stop()

type Service

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

func NewService

func NewService(
	cfg config.Config,
	logger zerolog.Logger,
	dbSvc *database.Service,
	certSvc *certificates.Service,
	dbOrch database.Orchestrator,
	store *Store,
	hostSvc *host.Service,
) *Service

func (*Service) CreateInstanceMonitor

func (s *Service) CreateInstanceMonitor(ctx context.Context, databaseID, instanceID, dbName string) error

func (*Service) DeleteInstanceMonitor

func (s *Service) DeleteInstanceMonitor(ctx context.Context, instanceID string) error

func (*Service) HasInstanceMonitor

func (s *Service) HasInstanceMonitor(instanceID string) bool

func (*Service) Shutdown

func (s *Service) Shutdown() error

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

type Store

type Store struct {
	InstanceMonitor *InstanceMonitorStore
	// contains filtered or unexported fields
}

func NewStore

func NewStore(client *clientv3.Client, root string) *Store

func (*Store) Txn

func (s *Store) Txn(ops ...storage.TxnOperation) storage.Txn

type StoredInstanceMonitor

type StoredInstanceMonitor struct {
	storage.StoredValue
	HostID           string `json:"host_id"`
	DatabaseID       string `json:"database_id"`
	InstanceID       string `json:"instance_id"`
	DatabaseName     string `json:"database_name"`
	InstanceHostname string `json:"instance_hostname"`
}

Jump to

Keyboard shortcuts

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