Skip to content

Commit b2968db

Browse files
extract stmtId for exec stmt events
1 parent 01775ff commit b2968db

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

aggregator/data.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1402,7 +1402,9 @@ func (a *Aggregator) parseMySQLCommand(d *l7_req.L7Event) (string, error) {
14021402
a.mySqlStmtsMu.Unlock()
14031403
} else if d.Method == l7_req.MYSQL_EXEC_STMT {
14041404
a.mySqlStmtsMu.RLock()
1405-
query, ok := a.mySqlStmts[fmt.Sprintf("%d-%d-%d", d.Pid, d.Fd, d.MySqlPrepStmtId)]
1405+
// extract statementId from payload
1406+
stmtId := binary.LittleEndian.Uint32(r)
1407+
query, ok := a.mySqlStmts[fmt.Sprintf("%d-%d-%d", d.Pid, d.Fd, stmtId)]
14061408
a.mySqlStmtsMu.RUnlock()
14071409
if !ok || query == "" { // we don't have the query for the prepared statement
14081410
// Execute (name of prepared statement) [(parameter)]

ebpf/l7_req/l7.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -748,16 +748,6 @@ func (l7p *L7Prog) Consume(ctx context.Context, ch chan interface{}) {
748748
Dport: l7Event.Dport,
749749
}
750750

751-
if protocol == L7_PROTOCOL_MYSQL {
752-
log.Logger.Debug().
753-
Str("payload", string(userspacel7Event.Payload[:userspacel7Event.PayloadSize])).
754-
Uint32("pid", userspacel7Event.Pid).
755-
Str("method", userspacel7Event.Method).
756-
Uint32("stmtId", userspacel7Event.MySqlPrepStmtId).
757-
Uint64("fd", userspacel7Event.Fd).
758-
Msg("mysql-event")
759-
}
760-
761751
go func(l7Event *L7Event) {
762752
select {
763753
case ch <- l7Event:

0 commit comments

Comments
 (0)