Skip to content

Commit e4492f4

Browse files
committed
fix(grpc): correct event field mappings in protobuf conversion
Fix two bugs in trace.Event to protobuf conversion: 1. Thread.Compat now correctly maps to IsCompat (compat syscall mode) - Was incorrectly using ContainerStarted - Compat refers to 32-bit syscalls on 64-bit systems 2. Container.IsRunning now populated from ContainerStarted flag - Field was previously never set
1 parent fc8d2af commit e4492f4

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pkg/server/grpc/tracee.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ func getProcess(e trace.Event) *pb.Process {
815815
HostTid: wrapperspb.UInt32(uint32(e.HostThreadID)),
816816
Tid: wrapperspb.UInt32(uint32(e.ThreadID)),
817817
Syscall: sanitizeStringForProtobuf(e.Syscall),
818-
Compat: e.ContextFlags.ContainerStarted,
818+
Compat: e.ContextFlags.IsCompat,
819819
UserStackTrace: userStackTrace,
820820
},
821821
Ancestors: ancestors,
@@ -840,8 +840,9 @@ func getContainer(e trace.Event) *pb.Container {
840840
}
841841

842842
container := &pb.Container{
843-
Id: sanitizeStringForProtobuf(e.Container.ID),
844-
Name: sanitizeStringForProtobuf(e.Container.Name),
843+
Id: sanitizeStringForProtobuf(e.Container.ID),
844+
Name: sanitizeStringForProtobuf(e.Container.Name),
845+
IsRunning: e.ContextFlags.ContainerStarted,
845846
}
846847

847848
if e.Container.ImageName != "" {

pkg/server/grpc/tracee_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func Test_convertEventWithProcessWorkload(t *testing.T) {
3131
EventName: "eventTest",
3232
MatchedPolicies: []string{"policyTest"},
3333
Syscall: "syscall",
34-
ContextFlags: trace.ContextFlags{ContainerStarted: true},
34+
ContextFlags: trace.ContextFlags{ContainerStarted: true, IsCompat: true},
3535
ThreadEntityId: 9,
3636
ProcessEntityId: 10,
3737
ParentEntityId: 11,

0 commit comments

Comments
 (0)