entity

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnalysisEventStart = iota
	AnalysisEventProcessing
	AnalysisEventCompleted
	AnalysisEventFailed
)
View Source
const (
	TaskStatusStarting   = 0  // 启动中
	TaskStatusProcessing = 1  // 处理中
	TaskStatusCompleted  = 2  // 已完成
	TaskStatusFailed     = -1 // 失败
	TaskStatusNotFound   = -2 // 未找到
)

TaskStatus 任务状态

Variables

This section is empty.

Functions

func GetFileStoragePath added in v1.1.2

func GetFileStoragePath(constPath string, runtime bool) string

Types

type AllUnfinishedFunction added in v1.1.2

type AllUnfinishedFunction struct {
	Name        string `json:"name"`        // 函数名称
	GID         uint64 `json:"gid"`         // goroutine ID
	RunningTime string `json:"runningTime"` // 运行时间
	IsBlocking  bool   `json:"isBlocking"`  // 是否阻塞
	FunctionID  int64  `json:"functionId"`  // 函数ID
}

UnfinishedFunction 未完成的函数

type AnalysisEvent added in v1.1.0

type AnalysisEvent struct {
	Type    int    // 类型
	Message string // 消息
}

type AnalysisOptions added in v1.1.0

type AnalysisOptions struct {
	Algo         string // 分析算法
	IgnoreMethod string // 忽略分析特定方法
}

AnalysisOptions 分析选项

type AnalysisTask added in v1.1.0

type AnalysisTask struct {
	ID          string
	ProjectPath string
	Filename    string
	Options     *AnalysisOptions // 分析选项
}

AnalysisTask 分析任务

type AnalysisTaskStatus added in v1.1.0

type AnalysisTaskStatus struct {
	Status   int     // 状态
	Progress float64 // 进度
	Message  string  // 消息
}

AnalysisTaskStatus 分析任务状态

type DbFileInfo added in v1.1.0

type DbFileInfo struct {
	Path       string    // 路径
	Name       string    // 名称
	Size       int64     // 大小
	CreateTime time.Time // 创建时间
}

DbFileInfo 数据库文件信息

type FileInfo added in v1.1.2

type FileInfo struct {
	ID          int64     `json:"id"`           // 文件ID
	FileName    string    `json:"file_name"`    // 文件名
	FilePath    string    `json:"file_path"`    // 文件存储路径
	FileType    FileType  `json:"file_type"`    // 文件类型
	FileSize    int64     `json:"file_size"`    // 文件大小(字节)
	ContentType string    `json:"content_type"` // 文件MIME类型
	UploadTime  time.Time `json:"upload_time"`  // 上传时间
	Description string    `json:"description"`  // 文件描述
}

FileInfo 文件信息结构体

type FileType added in v1.1.2

type FileType string

FileType 文件类型枚举

const (
	FileTypeRuntime FileType = "runtime" // 运行时文件
	FileTypeStatic  FileType = "static"  // 静态分析文件
)

func NewFileType added in v1.1.2

func NewFileType(fileType v1.FileType) FileType

type FuncEdge added in v1.1.2

type FuncEdge struct {
	CallerKey string `json:"caller_key"`
	CalleeKey string `json:"callee_key"`
}

type FuncNode added in v1.1.2

type FuncNode struct {
	Key      string   `json:"key"`      // 唯一标识
	Pkg      string   `json:"pkg"`      // 包名
	Name     string   `json:"name"`     // 函数名
	Parent   []string `json:"parent"`   // 父节点索引
	Children []string `json:"children"` // 子节点索引
}

FuncNode 表示函数节点

type FunctionCallGraph added in v1.1.0

type FunctionCallGraph struct {
	Nodes []FunctionGraphNode // 图节点
	Edges []FunctionGraphEdge // 图边
}

FunctionCallGraph 函数调用关系图

type FunctionCallStats added in v1.1.2

type FunctionCallStats struct {
	Name        string  // 函数名称
	Package     string  // 包名
	CallCount   int     // 调用次数
	CallerCount int     // 调用方数量
	CalleeCount int     // 被调用方数量
	AvgTime     string  // 平均执行时间
	MaxTime     string  // 最大执行时间
	MinTime     string  // 最小执行时间
	TimeStdDev  float64 // 执行时间标准差
}

FunctionCallStats 函数调用统计信息

type FunctionGraphEdge added in v1.1.0

type FunctionGraphEdge struct {
	Source   string // 源节点ID
	Target   string // 目标节点ID
	Label    string // 边标签
	EdgeType string // 边类型: "caller_to_root", "root_to_callee"
}

FunctionGraphEdge 函数调用关系图边

type FunctionGraphNode added in v1.1.0

type FunctionGraphNode struct {
	ID        string // 节点ID
	Name      string // 函数名称
	Package   string // 包名
	CallCount int    // 调用次数
	AvgTime   string // 平均耗时
	NodeType  string // 节点类型: "root", "caller", "callee"
}

FunctionGraphNode 函数调用关系图节点

type FunctionNode added in v1.1.0

type FunctionNode struct {
	ID        string         // 节点ID
	Name      string         // 函数名称
	Package   string         // 包名
	CallCount int            // 调用次数
	AvgTime   string         // 平均耗时
	Children  []FunctionNode // 子节点
}

FunctionNode 函数调用节点

type GoroutineStats added in v1.1.0

type GoroutineStats struct {
	Active   int    // 活跃Goroutine数量
	AvgTime  string // 平均执行时间
	MaxDepth int    // 最大调用深度
}

GoroutineStats Goroutine统计信息

type GoroutineTrace added in v1.1.2

type GoroutineTrace struct {
	ID           int64  `json:"id"`           // 自增ID
	GID          uint64 `json:"gid"`          // Goroutine ID
	TimeCost     string `json:"timeCost"`     // 执行时间
	CreateTime   string `json:"createTime"`   // 创建时间
	IsFinished   int    `json:"isFinished"`   // 是否完成
	InitFuncName string `json:"initFuncName"` // 初始函数名
	Depth        int    `json:"depth"`        // 调用深度
}

GoroutineTrace 存储goroutine信息的结构体

type HotFunction added in v1.1.0

type HotFunction struct {
	Name      string // 函数名称
	Package   string // 包名
	CallCount int    // 调用次数
	TotalTime string // 总耗时
	AvgTime   string // 平均耗时
}

HotFunction 热点函数

type HotPathInfo added in v1.1.2

type HotPathInfo struct {
	Path      []string // 路径上的函数名称序列
	CallCount int      // 调用次数
	TotalTime string   // 总耗时
	AvgTime   string   // 平均耗时
}

HotPathInfo 热点路径信息

type PackageDependency added in v1.1.2

type PackageDependency struct {
	Source string `json:"source"`
	Target string `json:"target"`
	Count  int    `json:"count"`
}

包依赖结构

type PerformanceAnomaly added in v1.1.2

type PerformanceAnomaly struct {
	Name        string            // 函数名称
	Package     string            // 包名
	AnomalyType string            // 异常类型: "time_variance", "depth_anomaly", "frequency_anomaly"
	Description string            // 异常描述
	Severity    float64           // 严重程度 (0.0-1.0)
	Details     map[string]string // 详细信息
}

PerformanceAnomaly 性能异常信息

type Repository added in v1.1.0

type Repository struct {
	ID            int    `json:"id"`
	Name          string `json:"name"`
	FullName      string `json:"full_name"`
	Description   string `json:"description"`
	DefaultBranch string `json:"default_branch"`
	WebURL        string `json:"web_url"`
	SSHURLToRepo  string `json:"ssh_url_to_repo"`
	HTTPURLToRepo string `json:"http_url_to_repo"`
	Visibility    string `json:"visibility"`
	LastActivity  string `json:"last_activity_at"`
}

Repository GitLab仓库信息

type StaticAnalysisResult added in v1.1.0

type StaticAnalysisResult struct {
	TotalFunctions      int                 `json:"totalFunctions"`
	TotalCalls          int                 `json:"totalCalls"`
	TotalPackages       int                 `json:"totalPackages"`
	PackageDependencies []PackageDependency `json:"packageDependencies"`
	HotFunctions        []HotFunction       `json:"hotFunctions"`
}

分析结果结构

type StaticDbFile added in v1.1.0

type StaticDbFile struct {
	Path       string    `json:"path"`
	Name       string    `json:"name"`
	Size       int64     `json:"size"`
	CreateTime time.Time `json:"createTime"`
}

数据库文件结构

type TraceData

type TraceData struct {
	ID        int64                   `json:"id"`        // 唯一标识符
	Name      string                  `json:"name"`      // 函数名称
	GID       uint64                  `json:"gid"`       // Goroutine ID
	Indent    int                     `json:"indent"`    // 缩进级别
	Params    []functrace.TraceParams `json:"params"`    // 参数JSON字符串
	TimeCost  string                  `json:"timeCost"`  // 执行时间
	ParentId  uint64                  `json:"parentId"`  // 父函数ID
	CreatedAt string                  `json:"createdAt"` // 创建时间
	Seq       string                  `json:"seq"`       // 序列号
}

TraceData 存储跟踪数据的结构体

type TreeGraph added in v1.1.2

type TreeGraph struct {
	Root *TreeNode `json:"root"` // 根节点
}

TreeGraph 表示完整的树状图结构

type TreeNode added in v1.1.2

type TreeNode struct {
	Name      string      `json:"name"`                // 节点名称
	Value     int64       `json:"value,omitempty"`     // 值,只在tooltip中显示
	Collapsed bool        `json:"collapsed,omitempty"` // 是否默认折叠,true表示折叠
	Children  []*TreeNode `json:"children,omitempty"`  // 子节点
}

TreeNode 表示树状图节点

type UnfinishedFunction added in v1.1.1

type UnfinishedFunction struct {
	ID         int64  // ID
	Name       string // 函数名称
	GID        uint64 // Goroutine ID
	StartTime  string // 开始时间
	ElapsedMS  int64  // 已经过去的毫秒数
	StackTrace string // 堆栈跟踪
	IsBlocking bool   // 是否阻塞
}

UnfinishedFunction 未完成的函数

Jump to

Keyboard shortcuts

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