Documentation
¶
Index ¶
- Constants
- Variables
- func CMDLineForPID(pid int32) (string, []string, error)
- func CWDForPID(pid int32) (string, error)
- func FailedConnectToSpan(trace *TCPRequestInfo) request.Span
- func FindNetworkNamespace(pid int32) (string, error)
- func FixupSpec(spec *ebpf.CollectionSpec, overrideKernelVersion bool)
- func ForwardRingbuf(cfg *config.EBPFTracer, ringbuffer *ebpf.Map, filter ServiceFilter, ...) func(context.Context, *msg.Queue[[]request.Span])
- func GoKafkaSaramaToSpan(event *GoSaramaClientInfo, data *KafkaInfo) request.Span
- func HTTPInfoEventToSpan(parseCtx *EBPFParseContext, event *BPFHTTPInfo) (request.Span, bool, error)
- func HTTPRequestTraceToSpan(trace *HTTPRequestTrace) request.Span
- func HasHostNetworkAccess() (bool, error)
- func HasHostPidAccess() bool
- func KernelVersion() (major, minor int)
- func ReadBPFTraceAsSpan(parseCtx *EBPFParseContext, cfg *config.EBPFTracer, record *ringbuf.Record, ...) (request.Span, bool, error)
- func ReadFailedConnectIntoSpan(record *ringbuf.Record, filter ServiceFilter) (request.Span, bool, error)
- func ReadGoKafkaGoRequestIntoSpan(record *ringbuf.Record) (request.Span, bool, error)
- func ReadGoMongoRequestIntoSpan(record *ringbuf.Record) (request.Span, bool, error)
- func ReadGoOTelEventIntoSpan(record *ringbuf.Record) (request.Span, bool, error)
- func ReadGoRedisRequestIntoSpan(record *ringbuf.Record) (request.Span, bool, error)
- func ReadGoSaramaRequestIntoSpan(record *ringbuf.Record) (request.Span, bool, error)
- func ReadHTTP2InfoIntoSpan(parseContext *EBPFParseContext, record *ringbuf.Record, filter ServiceFilter) (request.Span, bool, error)
- func ReadHTTPInfoIntoSpan(parseCtx *EBPFParseContext, record *ringbuf.Record, filter ServiceFilter) (request.Span, bool, error)
- func ReadSQLRequestTraceAsSpan(record *ringbuf.Record) (request.Span, bool, error)
- func ReadTCPRequestIntoSpan(parseCtx *EBPFParseContext, cfg *config.EBPFTracer, record *ringbuf.Record, ...) (request.Span, bool, error)
- func ReinterpretCast[T any](b []byte) (*T, error)
- func RootDirectoryForPID(pid int32) string
- func SQLRequestTraceToSpan(trace *SQLRequestTrace) request.Span
- func SharedRingbuf(eventContext *EBPFEventContext, parseContext *EBPFParseContext, ...) func(context.Context, []io.Closer, *msg.Queue[[]request.Span])
- func SupportsContextPropagationWithProbe(log *slog.Logger) bool
- func SupportsEBPFLoops(log *slog.Logger, overrideKernelVersion bool) bool
- func TCPToFastCGIToSpan(trace *TCPRequestInfo, op, uri string, status int) request.Span
- func TCPToKafkaToSpan(trace *TCPRequestInfo, data *KafkaInfo) request.Span
- func TCPToMongoToSpan(trace *TCPRequestInfo, info *mongoSpanInfo) request.Span
- func TCPToRedisToSpan(trace *TCPRequestInfo, op, text string, status, db int, ...) request.Span
- func TCPToSQLToSpan(trace *TCPRequestInfo, op, table, sql string, kind request.SQLKind, ...) request.Span
- type BPFConnInfo
- type BPFHTTP2Info
- type BPFHTTPInfo
- type DNSInfo
- type EBPFEventContext
- type EBPFParseContext
- type Filter
- type GoKafkaGoClientInfo
- type GoMongoClientInfo
- type GoOTelSpanTrace
- type GoRedisClientInfo
- type GoSaramaClientInfo
- type HTTPInfo
- type HTTPRequestTrace
- type IdentityPidsFilter
- func (pf *IdentityPidsFilter) AllowPID(_ uint32, _ uint32, _ *svc.Attrs, _ PIDType)
- func (pf *IdentityPidsFilter) BlockPID(_ uint32, _ uint32)
- func (pf *IdentityPidsFilter) CurrentPIDs(_ PIDType) map[uint32]map[uint32]svc.Attrs
- func (pf *IdentityPidsFilter) Filter(inputSpans []request.Span) []request.Span
- func (pf *IdentityPidsFilter) ValidPID(_ uint32, _ uint32, _ PIDType) bool
- type InstrumentedLibsT
- type Iter
- type KafkaInfo
- func ProcessKafkaEvent(pkt []byte, rpkt []byte, ...) (*KafkaInfo, bool, error)
- func ProcessKafkaRequest(pkt []byte, kafkaTopicUUIDToName *simplelru.LRU[kafkaparser.UUID, string]) (*KafkaInfo, bool, error)
- func ProcessPossibleKafkaEvent(event *TCPRequestInfo, pkt []byte, rpkt []byte, ...) (*KafkaInfo, bool, error)
- type KernelLockdown
- type LibModule
- type MisclassifiedEvent
- type MongoRequestKey
- type MongoRequestValue
- type Operation
- type PIDInfo
- type PIDType
- type PIDsFilter
- func (pf *PIDsFilter) AllowPID(pid, ns uint32, svc *svc.Attrs, pidType PIDType)
- func (pf *PIDsFilter) BlockPID(pid, ns uint32)
- func (pf *PIDsFilter) CurrentPIDs(t PIDType) map[uint32]map[uint32]svc.Attrs
- func (pf *PIDsFilter) Filter(inputSpans []request.Span) []request.Span
- func (pf *PIDsFilter) ValidPID(userPID, ns uint32, pidType PIDType) bool
- type PartitionInfo
- type PendingMongoDBRequests
- type ProbeDesc
- type Protocol
- type SQLRequestTrace
- type SectionType
- type ServiceFilter
- type SockMsg
- type SockOps
- type TCPLargeBufferHeader
- type TCPRequestInfo
Constants ¶
const ( EventTypeSQL = 5 // EVENT_SQL_CLIENT EventTypeKHTTP = 6 // HTTP Events generated by kprobes EventTypeKHTTP2 = 7 // HTTP2/gRPC Events generated by kprobes EventTypeTCP = 8 // Unknown TCP protocol to be classified by user space EventTypeGoSarama = 9 // Kafka client for Go (Shopify/IBM Sarama) EventTypeGoRedis = 10 // Redis client for Go EventTypeGoKafkaGo = 11 // Kafka-Go client from Segment-io EventTypeTCPLargeBuffer = 12 // Dynamically sized TCP buffers EventOTelSDKGo = 13 // OTel SDK manual span EventTypeGoMongo = 14 // Go MongoDB spans EventTypeFailedConnect = 15 // Failed Connections EventTypeDNS = 16 // DNS events )
const ( ProtocolTypeUnknown uint8 = iota ProtocolTypeMySQL ProtocolTypePostgres )
Kernel-side classification
const ( FrameData http2FrameType = 0x0 FrameHeaders http2FrameType = 0x1 FramePriority http2FrameType = 0x2 FrameRSTStream http2FrameType = 0x3 FrameSettings http2FrameType = 0x4 FramePushPromise http2FrameType = 0x5 FramePing http2FrameType = 0x6 FrameGoAway http2FrameType = 0x7 FrameWindowUpdate http2FrameType = 0x8 FrameContinuation http2FrameType = 0x9 )
Variables ¶
var ActiveNamespaces = make(map[uint32]uint32)
var IntegrityModeOverride = false
var MisclassifiedEvents = make(chan MisclassifiedEvent)
Functions ¶
func CMDLineForPID ¶ added in v0.3.0
CMDLineForPID parses /proc/<pid>/cmdline and extracts the executable and arguments. Returns the executable path and a slice of arguments (excluding the executable). The cmdline file contains null-separated arguments.
func CWDForPID ¶ added in v0.3.0
CWDForPID extracts the current working directory for a process by reading the symlink at /proc/<pid>/cwd.
func FailedConnectToSpan ¶
func FailedConnectToSpan(trace *TCPRequestInfo) request.Span
func FindNetworkNamespace ¶
func FixupSpec ¶
func FixupSpec(spec *ebpf.CollectionSpec, overrideKernelVersion bool)
func ForwardRingbuf ¶
func ForwardRingbuf( cfg *config.EBPFTracer, ringbuffer *ebpf.Map, filter ServiceFilter, reader func(*EBPFParseContext, *config.EBPFTracer, *ringbuf.Record, ServiceFilter) (request.Span, bool, error), logger *slog.Logger, metrics imetrics.Reporter, spansChan *msg.Queue[[]request.Span], closers ...io.Closer, ) func(context.Context, *msg.Queue[[]request.Span])
func GoKafkaSaramaToSpan ¶
func GoKafkaSaramaToSpan(event *GoSaramaClientInfo, data *KafkaInfo) request.Span
func HTTPInfoEventToSpan ¶
func HTTPInfoEventToSpan(parseCtx *EBPFParseContext, event *BPFHTTPInfo) (request.Span, bool, error)
func HTTPRequestTraceToSpan ¶
func HTTPRequestTraceToSpan(trace *HTTPRequestTrace) request.Span
func HasHostNetworkAccess ¶
func HasHostPidAccess ¶
func HasHostPidAccess() bool
func KernelVersion ¶
func KernelVersion() (major, minor int)
KernelVersion from https://github.com/golang/go/blob/go1.21.3/src/internal/syscall/unix/kernel_version_linux.go
func ReadBPFTraceAsSpan ¶
func ReadBPFTraceAsSpan(parseCtx *EBPFParseContext, cfg *config.EBPFTracer, record *ringbuf.Record, filter ServiceFilter) (request.Span, bool, error)
func ReadGoOTelEventIntoSpan ¶
func ReadHTTP2InfoIntoSpan ¶
func ReadHTTP2InfoIntoSpan(parseContext *EBPFParseContext, record *ringbuf.Record, filter ServiceFilter) (request.Span, bool, error)
func ReadHTTPInfoIntoSpan ¶
func ReadHTTPInfoIntoSpan(parseCtx *EBPFParseContext, record *ringbuf.Record, filter ServiceFilter) (request.Span, bool, error)
func ReadTCPRequestIntoSpan ¶
func ReadTCPRequestIntoSpan(parseCtx *EBPFParseContext, cfg *config.EBPFTracer, record *ringbuf.Record, filter ServiceFilter) (request.Span, bool, error)
ReadTCPRequestIntoSpan returns a request.Span from the provided ring buffer record
func ReinterpretCast ¶
func RootDirectoryForPID ¶
func SQLRequestTraceToSpan ¶
func SQLRequestTraceToSpan(trace *SQLRequestTrace) request.Span
func SharedRingbuf ¶
func SharedRingbuf( eventContext *EBPFEventContext, parseContext *EBPFParseContext, cfg *config.EBPFTracer, filter ServiceFilter, ringbuffer *ebpf.Map, metrics imetrics.Reporter, ) func(context.Context, []io.Closer, *msg.Queue[[]request.Span])
SharedRingbuf returns a function reads HTTPRequestTraces from an input ring buffer, accumulates them into an internal buffer, and forwards them to an output events channel, previously converted to request.Span instances.
func TCPToFastCGIToSpan ¶
func TCPToFastCGIToSpan(trace *TCPRequestInfo, op, uri string, status int) request.Span
func TCPToKafkaToSpan ¶
func TCPToKafkaToSpan(trace *TCPRequestInfo, data *KafkaInfo) request.Span
func TCPToMongoToSpan ¶
func TCPToMongoToSpan(trace *TCPRequestInfo, info *mongoSpanInfo) request.Span
func TCPToRedisToSpan ¶
Types ¶
type BPFConnInfo ¶
type BPFConnInfo BpfConnectionInfoT
HTTPRequestTrace contains information from an HTTP request as directly received from the eBPF layer. This contains low-level C structures for accurate binary read from ring buffer.
type BPFHTTP2Info ¶
type BPFHTTP2Info BpfHttp2GrpcRequestT
type BPFHTTPInfo ¶
type BPFHTTPInfo BpfHttpInfoT
HTTPRequestTrace contains information from an HTTP request as directly received from the eBPF layer. This contains low-level C structures for accurate binary read from ring buffer.
type DNSInfo ¶
type DNSInfo BpfDnsReqT
HTTPRequestTrace contains information from an HTTP request as directly received from the eBPF layer. This contains low-level C structures for accurate binary read from ring buffer.
type EBPFEventContext ¶
type EBPFEventContext struct {
CommonPIDsFilter ServiceFilter
EBPFMaps map[string]*ebpf.Map
RingBufLock sync.Mutex
MapsLock sync.Mutex
LoadLock sync.Mutex
}
func NewEBPFEventContext ¶
func NewEBPFEventContext() *EBPFEventContext
type EBPFParseContext ¶
type EBPFParseContext struct {
// contains filtered or unexported fields
}
func NewEBPFParseContext ¶
func NewEBPFParseContext(cfg *config.EBPFTracer, spansChan *msg.Queue[[]request.Span], filter ServiceFilter) *EBPFParseContext
type GoKafkaGoClientInfo ¶
type GoKafkaGoClientInfo BpfKafkaGoReqT
HTTPRequestTrace contains information from an HTTP request as directly received from the eBPF layer. This contains low-level C structures for accurate binary read from ring buffer.
type GoMongoClientInfo ¶
type GoMongoClientInfo BpfMongoGoClientReqT
HTTPRequestTrace contains information from an HTTP request as directly received from the eBPF layer. This contains low-level C structures for accurate binary read from ring buffer.
type GoOTelSpanTrace ¶
type GoOTelSpanTrace BpfOtelSpanT
HTTPRequestTrace contains information from an HTTP request as directly received from the eBPF layer. This contains low-level C structures for accurate binary read from ring buffer.
type GoRedisClientInfo ¶
type GoRedisClientInfo BpfRedisClientReqT
HTTPRequestTrace contains information from an HTTP request as directly received from the eBPF layer. This contains low-level C structures for accurate binary read from ring buffer.
type GoSaramaClientInfo ¶
type GoSaramaClientInfo BpfKafkaClientReqT
HTTPRequestTrace contains information from an HTTP request as directly received from the eBPF layer. This contains low-level C structures for accurate binary read from ring buffer.
type HTTPRequestTrace ¶
type HTTPRequestTrace BpfHttpRequestTraceT
HTTPRequestTrace contains information from an HTTP request as directly received from the eBPF layer. This contains low-level C structures for accurate binary read from ring buffer.
type IdentityPidsFilter ¶
type IdentityPidsFilter struct{}
IdentityPidsFilter is a PIDsFilter that does not filter anything. It is feasible for concrete cases like GPU tracer
func (*IdentityPidsFilter) BlockPID ¶
func (pf *IdentityPidsFilter) BlockPID(_ uint32, _ uint32)
func (*IdentityPidsFilter) CurrentPIDs ¶
type InstrumentedLibsT ¶
Hold onto Linux inode numbers of files that are already instrumented, e.g. libssl.so.3
func (InstrumentedLibsT) AddRef ¶
func (libs InstrumentedLibsT) AddRef(id uint64) *LibModule
func (InstrumentedLibsT) At ¶
func (libs InstrumentedLibsT) At(id uint64) *LibModule
func (InstrumentedLibsT) Find ¶
func (libs InstrumentedLibsT) Find(id uint64) *LibModule
type KafkaInfo ¶
type KafkaInfo struct {
Operation Operation
Topic string
ClientID string
PartitionInfo *PartitionInfo
}
func ProcessKafkaEvent ¶
func ProcessKafkaRequest ¶
func ProcessPossibleKafkaEvent ¶
func ProcessPossibleKafkaEvent(event *TCPRequestInfo, pkt []byte, rpkt []byte, kafkaTopicUUIDToName *simplelru.LRU[kafkaparser.UUID, string]) (*KafkaInfo, bool, error)
ProcessPossibleKafkaEvent processes a TCP packet and returns error if the packet is not a valid Kafka request. Otherwise, return kafka.Info with the processed data.
type KernelLockdown ¶
type KernelLockdown uint8
const ( KernelLockdownNone KernelLockdown = iota + 1 KernelLockdownIntegrity KernelLockdownConfidentiality KernelLockdownOther )
func KernelLockdownMode ¶
func KernelLockdownMode() KernelLockdown
type MisclassifiedEvent ¶
type MisclassifiedEvent struct {
EventType int
TCPInfo *TCPRequestInfo
}
type MongoRequestKey ¶
type MongoRequestKey struct {
// contains filtered or unexported fields
}
type MongoRequestValue ¶
type MongoRequestValue struct {
RequestSections []mongoSection
ResponseSections []mongoSection
StartTime int64 // timestamp when the request was received
EndTime int64 // timestamp when the response was received
Flags int32 // Flags to indicate the state of the request
}
func ProcessMongoEvent ¶
func ProcessMongoEvent(buf []uint8, startTime int64, endTime int64, connInfo BpfConnectionInfoT, requests PendingMongoDBRequests) (*MongoRequestValue, bool, error)
type PIDsFilter ¶
type PIDsFilter struct {
// contains filtered or unexported fields
}
PIDsFilter keeps a thread-safe copy of the PIDs whose traces are allowed to be forwarded. Its Filter method filters the request.Span instances whose PIDs are not in the allowed list.
func (*PIDsFilter) AllowPID ¶
func (pf *PIDsFilter) AllowPID(pid, ns uint32, svc *svc.Attrs, pidType PIDType)
func (*PIDsFilter) BlockPID ¶
func (pf *PIDsFilter) BlockPID(pid, ns uint32)
func (*PIDsFilter) CurrentPIDs ¶
type PartitionInfo ¶
type PendingMongoDBRequests ¶
type PendingMongoDBRequests = *expirable.LRU[MongoRequestKey, *MongoRequestValue]
type ProbeDesc ¶
type ProbeDesc struct {
// Required, if true, will cancel the execution of the eBPF Tracer
// if the function has not been found in the executable
Required bool
// The eBPF program to attach to the symbol as a uprobe (either to the
// symbol name or to StartOffset)
Start *ebpf.Program
// The eBPF program to attach to the symbol either as a uretprobe or as a
// uprobe to ReturnOffsets
End *ebpf.Program
// Optional offset to the start of the symbol
StartOffset uint64
// Optional list of the offsets of every RET instruction in the symbol
ReturnOffsets []uint64
}
ProbeDesc holds the information of the instrumentation points of a given function/symbol
type SQLRequestTrace ¶
type SQLRequestTrace BpfSqlRequestTraceT
HTTPRequestTrace contains information from an HTTP request as directly received from the eBPF layer. This contains low-level C structures for accurate binary read from ring buffer.
type SectionType ¶
type SectionType uint8
type ServiceFilter ¶
type ServiceFilter interface {
AllowPID(uint32, uint32, *svc.Attrs, PIDType)
BlockPID(uint32, uint32)
ValidPID(uint32, uint32, PIDType) bool
Filter(inputSpans []request.Span) []request.Span
CurrentPIDs(PIDType) map[uint32]map[uint32]svc.Attrs
}
func CommonPIDsFilter ¶
func CommonPIDsFilter(c *services.DiscoveryConfig, metrics imetrics.Reporter) ServiceFilter
type SockOps ¶
type TCPLargeBufferHeader ¶
type TCPLargeBufferHeader BpfTcpLargeBufferT
HTTPRequestTrace contains information from an HTTP request as directly received from the eBPF layer. This contains low-level C structures for accurate binary read from ring buffer.
type TCPRequestInfo ¶
type TCPRequestInfo BpfTcpReqT
HTTPRequestTrace contains information from an HTTP request as directly received from the eBPF layer. This contains low-level C structures for accurate binary read from ring buffer.
Source Files
¶
- common.go
- common_linux.go
- dns_request_transform.go
- failed_connect_transform.go
- fast_cgi_detect_transform.go
- go_kafka_transform.go
- go_otel_transform.go
- http2grpc_transform.go
- http_transform.go
- instrumented_libs.go
- kafka_detect_transform.go
- mongo_detect_transform.go
- pids.go
- redis_detect_transform.go
- ringbuf.go
- spanner.go
- sql_detect_mysql.go
- sql_detect_postgres.go
- sql_detect_transform.go
- tcp_detect_transform.go
- tcp_large_buffer.go