Documentation
¶
Index ¶
- type Alert
- type AlertSilenceRequest
- type AlertsListRequest
- type AlertsListResponse
- type Handler
- type Service
- func (s *Service) List(ctx context.Context, req *AlertsListRequest) (*AlertsListResponse, error)
- func (s *Service) Silence(ctx context.Context, req *AlertSilenceRequest) error
- func (s *Service) SilenceDelete(ctx context.Context, req *SilenceDeleteRequest) error
- func (s *Service) SilencesList(ctx context.Context, req *SilencesListRequest) (*SilencesListResponse, error)
- type Silence
- type SilenceDeleteRequest
- type SilencesListRequest
- type SilencesListResponse
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 (*Handler) SilenceDelete ¶
SilenceDelete handles the request to delete a silence rule
func (*Handler) SilencesList ¶
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 ¶
func (s *Service) List(ctx context.Context, req *AlertsListRequest) (*AlertsListResponse, error)
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