Skip to content

Commit

Permalink
tetra: Add support to display throttle events
Browse files Browse the repository at this point in the history
Adding support to display throttle events in getevents like:

  💥 exit    ubuntu-22 /usr/bin/sleep 0.1s 0
  🚀 process ubuntu-22 /usr/bin/sleep 0.1s
  🧬 throttle START session-130.scope-10741
  🧬 throttle STOP  session-130.scope-10741
  🚀 process ubuntu-22 /usr/bin/git diff
  🚀 process ubuntu-22 /usr/bin/pager

Signed-off-by: Jiri Olsa <[email protected]>
  • Loading branch information
olsajiri committed Apr 13, 2024
1 parent 6039fc9 commit 696f49d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/encoder/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,17 @@ func (p *CompactEncoder) EventToString(response *tetragon.GetEventsResponse) (st
status = p.Colorer.Red.Sprint(exit.Status)
}
return CapTrailorPrinter(fmt.Sprintf("%s %s %s %s", event, processInfo, args, status), caps), nil
case *tetragon.GetEventsResponse_ProcessThrottle:
throttle := response.GetProcessThrottle()
event := p.Colorer.Red.Sprintf("🧬 %-7s", "throttle")
var typ string
switch throttle.Type {
case tetragon.ThrottleType_THROTTLE_START:
typ = p.Colorer.Red.Sprint("START")
case tetragon.ThrottleType_THROTTLE_STOP:
typ = p.Colorer.Green.Sprint("STOP ")
}
return fmt.Sprintf("%s %s %s", event, typ, throttle.Cgroup), nil
case *tetragon.GetEventsResponse_ProcessLoader:
loader := response.GetProcessLoader()
if loader.Process == nil {
Expand Down

0 comments on commit 696f49d

Please sign in to comment.