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

Replace missing process info metric #2863

Merged
merged 2 commits into from
Sep 2, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions contrib/upgrade-notes/latest.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ tetragon:
`tetragon_event_cache_fetch_failures_total{entry_type="<entry_type>"}`.
* `tetragon_event_cache_accesses_total` metric is renamed to `tetragon_event_cache_inserts_total`.
* `tetragon_event_cache_retries_total` metric is renamed to `tetragon_event_cache_fetch_retries_total`.
* `tetragon_errors_total{type="event_missing_process_info"}` metric is replaced by
`tetragon_events_missing_process_info_total`.
6 changes: 5 additions & 1 deletion docs/content/en/docs/reference/metrics.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions pkg/metrics/errormetrics/errormetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ type ErrorType int
const (
// Tid and Pid mismatch that could affect BPF and user space caching logic
ProcessPidTidMismatch ErrorType = iota
// An event is missing process info.
EventMissingProcessInfo
// An error occurred in an event handler.
HandlerError
// An event finalizer on Process failed
Expand All @@ -32,7 +30,6 @@ const (

var errorTypeLabelValues = map[ErrorType]string{
ProcessPidTidMismatch: "process_pid_tid_mismatch",
EventMissingProcessInfo: "event_missing_process_info",
HandlerError: "handler_error",
EventFinalizeProcessInfoFailed: "event_finalize_process_info_failed",
ProcessMetadataUsernameFailed: "process_metadata_username_failed",
Expand Down
18 changes: 13 additions & 5 deletions pkg/metrics/eventmetrics/eventmetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/cilium/tetragon/pkg/logger"
"github.com/cilium/tetragon/pkg/metrics"
"github.com/cilium/tetragon/pkg/metrics/consts"
"github.com/cilium/tetragon/pkg/metrics/errormetrics"
"github.com/cilium/tetragon/pkg/metrics/syscallmetrics"
"github.com/cilium/tetragon/pkg/option"
"github.com/cilium/tetragon/pkg/reader/exec"
Expand Down Expand Up @@ -68,12 +67,21 @@ var (
Help: "Policy events calls observed.",
ConstLabels: nil,
}, []string{"policy", "hook"})

missingProcessInfo = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: consts.MetricsNamespace,
Name: "events_missing_process_info_total",
Help: "Number of events missing process info.",
})
)

func RegisterHealthMetrics(group metrics.Group) {
group.MustRegister(FlagCount)
group.MustRegister(NotifyOverflowedEvents)
group.MustRegister(NewBPFCollector())
group.MustRegister(
FlagCount,
NotifyOverflowedEvents,
NewBPFCollector(),
missingProcessInfo,
)
}

func InitHealthMetrics() {
Expand Down Expand Up @@ -110,7 +118,7 @@ func GetProcessInfo(process *tetragon.Process) (binary, pod, workload, namespace
pod = process.Pod.Name
}
} else {
errormetrics.ErrorTotalInc(errormetrics.EventMissingProcessInfo)
missingProcessInfo.Inc()
}
return binary, pod, workload, namespace
}
Expand Down
Loading