Documentation
¶
Index ¶
- Constants
- Variables
- func NewRunner(config *base.TaskConfig, moduleMgr *module.Manager) (base.ProfileTaskRunner, error)
- type ActiveConnectionInBPF
- type AddressWithPid
- type ConnectionContext
- type ConnectionProtocol
- type ConnectionRole
- type Context
- func (c *Context) AddProcesses(processes []api.ProcessInterface) error
- func (c *Context) DeleteProcesses(processes []api.ProcessInterface) (emptyProcesses bool, deleteError error)
- func (c *Context) FlushAllConnection() ([]*ConnectionContext, error)
- func (c *Context) Init(bpf *bpfObjects, linker *Linker)
- func (c *Context) RegisterAllHandlers()
- func (c *Context) StartSocketAddressParser(ctx context.Context)
- type DelegateRunner
- func (r *DelegateRunner) FlushData() ([]*v3.EBPFProfilingData, error)
- func (r *DelegateRunner) Init(task *base.ProfilingTask, processes []api.ProcessInterface) error
- func (r *DelegateRunner) Run(ctx context.Context, notify base.ProfilingRunningSuccessNotify) error
- func (r *DelegateRunner) Stop() error
- type GoStringInC
- type GoTLSArgsLocationType
- type GoTLSSymbolAddresses
- type HistogramDataKey
- type HistogramDataUnit
- type LinkFunc
- type Linker
- func (m *Linker) AddLink(linkF LinkFunc, p *ebpf.Program, trySymbolNames ...string)
- func (m *Linker) AddSysCall(call string, enter, exit *ebpf.Program)
- func (m *Linker) AddSysCallWithKProbe(call string, linkK LinkFunc, p *ebpf.Program)
- func (m *Linker) AddTracePoint(sys, name string, p *ebpf.Program)
- func (m *Linker) Close() error
- func (m *Linker) HasError() error
- func (m *Linker) OpenUProbeExeFile(path string) *UProbeExeFile
- func (m *Linker) ReadEventAsync(emap *ebpf.Map, reader RingBufferReader, dataSupplier func() interface{})
- type LocalWithPeerAddress
- type NodeTLSAddrInBPF
- type OpenSSLFdSymAddrConfigInBPF
- type PeerAddress
- type PidMatchTrafficKey
- type PidToRemoteTrafficKey
- type PidWithRole
- type ProcessTraffic
- type RingBufferReader
- type Runner
- type SocketBasicKey
- type SocketCloseEvent
- type SocketConnectEvent
- type SocketDataCounter
- type SocketDataCounterWithHistory
- type SocketDataDirection
- type SocketDataHistogram
- func (h *SocketDataHistogram) Increase(other *SocketDataHistogram)
- func (h *SocketDataHistogram) IncreaseByValue(val uint64)
- func (h *SocketDataHistogram) NotEmpty() bool
- func (h *SocketDataHistogram) Overwrite(other *SocketDataHistogram)
- func (h *SocketDataHistogram) Update(bucket uint64, value uint32)
- type SocketDataHistogramWithHistory
- type SocketDataStaticsType
- type SocketExceptionOperationEvent
- type SocketExceptionOperationType
- type SocketExceptionValue
- type SocketPair
- type SymbolLocation
- type TrafficAnalyzer
- type UProbeExeFile
- func (u *UProbeExeFile) AddGoLink(symbol string, enter, exit *ebpf.Program, elfFile *elf.File)
- func (u *UProbeExeFile) AddGoLinkWithType(symbol string, enter bool, p *ebpf.Program, elfFile *elf.File)
- func (u *UProbeExeFile) AddLink(symbol string, enter, exit *ebpf.Program)
- func (u *UProbeExeFile) AddLinkWithSymbols(symbol []string, enter, exit *ebpf.Program)
- func (u *UProbeExeFile) AddLinkWithType(symbol string, enter bool, p *ebpf.Program)
Constants ¶
const ( SocketDataStaticsTypeRTT = 1 SocketDataStaticsTypeExeTime = 2 )
Variables ¶
var SocketHistogramBucketsCount = len(SocketHistogramBucketsNs)
var SocketHistogramBucketsNs = []float64{0, 10000, 50000, 100000, 500000, 1000000, 1200000, 1500000, 1700000, 2000000,
2500000, 3000000, 5000000, 7000000, 10000000, 13000000, 16000000, 20000000, 25000000, 30000000, 35000000, 40000000,
45000000, 50000000, 70000000, 100000000, 150000000, 200000000, 300000000, 500000000, 1000000000, 2000000000,
3000000000, 5000000000}
SocketHistogramBucketsNs means the histogram bucket: 0ms, 0.01ms, 0.05ms, 0.1ms, 0.5ms, 1ms, 1.2ms, 1.5ms, 1.7ms, 2ms, 2.5ms, 3ms, 5ms, 7ms, 10ms, 13ms, 16ms, 20ms, 25ms, 30ms, 35ms, 40ms, 45ms, 50ms, 70ms, 100ms, 150ms, 200ms, 300ms, 500ms, 1s, 2s, 3s, 5s value unit: ns
var SocketHistogramBucketsUs = []float64{0, 10, 50, 100, 500, 1000, 1200, 1500, 1700, 2000,
2500, 3000, 5000, 7000, 10000, 13000, 16000, 20000, 25000, 30000, 35000, 40000,
45000, 50000, 70000, 100000, 150000, 200000, 300000, 500000, 1000000, 2000000,
3000000, 5000000}
SocketHistogramBucketsUs same with SocketHistogramBucketsNs, but the value unit: us
Functions ¶
func NewRunner ¶
func NewRunner(config *base.TaskConfig, moduleMgr *module.Manager) (base.ProfileTaskRunner, error)
Types ¶
type ActiveConnectionInBPF ¶
type ActiveConnectionInBPF struct {
RandomID uint64
Pid uint32
SocketFD uint32
Role ConnectionRole
SocketFamily uint32
RemoteAddrV4 uint32
RemoteAddrV6 [16]uint8
RemoteAddrPort uint32
LocalAddrV4 uint32
LocalAddrV6 [16]uint8
LocalAddrPort uint32
WriteBytes uint64
WriteCount uint64
WriteExeTime uint64
ReadBytes uint64
ReadCount uint64
ReadExeTime uint64
WriteRTTCount uint64
WriteRTTExeTime uint64
// Protocol analyze context
Protocol ConnectionProtocol
Fix uint32
ProtocolPrevCount uint64
ProtocolPrevBuf [4]byte
ProtocolPrependHeader uint32
IsSSL uint32
// the connect event is already sent
ConnectEventIsSent uint32
}
type AddressWithPid ¶
type ConnectionContext ¶
type ConnectionContext struct {
// basic metadata
ConnectionID uint64
RandomID uint64
LocalPid uint32
SocketFD uint32
LocalProcesses []api.ProcessInterface
ConnectionClosed bool
Protocol ConnectionProtocol
IsSSL bool
// socket metadata
Role ConnectionRole
LocalIP string
LocalPort uint16
RemoteIP string
RemotePort uint16
// basic statics
// read/write
WriteCounter *SocketDataCounterWithHistory
ReadCounter *SocketDataCounterWithHistory
// write RTT
WriteRTTCounter *SocketDataCounterWithHistory
// histograms
// write execute time and RTT
WriteRTTHistogram *SocketDataHistogramWithHistory
WriteExeTimeHistogram *SocketDataHistogramWithHistory
// read execute time
ReadExeTimeHistogram *SocketDataHistogramWithHistory
// the connection connect or close execute time
ConnectExecuteTime uint64
CloseExecuteTime uint64
// exception counters
RetransmitCounter *SocketDataCounter
DropCounter *SocketDataCounter
// Flush the data content to the oap count
FlushDataCount int
}
type ConnectionProtocol ¶
type ConnectionProtocol uint32
const ( ConnectionProtocolUnknown ConnectionProtocol = 0 ConnectionProtocolHTTP ConnectionProtocol = 1 ConnectionProtocolHTTP2 ConnectionProtocol = 2 ConnectionProtocolMySQL ConnectionProtocol = 3 ConnectionProtocolCQL ConnectionProtocol = 4 ConnectionProtocolPGSQL ConnectionProtocol = 5 ConnectionProtocolDNS ConnectionProtocol = 6 ConnectionProtocolRedis ConnectionProtocol = 7 ConnectionProtocolNATS ConnectionProtocol = 8 ConnectionProtocolMongo ConnectionProtocol = 9 ConnectionProtocolKafka ConnectionProtocol = 10 ConnectionProtocolMux ConnectionProtocol = 11 )
func (ConnectionProtocol) String ¶
func (c ConnectionProtocol) String() string
type ConnectionRole ¶
type ConnectionRole uint32
ConnectionRole represents the role of the current process is the connection whether it's a server or a client, if it's not trigger the connection/accept request, then it's unknown
const ( ConnectionRoleUnknown ConnectionRole = 0 ConnectionRoleClient ConnectionRole = 1 ConnectionRoleServer ConnectionRole = 2 )
func (ConnectionRole) Revert ¶
func (r ConnectionRole) Revert() ConnectionRole
func (ConnectionRole) String ¶
func (r ConnectionRole) String() string
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext() *Context
func (*Context) AddProcesses ¶
func (c *Context) AddProcesses(processes []api.ProcessInterface) error
func (*Context) DeleteProcesses ¶
func (c *Context) DeleteProcesses(processes []api.ProcessInterface) (emptyProcesses bool, deleteError error)
func (*Context) FlushAllConnection ¶
func (c *Context) FlushAllConnection() ([]*ConnectionContext, error)
func (*Context) RegisterAllHandlers ¶
func (c *Context) RegisterAllHandlers()
func (*Context) StartSocketAddressParser ¶
type DelegateRunner ¶
type DelegateRunner struct {
// contains filtered or unexported fields
}
func (*DelegateRunner) FlushData ¶
func (r *DelegateRunner) FlushData() ([]*v3.EBPFProfilingData, error)
func (*DelegateRunner) Init ¶
func (r *DelegateRunner) Init(task *base.ProfilingTask, processes []api.ProcessInterface) error
func (*DelegateRunner) Run ¶
func (r *DelegateRunner) Run(ctx context.Context, notify base.ProfilingRunningSuccessNotify) error
func (*DelegateRunner) Stop ¶
func (r *DelegateRunner) Stop() error
type GoStringInC ¶
type GoTLSArgsLocationType ¶
type GoTLSArgsLocationType uint32
const ( GoTLSArgsLocationTypeStack GoTLSArgsLocationType = 1 GoTLSArgsLocationTypeRegister GoTLSArgsLocationType = 2 )
type GoTLSSymbolAddresses ¶
type GoTLSSymbolAddresses struct {
// net.Conn addresses
FDSysFDOffset uint64
TLSConnOffset uint64
GIDOffset uint64
TCPConnOffset uint64
// casgstatus(goroutine status change) function relate locations
CasgStatusGPLoc SymbolLocation
CasgStatusNEWValLoc SymbolLocation
// write function relate locations
WriteConnectionLoc SymbolLocation
WriteBufferLoc SymbolLocation
WriteRet0Loc SymbolLocation
WriteRet1Loc SymbolLocation
// write function relate locations
ReadConnectionLoc SymbolLocation
ReadBufferLoc SymbolLocation
ReadRet0Loc SymbolLocation
ReadRet1Loc SymbolLocation
}
type HistogramDataKey ¶
type HistogramDataKey struct {
ConnectionID uint64
RandomID uint64
DataDirection SocketDataDirection
DataType SocketDataStaticsType
Bucket uint64
}
type HistogramDataUnit ¶
type HistogramDataUnit int
const ( HistogramDataUnitNS HistogramDataUnit = 1 HistogramDataUnitUS HistogramDataUnit = 2 )
type Linker ¶
type Linker struct {
// contains filtered or unexported fields
}
func (*Linker) AddSysCallWithKProbe ¶
func (*Linker) OpenUProbeExeFile ¶
func (m *Linker) OpenUProbeExeFile(path string) *UProbeExeFile
func (*Linker) ReadEventAsync ¶
func (m *Linker) ReadEventAsync(emap *ebpf.Map, reader RingBufferReader, dataSupplier func() interface{})
type LocalWithPeerAddress ¶
type NodeTLSAddrInBPF ¶
type PeerAddress ¶
type PidMatchTrafficKey ¶
type PidMatchTrafficKey struct {
LocalPid uint32
RemotePid uint32
Role ConnectionRole
}
type PidToRemoteTrafficKey ¶
type PidToRemoteTrafficKey struct {
LocalPid uint32
Role ConnectionRole
RemoteIP string
RemotePort uint16
}
type PidWithRole ¶
type PidWithRole struct {
Pid uint32
Role ConnectionRole
}
type ProcessTraffic ¶
type ProcessTraffic struct {
// local process information
LocalPid uint32
LocalProcesses []api.ProcessInterface
LocalIP string
LocalPort uint16
// current connection role of local process
ConnectionRole ConnectionRole
// the protocol of the connection
Protocol ConnectionProtocol
// current connection is SSL
IsSSL bool
// remote process/address information
RemoteIP string
RemotePort uint16
RemotePid uint32
RemoteProcesses []api.ProcessInterface
// statics
WriteCounter *SocketDataCounter
ReadCounter *SocketDataCounter
// write RTT
WriteRTTCounter *SocketDataCounter
// connection operate
ConnectCounter *SocketDataCounter
CloseCounter *SocketDataCounter
// exception operate
RetransmitCounter *SocketDataCounter
DropCounter *SocketDataCounter
// histograms
// write execute time and RTT
WriteRTTHistogram *SocketDataHistogram
WriteExeTimeHistogram *SocketDataHistogram
// read execute time
ReadExeTimeHistogram *SocketDataHistogram
// connection operate
ConnectExeTimeHistogram *SocketDataHistogram
CloseExeTimeHistogram *SocketDataHistogram
// contains filtered or unexported fields
}
func (*ProcessTraffic) ContainsAnyTraffic ¶
func (r *ProcessTraffic) ContainsAnyTraffic() bool
func (*ProcessTraffic) GenerateMetrics ¶
func (r *ProcessTraffic) GenerateMetrics(metricsPrefix string) []*v3.MeterDataCollection
type RingBufferReader ¶
type RingBufferReader func(data interface{})
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func NewGlobalRunnerContext ¶
func NewGlobalRunnerContext() *Runner
func (*Runner) DeleteProcesses ¶
func (r *Runner) DeleteProcesses(processes []api.ProcessInterface) (bool, error)
type SocketBasicKey ¶
type SocketCloseEvent ¶
type SocketCloseEvent struct {
ConID uint64
RandomID uint64
ExeTime uint64
Pid uint32
SocketFD uint32
Role ConnectionRole
Protocol ConnectionProtocol
IsSSL uint32
Fix uint32
SocketFamily uint32
RemoteAddrV4 uint32
RemoteAddrV6 [16]uint8
RemoteAddrPort uint32
LocalAddrV4 uint32
LocalAddrV6 [16]uint8
LocalAddrPort uint32
Fix1 uint32
WriteBytes uint64
WriteCount uint64
WriteExeTime uint64
ReadBytes uint64
ReadCount uint64
ReadExeTime uint64
WriteRTTCount uint64
WriteRTTExeTime uint64
}
type SocketConnectEvent ¶
type SocketConnectEvent struct {
ConID uint64
RandomID uint64
ExeTime uint64
NeedComplete uint32
Pid uint32
FD uint32
FuncName uint32
// socket information if exists
Role ConnectionRole
SocketFamily uint32
RemoteAddrV4 uint32
RemoteAddrV6 [16]uint8
RemoteAddrPort uint32
LocalAddrV4 uint32
LocalAddrV6 [16]uint8
LocalAddrPort uint32
}
SocketConnectEvent Socket have been connection/accept event
type SocketDataCounter ¶
func NewSocketDataCounter ¶
func NewSocketDataCounter() *SocketDataCounter
func (*SocketDataCounter) Increase ¶
func (s *SocketDataCounter) Increase(d *SocketDataCounter)
func (*SocketDataCounter) IncreaseByValue ¶
func (s *SocketDataCounter) IncreaseByValue(bytes, count, exeTime uint64)
func (*SocketDataCounter) NotEmpty ¶
func (s *SocketDataCounter) NotEmpty() bool
type SocketDataCounterWithHistory ¶
type SocketDataCounterWithHistory struct {
Pre *SocketDataCounter
Cur *SocketDataCounter
}
SocketDataCounterWithHistory means the socket send/receive data metrics
func NewSocketDataCounterWithHistory ¶
func NewSocketDataCounterWithHistory() *SocketDataCounterWithHistory
func (*SocketDataCounterWithHistory) CalculateIncrease ¶
func (c *SocketDataCounterWithHistory) CalculateIncrease() *SocketDataCounter
func (*SocketDataCounterWithHistory) UpdateToCurrent ¶
func (c *SocketDataCounterWithHistory) UpdateToCurrent(bytes, count, exeTime uint64)
type SocketDataDirection ¶
type SocketDataDirection uint32
SocketDataDirection indicates whether data is being written or receive
const ( SocketDataDirectionIngress SocketDataDirection = 1 SocketDataDirectionEgress SocketDataDirection = 2 )
type SocketDataHistogram ¶
type SocketDataHistogram struct {
Unit HistogramDataUnit
Buckets map[uint64]uint32
}
func NewSocketDataHistogram ¶
func NewSocketDataHistogram(unit HistogramDataUnit) *SocketDataHistogram
func (*SocketDataHistogram) Increase ¶
func (h *SocketDataHistogram) Increase(other *SocketDataHistogram)
func (*SocketDataHistogram) IncreaseByValue ¶
func (h *SocketDataHistogram) IncreaseByValue(val uint64)
func (*SocketDataHistogram) NotEmpty ¶
func (h *SocketDataHistogram) NotEmpty() bool
func (*SocketDataHistogram) Overwrite ¶
func (h *SocketDataHistogram) Overwrite(other *SocketDataHistogram)
func (*SocketDataHistogram) Update ¶
func (h *SocketDataHistogram) Update(bucket uint64, value uint32)
type SocketDataHistogramWithHistory ¶
type SocketDataHistogramWithHistory struct {
Pre *SocketDataHistogram
Cur *SocketDataHistogram
}
func NewSocketDataHistogramWithHistory ¶
func NewSocketDataHistogramWithHistory(unit HistogramDataUnit) *SocketDataHistogramWithHistory
func (*SocketDataHistogramWithHistory) CalculateIncrease ¶
func (h *SocketDataHistogramWithHistory) CalculateIncrease() *SocketDataHistogram
func (*SocketDataHistogramWithHistory) RefreshCurrent ¶
func (h *SocketDataHistogramWithHistory) RefreshCurrent()
func (*SocketDataHistogramWithHistory) UpdateToCurrent ¶
func (h *SocketDataHistogramWithHistory) UpdateToCurrent(bucket uint64, val uint32)
type SocketDataStaticsType ¶
type SocketDataStaticsType uint32
SocketDataStaticsType represents the stat type when read or write
type SocketExceptionOperationEvent ¶
type SocketExceptionOperationEvent struct {
Pid uint32
SocketFamily uint32
RemoteAddrV4 uint32
RemoteAddrV6 [16]uint8
RemoteAddrPort uint32
Type SocketExceptionOperationType
}
SocketExceptionOperationEvent Socket have been retransmitted/drop the package event
type SocketExceptionOperationType ¶
type SocketExceptionOperationType uint32
const ( SocketExceptionOperationRetransmit SocketExceptionOperationType = 1 SocketExceptionOperationDrop SocketExceptionOperationType = 2 )
type SocketExceptionValue ¶
type SocketPair ¶
func ParseSocket ¶
func ParseSocket(pid, sockfd uint32) (*SocketPair, error)
type SymbolLocation ¶
type SymbolLocation struct {
Type GoTLSArgsLocationType
Offset uint32
}
type TrafficAnalyzer ¶
type TrafficAnalyzer struct {
// contains filtered or unexported fields
}
func NewTrafficAnalyzer ¶
func NewTrafficAnalyzer(processes map[int32][]api.ProcessInterface) *TrafficAnalyzer
func (*TrafficAnalyzer) CombineConnectionToTraffics ¶
func (t *TrafficAnalyzer) CombineConnectionToTraffics(connections []*ConnectionContext) []*ProcessTraffic
func (*TrafficAnalyzer) IsLocalAddressInCache ¶
func (t *TrafficAnalyzer) IsLocalAddressInCache(ip string) bool
type UProbeExeFile ¶
type UProbeExeFile struct {
// contains filtered or unexported fields
}
func (*UProbeExeFile) AddGoLinkWithType ¶
func (*UProbeExeFile) AddLink ¶
func (u *UProbeExeFile) AddLink(symbol string, enter, exit *ebpf.Program)
func (*UProbeExeFile) AddLinkWithSymbols ¶
func (u *UProbeExeFile) AddLinkWithSymbols(symbol []string, enter, exit *ebpf.Program)
func (*UProbeExeFile) AddLinkWithType ¶
func (u *UProbeExeFile) AddLinkWithType(symbol string, enter bool, p *ebpf.Program)