monitor

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	ID          uint           `json:"id" gorm:"primaryKey"`
	Name        string         `json:"name" gorm:"not null"`
	Description string         `json:"description"`
	UserID      string         `json:"user_id" gorm:"index;not null"`
	Condition   string         `json:"condition" gorm:"not null"`
	Status      AlertStatus    `json:"status" gorm:"default:0"`
	CreatedAt   time.Time      `json:"created_at"`
	UpdatedAt   time.Time      `json:"updated_at"`
	DeletedAt   gorm.DeletedAt `json:"-" gorm:"index"`
}

func (Alert) TableName

func (Alert) TableName() string

type AlertStatus

type AlertStatus int
const (
	AlertStatusActive AlertStatus = iota
	AlertStatusInactive
	AlertStatusTriggered
)

func (AlertStatus) String

func (a AlertStatus) String() string

type Metric

type Metric struct {
	ID          uint      `json:"id" gorm:"primaryKey"`
	ServiceName string    `json:"service_name" gorm:"index;not null"`
	Name        string    `json:"name" gorm:"not null"`
	Value       float64   `json:"value"`
	Unit        string    `json:"unit"`
	Tags        string    `json:"tags"`
	Timestamp   time.Time `json:"timestamp"`
	CreatedAt   time.Time `json:"created_at"`
}

func (Metric) TableName

func (Metric) TableName() string

type Service

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

func NewService

func NewService() *Service

func (*Service) CreateAlert

func (s *Service) CreateAlert(ctx context.Context, alert *Alert) error

func (*Service) CreateMetric

func (s *Service) CreateMetric(ctx context.Context, metric *Metric) error

func (*Service) GetAlerts

func (s *Service) GetAlerts(ctx context.Context, userID string) ([]*Alert, error)

func (*Service) GetMetrics

func (s *Service) GetMetrics(ctx context.Context, serviceName string) ([]*Metric, error)

func (*Service) SetDB

func (s *Service) SetDB(db *gorm.DB)

Jump to

Keyboard shortcuts

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