Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics: report metric errors when caching pids #1502

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/grpc/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ func GetProcessExit(event *MsgExitEventUnix) *tetragon.ProcessExit {
"event.process.tid": event.Info.Tid,
"event.process.binary": tetragonProcess.Binary,
}).Warn("ExitEvent: process PID and TID mismatch")
errormetrics.ErrorTotalInc(errormetrics.ProcessPidTidMismatch)
}

tetragonEvent := &tetragon.ProcessExit{
Expand Down
2 changes: 2 additions & 0 deletions pkg/metrics/errormetrics/errormetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ var (
ProcessCacheEvicted ErrorType = "process_cache_evicted"
// Process not found on remove() call.
ProcessCacheMissOnRemove ErrorType = "process_cache_miss_on_remove"
// Tid and Pid mismatch that could affect BPF and user space caching logic
ProcessPidTidMismatch ErrorType = "process_pid_tid_mismatch"
// Event cache podInfo retries failed.
EventCachePodInfoRetryFailed ErrorType = "event_cache_podinfo_retry_failed"
// Event cache failed to set process information for an event.
Expand Down
3 changes: 3 additions & 0 deletions pkg/process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"sync"
"sync/atomic"

"github.com/cilium/tetragon/pkg/metrics/errormetrics"
hubble "github.com/cilium/tetragon/pkg/oldhubble/cilium"
"github.com/sirupsen/logrus"

Expand Down Expand Up @@ -220,6 +221,7 @@ func initProcessInternalExec(
}).Warn("ExecveEvent: process PID and TID mismatch")
// Explicitly reset TID to be PID
process.TID = process.PID
errormetrics.ErrorTotalInc(errormetrics.ProcessPidTidMismatch)
}
return &ProcessInternal{
process: &tetragon.Process{
Expand Down Expand Up @@ -273,6 +275,7 @@ func initProcessInternalClone(event *tetragonAPI.MsgCloneEvent,
"event.process.exec_id": pi.process.ExecId,
"event.parent.exec_id": parentExecId,
}).Debug("CloneEvent: process PID and TID mismatch")
errormetrics.ErrorTotalInc(errormetrics.ProcessPidTidMismatch)
}
// Set the TID here and if we have an exit without an exec we report
// directly this TID without copying again objects.
Expand Down