Skip to content

Commit

Permalink
api/ops: Make OpCode.String() more informative for unknown opcodes
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Kapuscinska <[email protected]>
  • Loading branch information
lambdanis committed Feb 29, 2024
1 parent 5302f27 commit f70a3ee
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/api/ops/ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

package ops

import (
"fmt"

"github.com/cilium/tetragon/pkg/logger"
)

const (
MSG_OP_UNDEF = 0
// MSG_OP_EXECVE event indicates a process was created. The 'PID'
Expand Down Expand Up @@ -91,7 +97,8 @@ var OpCodeStrings = map[OpCode]string{
func (op OpCode) String() string {
s, ok := OpCodeStrings[op]
if !ok {
return ""
logger.GetLogger().WithField("op", op).Info("Unknown OpCode. This is a bug, please report it to Tetragon developers.")
return fmt.Sprintf("Unknown(%d)", op)
}
return s
}
Expand Down

0 comments on commit f70a3ee

Please sign in to comment.