Documentation
¶
Index ¶
- type AuthConfig
- type PProf
- func (c *PProf) Clone() internal.Configurable
- func (c *PProf) Disable() *PProf
- func (c *PProf) Enable() *PProf
- func (c *PProf) EnableBlockProfile() *PProf
- func (c *PProf) EnableCPUProfile() *PProf
- func (c *PProf) EnableForDevelopment() *PProf
- func (c *PProf) EnableGoroutineProfile() *PProf
- func (c *PProf) EnableMutexProfile() *PProf
- func (c *PProf) Get() interface{}
- func (c *PProf) IsEnabled() bool
- func (c *PProf) Set(data interface{})
- func (c *PProf) Validate() error
- func (c *PProf) WithAllowedIPs(ips []string) *PProf
- func (c *PProf) WithAuthToken(token string) *PProf
- func (c *PProf) WithEnabled(enabled bool) *PProf
- func (c *PProf) WithModuleName(moduleName string) *PProf
- func (c *PProf) WithPathPrefix(pathPrefix string) *PProf
- func (c *PProf) WithPort(port int) *PProf
- func (c *PProf) WithProfiles(cpu, goroutine, block, mutex, heap, allocs, threadCreate, trace bool) *PProf
- func (c *PProf) WithSampling(memoryRate, blockRate, mutexFraction int) *PProf
- type ProfilesConfig
- type SamplingConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthConfig ¶
type AuthConfig struct {
Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` // 是否启用认证
AuthToken string `mapstructure:"auth-token" yaml:"auth-token" json:"authToken"` // 认证令牌
AllowedIPs []string `mapstructure:"allowed-ips" yaml:"allowed-ips" json:"allowedIps"` // 允许的IP列表
RequireAuth bool `mapstructure:"require-auth" yaml:"require-auth" json:"requireAuth"` // 是否需要认证
}
AuthConfig 认证配置
type PProf ¶
type PProf struct {
ModuleName string `mapstructure:"module-name" yaml:"module-name" json:"moduleName"` // 模块名称
Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"` // 是否启用PProf
PathPrefix string `mapstructure:"path-prefix" yaml:"path-prefix" json:"pathPrefix"` // PProf路径前缀
Port int `mapstructure:"port" yaml:"port" json:"port"` // PProf服务端口
EnableProfiles *ProfilesConfig `mapstructure:"enable-profiles" yaml:"enable-profiles" json:"enableProfiles"` // 启用的性能分析
Sampling *SamplingConfig `mapstructure:"sampling" yaml:"sampling" json:"sampling"` // 采样配置
Authentication *AuthConfig `mapstructure:"authentication" yaml:"authentication" json:"authentication"` // 认证配置
}
PProf 性能分析配置
func (*PProf) EnableBlockProfile ¶
EnableBlockProfile 启用阻塞性能分析
func (*PProf) EnableCPUProfile ¶
EnableCPUProfile 启用CPU性能分析
func (*PProf) EnableForDevelopment ¶
EnableForDevelopment 启用开发环境配置
func (*PProf) EnableGoroutineProfile ¶
EnableGoroutineProfile 启用协程性能分析
func (*PProf) EnableMutexProfile ¶
EnableMutexProfile 启用互斥锁性能分析
func (*PProf) WithAllowedIPs ¶
WithAllowedIPs 设置允许的IP列表
func (*PProf) WithAuthToken ¶
WithAuthToken 设置认证令牌
func (*PProf) WithEnabled ¶
WithEnabled 设置是否启用PProf
func (*PProf) WithModuleName ¶
WithModuleName 设置模块名称
func (*PProf) WithPathPrefix ¶
WithPathPrefix 设置PProf路径前缀
func (*PProf) WithProfiles ¶
func (c *PProf) WithProfiles(cpu, goroutine, block, mutex, heap, allocs, threadCreate, trace bool) *PProf
WithProfiles 设置启用的性能分析
func (*PProf) WithSampling ¶
WithSampling 设置采样配置
type ProfilesConfig ¶
type ProfilesConfig struct {
CPU bool `mapstructure:"cpu" yaml:"cpu" json:"cpu"` // CPU性能分析
Goroutine bool `mapstructure:"goroutine" yaml:"goroutine" json:"goroutine"` // 协程性能分析
Block bool `mapstructure:"block" yaml:"block" json:"block"` // 阻塞性能分析
Mutex bool `mapstructure:"mutex" yaml:"mutex" json:"mutex"` // 互斥锁性能分析
Heap bool `mapstructure:"heap" yaml:"heap" json:"heap"` // 堆内存分析
Allocs bool `mapstructure:"allocs" yaml:"allocs" json:"allocs"` // 内存分配分析
ThreadCreate bool `mapstructure:"threadcreate" yaml:"threadcreate" json:"threadcreate"` // 线程创建分析
Trace bool `mapstructure:"trace" yaml:"trace" json:"trace"` // 追踪分析
}
ProfilesConfig 性能分析配置
type SamplingConfig ¶
type SamplingConfig struct {
MemoryRate int `mapstructure:"memory-rate" yaml:"memory-rate" json:"memoryRate"` // 内存采样率
BlockRate int `mapstructure:"block-rate" yaml:"block-rate" json:"blockRate"` // 阻塞采样率
MutexFraction int `mapstructure:"mutex-fraction" yaml:"mutex-fraction" json:"mutexFraction"` // 互斥锁采样比例
}
SamplingConfig 采样配置
Click to show internal directories.
Click to hide internal directories.