Documentation ¶
Index ¶
- Constants
- Variables
- type CreateTaskGroupRequest
- type PreviewModel
- type Scheduler
- type SearchLogRequest
- type SearchTarget
- type ServerType
- type Service
- func (s *Service) CancelTask(c *gin.Context)
- func (s *Service) CreateTaskGroup(c *gin.Context)
- func (s *Service) DeleteTaskGroup(c *gin.Context)
- func (s *Service) DownloadLogs(c *gin.Context)
- func (s *Service) GetAllTaskGroups(c *gin.Context)
- func (s *Service) GetDownloadToken(c *gin.Context)
- func (s *Service) GetTaskGroup(c *gin.Context)
- func (s *Service) GetTaskGroupPreview(c *gin.Context)
- func (s *Service) Register(r *gin.RouterGroup, auth *user.AuthService)
- func (s *Service) RetryTask(c *gin.Context)
- type Task
- type TaskGroup
- type TaskGroupModel
- type TaskGroupResponse
- type TaskGroupState
- type TaskModel
- type TaskState
Constants ¶
const ( TaskMaxPreviewLines = 500 TaskGroupMaxPreviewLines = 5000 )
Variables ¶
var MaxRecvMsgSize = math.MaxInt64
MaxRecvMsgSize set max gRPC receive message size received from server. If any message size is larger than current value, an error will be reported from gRPC.
var ServerTypeMap = map[ServerType]string{ ServerTypeTiDB: "tidb", ServerTypeTiKV: "tikv", ServerTypePD: "pd", }
Functions ¶
This section is empty.
Types ¶
type CreateTaskGroupRequest ¶
type CreateTaskGroupRequest struct { Request SearchLogRequest `json:"request" binding:"required"` SearchTargets []SearchTarget `json:"search_targets" binding:"required"` }
type PreviewModel ¶
type PreviewModel struct { ID uint `json:"id" grom:"primary_key"` TaskID uint `json:"task_id" gorm:"index:task"` TaskGroupID uint `json:"task_group_id" gorm:"index:task_group"` Time int64 `json:"time" gorm:"index:task,task_group"` Level diagnosticspb.LogLevel `json:"level" gorm:"type:integer"` Message string `json:"message" gorm:"type:text"` }
func (PreviewModel) TableName ¶
func (PreviewModel) TableName() string
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
func NewScheduler ¶
func (*Scheduler) AsyncAbort ¶
func (*Scheduler) AsyncStart ¶
func (s *Scheduler) AsyncStart(taskGroupModel *TaskGroupModel, tasksModel []*TaskModel) bool
type SearchLogRequest ¶
type SearchLogRequest diagnosticspb.SearchLogRequest
func (*SearchLogRequest) Scan ¶
func (r *SearchLogRequest) Scan(src interface{}) error
type SearchTarget ¶
type SearchTarget struct { Kind ServerType `json:"kind" example:"1"` IP string `json:"ip" gorm:"size:32" example:"127.0.0.1"` Port int `json:"port" example:"4000"` StatusPort int `json:"status_port" example:"10080"` }
func (*SearchTarget) Address ¶
func (s *SearchTarget) Address() string
func (*SearchTarget) FileName ¶
func (s *SearchTarget) FileName() string
func (*SearchTarget) GRPCAddress ¶
func (s *SearchTarget) GRPCAddress() string
func (*SearchTarget) ServerName ¶
func (s *SearchTarget) ServerName() string
func (*SearchTarget) String ¶
func (s *SearchTarget) String() string
type ServerType ¶
type ServerType int
const ( ServerTypeTiDB ServerType = 1 ServerTypeTiKV ServerType = 2 ServerTypePD ServerType = 3 )
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) CancelTask ¶
@Summary Cancel running tasks @Description cancel all running tasks in a task group @Produce json @Param id path string true "task group id" @Security JwtAuth @Success 200 {object} utils.APIEmptyResponse @Failure 401 {object} utils.APIError "Unauthorized failure" @Failure 400 {object} utils.APIError @Router /logs/taskgroups/{id}/cancel [post]
func (*Service) CreateTaskGroup ¶
@Summary Create and run task group @Description Create and run task group @Produce json @Param request body CreateTaskGroupRequest true "Request body" @Security JwtAuth @Success 200 {object} TaskGroupResponse @Failure 400 {object} utils.APIError @Failure 401 {object} utils.APIError "Unauthorized failure" @Failure 500 {object} utils.APIError @Router /logs/taskgroup [put]
func (*Service) DeleteTaskGroup ¶
@Summary Delete task group @Description delete a task group by providing task group ID @Produce json @Param id path string true "task group id" @Security JwtAuth @Success 200 {object} utils.APIEmptyResponse @Failure 401 {object} utils.APIError "Unauthorized failure" @Failure 500 {object} utils.APIError @Router /logs/taskgroups/{id} [delete]
func (*Service) DownloadLogs ¶
@Summary Download @Description download logs by multiple task IDs @Produce application/x-tar,application/zip @Param token query string true "download token" @Failure 400 {object} utils.APIError @Failure 401 {object} utils.APIError "Unauthorized failure" @Failure 500 {object} utils.APIError @Router /logs/download [get]
func (*Service) GetAllTaskGroups ¶
@Summary List all task groups @Description list all log search taskgroups @Produce json @Security JwtAuth @Success 200 {array} TaskGroupResponse @Failure 401 {object} utils.APIError "Unauthorized failure" @Failure 500 {object} utils.APIError @Router /logs/taskgroups [get]
func (*Service) GetDownloadToken ¶
@Summary Get download token @Description get download token with multiple task IDs @Produce plain @Param id query []string false "task id" @Security JwtAuth @Success 200 {string} string "xxx" @Failure 400 {object} utils.APIError @Failure 401 {object} utils.APIError "Unauthorized failure" @Router /logs/download/acquire_token [get]
func (*Service) GetTaskGroup ¶
@Summary List tasks in a task group @Description list all log search tasks in a task group by providing task group ID @Produce json @Param id path string true "Task Group ID" @Security JwtAuth @Success 200 {object} TaskGroupResponse @Failure 401 {object} utils.APIError "Unauthorized failure" @Failure 500 {object} utils.APIError @Router /logs/taskgroups/{id} [get]
func (*Service) GetTaskGroupPreview ¶
@Summary Preview logs in a task group @Description preview fetched logs in a task group by providing task group ID @Produce json @Param id path string true "task group id" @Security JwtAuth @Success 200 {array} PreviewModel @Failure 401 {object} utils.APIError "Unauthorized failure" @Failure 500 {object} utils.APIError @Router /logs/taskgroups/{id}/preview [get]
func (*Service) Register ¶
func (s *Service) Register(r *gin.RouterGroup, auth *user.AuthService)
func (*Service) RetryTask ¶
@Summary Retry failed tasks @Description retry tasks that has been failed in a task group @Produce json @Param id path string true "task group id" @Security JwtAuth @Success 200 {object} utils.APIEmptyResponse @Failure 400 {object} utils.APIError @Failure 401 {object} utils.APIError "Unauthorized failure" @Failure 500 {object} utils.APIError @Router /logs/taskgroups/{id}/retry [post]
type TaskGroupModel ¶
type TaskGroupModel struct { ID uint `json:"id" gorm:"primary_key"` SearchRequest *SearchLogRequest `json:"search_request" gorm:"type:text"` State TaskGroupState `json:"state" gorm:"index"` LogStoreDir *string `json:"log_store_dir" gorm:"type:text"` }
func (*TaskGroupModel) Delete ¶
func (tg *TaskGroupModel) Delete(db *dbstore.DB)
func (TaskGroupModel) TableName ¶
func (TaskGroupModel) TableName() string
type TaskGroupResponse ¶
type TaskGroupResponse struct { TaskGroup TaskGroupModel `json:"task_group"` Tasks []*TaskModel `json:"tasks"` }
type TaskGroupState ¶
type TaskGroupState int
const ( TaskGroupStateRunning TaskGroupState = 1 TaskGroupStateFinished TaskGroupState = 2 )
type TaskModel ¶
type TaskModel struct { ID uint `json:"id" gorm:"primary_key"` TaskGroupID uint `json:"task_group_id" gorm:"index"` SearchTarget *SearchTarget `json:"search_target" gorm:"embedded;embedded_prefix:search_target_"` State TaskState `json:"state" gorm:"index"` LogStorePath *string `json:"log_store_path" gorm:"type:text"` Error *string `json:"error" gorm:"type:text"` }
func (*TaskModel) RemoveDataAndPreview ¶
Note: this function does not save model itself.