profiling

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GroupDetailResponse

type GroupDetailResponse struct {
	ServerTime int64          `json:"server_time"`
	TaskGroup  TaskGroupModel `json:"task_group_status"`
	Tasks      []TaskModel    `json:"tasks_status"`
}

type Service

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

Service is used to provide a kind of feature.

func NewService

func NewService(config *config.Config, db *dbstore.DB) *Service

NewService creates a new service.

func (*Service) Register

func (s *Service) Register(r *gin.RouterGroup, auth *user.AuthService)

Register register the handlers to the service.

type StartRequest

type StartRequest struct {
	Targets      []utils.RequestTargetNode `json:"targets"`
	DurationSecs uint                      `json:"duration_secs"`
}

type Task

type Task struct {
	*TaskModel
	// contains filtered or unexported fields
}

Task is the unit to fetch profiling information.

func NewTask

func NewTask(taskGroup *TaskGroup, target utils.RequestTargetNode, tls bool) *Task

NewTask creates a new profiling task.

type TaskGroup

type TaskGroup struct {
	*TaskGroupModel
	// contains filtered or unexported fields
}

TaskGroup is the collection of tasks.

func NewTaskGroup

func NewTaskGroup(db *dbstore.DB, profileDurationSecs uint, stats utils.RequestTargetStatistics) *TaskGroup

NewTaskGroup create a new profiling task group.

type TaskGroupModel

type TaskGroupModel struct {
	ID                  uint                          `json:"id" gorm:"primary_key"`
	State               TaskState                     `json:"state" gorm:"index"`
	ProfileDurationSecs uint                          `json:"profile_duration_secs"`
	TargetStats         utils.RequestTargetStatistics `json:"target_stats" gorm:"embedded;embedded_prefix:target_stats_"`
	StartedAt           int64                         `json:"started_at"`
}

func (TaskGroupModel) TableName

func (TaskGroupModel) TableName() string

type TaskModel

type TaskModel struct {
	ID          uint                    `json:"id" gorm:"primary_key"`
	TaskGroupID uint                    `json:"task_group_id" gorm:"index"`
	State       TaskState               `json:"state" gorm:"index"`
	Target      utils.RequestTargetNode `json:"target" gorm:"embedded;embedded_prefix:target_"`
	FilePath    string                  `json:"file_path" gorm:"type:text"`
	Error       string                  `json:"error" gorm:"type:text"`
	StartedAt   int64                   `json:"started_at"` // The start running time, reset when retry. Used to estimate approximate profiling progress.
}

func (TaskModel) TableName

func (TaskModel) TableName() string

type TaskState

type TaskState int

TaskState is used to represent the task/task group state.

const (
	TaskStateError TaskState = iota

	// TaskGroup can only have these two states.
	TaskStateRunning
	TaskStateFinish
)

Built-in task state

Jump to

Keyboard shortcuts

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