@@ -33,17 +33,16 @@ type EventType uint32
3333type EventReason uint32
3434
3535const (
36- EventTypeProcessStart EventType = 1
37- EventTypeProcessExit EventType = 2
38- EventTypeConnectionOpen EventType = 3
39- EventTypeConnectionClose EventType = 4
40- EventTypeConnectionError EventType = 5
41- EventTypeListenOpen EventType = 6
42- EventTypeListenClose EventType = 7
43- EventTypeFileOpen EventType = 8
44- EventTypeTCPRetransmit EventType = 9
45- EventTypeL7Request EventType = 10
46- EventTypePythonThreadLock EventType = 11
36+ EventTypeProcessStart EventType = 1
37+ EventTypeProcessExit EventType = 2
38+ EventTypeConnectionOpen EventType = 3
39+ EventTypeConnectionClose EventType = 4
40+ EventTypeConnectionError EventType = 5
41+ EventTypeListenOpen EventType = 6
42+ EventTypeListenClose EventType = 7
43+ EventTypeFileOpen EventType = 8
44+ EventTypeTCPRetransmit EventType = 9
45+ EventTypeL7Request EventType = 10
4746
4847 EventReasonNone EventReason = 0
4948 EventReasonOOMKill EventReason = 1
@@ -73,11 +72,10 @@ type Event struct {
7372type perfMapType uint8
7473
7574const (
76- perfMapTypeProcEvents perfMapType = 1
77- perfMapTypeTCPEvents perfMapType = 2
78- perfMapTypeFileEvents perfMapType = 3
79- perfMapTypeL7Events perfMapType = 4
80- perfMapTypePythonThreadEvents perfMapType = 5
75+ perfMapTypeProcEvents perfMapType = 1
76+ perfMapTypeTCPEvents perfMapType = 2
77+ perfMapTypeFileEvents perfMapType = 3
78+ perfMapTypeL7Events perfMapType = 4
8179)
8280
8381type Tracer struct {
@@ -139,10 +137,18 @@ func (t *Tracer) NodejsStatsIterator() *ebpf.MapIterator {
139137 return t .collection .Maps ["nodejs_stats" ].Iterate ()
140138}
141139
140+ func (t * Tracer ) PythonStatsIterator () * ebpf.MapIterator {
141+ return t .collection .Maps ["python_stats" ].Iterate ()
142+ }
143+
142144type NodejsStats struct {
143145 EventLoopBlockedTime time.Duration
144146}
145147
148+ type PythonStats struct {
149+ ThreadLockWaitTime time.Duration
150+ }
151+
146152type ConnectionId struct {
147153 FD uint64
148154 PID uint32
@@ -230,7 +236,6 @@ func (t *Tracer) ebpf(ch chan<- Event) error {
230236 {name : "tcp_connect_events" , typ : perfMapTypeTCPEvents , perCPUBufferSizePages : 8 , readTimeout : 10 * time .Millisecond },
231237 {name : "tcp_retransmit_events" , typ : perfMapTypeTCPEvents , perCPUBufferSizePages : 4 },
232238 {name : "file_events" , typ : perfMapTypeFileEvents , perCPUBufferSizePages : 4 },
233- {name : "python_thread_events" , typ : perfMapTypePythonThreadEvents , perCPUBufferSizePages : 4 },
234239 }
235240
236241 if ! t .disableL7Tracing {
@@ -365,12 +370,6 @@ type l7Event struct {
365370 PayloadSize uint64
366371}
367372
368- type pythonThreadEvent struct {
369- Type EventType
370- Pid uint32
371- Duration uint64
372- }
373-
374373func runEventsReader (name string , r * perf.Reader , ch chan <- Event , typ perfMapType , readTimeout time.Duration ) {
375374 if readTimeout == 0 {
376375 readTimeout = 100 * time .Millisecond
@@ -450,17 +449,6 @@ func runEventsReader(name string, r *perf.Reader, ch chan<- Event, typ perfMapTy
450449 BytesReceived : v .BytesReceived ,
451450 }
452451 }
453- case perfMapTypePythonThreadEvents :
454- v := & pythonThreadEvent {}
455- if err := binary .Read (bytes .NewBuffer (rec .RawSample ), binary .LittleEndian , v ); err != nil {
456- klog .Warningln ("failed to read msg:" , err )
457- continue
458- }
459- event = Event {
460- Type : v .Type ,
461- Pid : v .Pid ,
462- Duration : time .Duration (v .Duration ),
463- }
464452 default :
465453 continue
466454 }
0 commit comments