alert

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 13 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        string      `json:"id"`
	Type      string      `json:"type"`
	Level     string      `json:"level"`
	Message   string      `json:"message"`
	Source    string      `json:"source"`
	Status    string      `json:"status"`
	Details   interface{} `json:"details"`
	CreatedAt string      `json:"createdAt"`
}

Alert represents an alert

type AlertSilenceRequest

type AlertSilenceRequest struct {
	ID       string `uri:"id"`
	Duration int    `json:"duration"` // 分钟
	Reason   string `json:"reason"`
}

AlertSilenceRequest represents the request to silence an alert

type AlertsListRequest

type AlertsListRequest struct {
	Page     int    `form:"page,optional,default=1"`
	PageSize int    `form:"pageSize,optional,default=20"`
	Level    string `form:"level"`
	Status   string `form:"status"`
}

AlertsListRequest represents the request to list alerts

type AlertsListResponse

type AlertsListResponse struct {
	Items []Alert `json:"items"`
	Total int64   `json:"total"`
	Page  int     `json:"page"`
	Size  int     `json:"pageSize"`
}

AlertsListResponse represents the response with a list of alerts

type Handler

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

func NewHandler

func NewHandler(service *Service) *Handler

func (*Handler) List

func (h *Handler) List(c *gin.Context)

List handles the request to list alerts

func (*Handler) Silence

func (h *Handler) Silence(c *gin.Context)

Silence handles the request to silence an alert

func (*Handler) SilenceDelete

func (h *Handler) SilenceDelete(c *gin.Context)

SilenceDelete handles the request to delete a silence rule

func (*Handler) SilencesList

func (h *Handler) SilencesList(c *gin.Context)

SilencesList handles the request to list silence rules

type Service

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

func NewService

func NewService(svcCtx *svc.ServiceContext) *Service

func (*Service) List

List retrieves a paginated list of alerts

func (*Service) Silence

func (s *Service) Silence(ctx context.Context, req *AlertSilenceRequest) error

Silence silences an alert

func (*Service) SilenceDelete

func (s *Service) SilenceDelete(ctx context.Context, req *SilenceDeleteRequest) error

SilenceDelete deletes a silence rule

func (*Service) SilencesList

func (s *Service) SilencesList(ctx context.Context, req *SilencesListRequest) (*SilencesListResponse, error)

SilencesList retrieves a list of silence rules

type Silence

type Silence struct {
	Id        string      `json:"id"`
	AlertType string      `json:"alertType"`
	Matchers  interface{} `json:"matchers"`
	StartAt   string      `json:"startAt"`
	EndAt     string      `json:"endAt"`
	CreatedBy string      `json:"createdBy"`
}

Silence represents a silence rule

type SilenceDeleteRequest

type SilenceDeleteRequest struct {
	ID string `uri:"id"`
}

SilenceDeleteRequest represents the request to delete a silence

type SilencesListRequest

type SilencesListRequest struct{}

SilencesListRequest represents the request to list silences

type SilencesListResponse

type SilencesListResponse struct {
	Items []Silence `json:"items"`
}

SilencesListResponse represents the response with a list of silences

Jump to

Keyboard shortcuts

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