diff --git a/docs/content/en/docs/reference/metrics.md b/docs/content/en/docs/reference/metrics.md index ff0ee4cc92c..92b64c9dcb9 100644 --- a/docs/content/en/docs/reference/metrics.md +++ b/docs/content/en/docs/reference/metrics.md @@ -42,7 +42,7 @@ The total number of Tetragon errors. For internal use only. | label | values | | ----- | ------ | -| `type ` | `event_finalize_process_info_failed, event_missing_process_info, handler_error, process_cache_evicted, process_cache_miss_on_get, process_cache_miss_on_remove, process_pid_tid_mismatch` | +| `type ` | `event_finalize_process_info_failed, event_missing_process_info, handler_error, process_cache_evicted, process_cache_miss_on_get, process_cache_miss_on_remove, process_metadata_username_failed, process_pid_tid_mismatch` | ### `tetragon_event_cache_accesses_total` diff --git a/pkg/metrics/errormetrics/errormetrics.go b/pkg/metrics/errormetrics/errormetrics.go index 008dd5fa03c..fc8ee911ffd 100644 --- a/pkg/metrics/errormetrics/errormetrics.go +++ b/pkg/metrics/errormetrics/errormetrics.go @@ -28,6 +28,8 @@ const ( HandlerError // An event finalizer on Process failed EventFinalizeProcessInfoFailed + // Failed to resolve Process uid to username + ProcessMetadataUsernameFailed ) var errorTypeLabelValues = map[ErrorType]string{ @@ -38,6 +40,7 @@ var errorTypeLabelValues = map[ErrorType]string{ EventMissingProcessInfo: "event_missing_process_info", HandlerError: "handler_error", EventFinalizeProcessInfoFailed: "event_finalize_process_info_failed", + ProcessMetadataUsernameFailed: "process_metadata_username_failed", } func (e ErrorType) String() string { diff --git a/pkg/sensors/exec/userinfo/userinfo.go b/pkg/sensors/exec/userinfo/userinfo.go index 5a9c0c8bc11..e8680f323c9 100644 --- a/pkg/sensors/exec/userinfo/userinfo.go +++ b/pkg/sensors/exec/userinfo/userinfo.go @@ -8,6 +8,7 @@ import ( "github.com/cilium/tetragon/pkg/api/processapi" "github.com/cilium/tetragon/pkg/grpc/exec" + "github.com/cilium/tetragon/pkg/metrics/errormetrics" "github.com/cilium/tetragon/pkg/option" "github.com/cilium/tetragon/pkg/reader/namespace" "github.com/cilium/tetragon/pkg/reader/userdb" @@ -37,6 +38,7 @@ func MsgToExecveAccountUnix(m *exec.MsgExecveEventUnix) error { if option.Config.UsernameMetadata == int(option.USERNAME_METADATA_UNIX) { username, err := getAccountUnix(m.Unix.Process.UID, &m.Unix.Msg.Namespaces) if err != nil { + errormetrics.ErrorTotalInc(errormetrics.ProcessMetadataUsernameFailed) return err }