Skip to content

Commit

Permalink
Log errors in the manager
Browse files Browse the repository at this point in the history
  • Loading branch information
AlonZivony committed May 30, 2024
1 parent 7489967 commit 8b8a87b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
10 changes: 8 additions & 2 deletions pkg/ebpf/tracee.go
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,10 @@ func (t *Tracee) validateKallsymsDependencies() {
for eventId := range t.eventsState {
if !validateEvent(eventId) {
// Cancel the event, it dependencies and its dependent events
t.eventsDependencies.RemoveEvent(eventId)
err := t.eventsDependencies.RemoveEvent(eventId)
if err != nil {
logger.Warnw("Failed to remove event from dependencies manager", "remove reason", "missing ksymbols", "error", err)
}
}
}
}
Expand Down Expand Up @@ -1181,7 +1184,10 @@ func (t *Tracee) attachProbes() error {
for eventID := range t.eventsState {
err := t.attachEvent(eventID)
if err != nil {
t.eventsDependencies.RemoveEvent(eventID)
err := t.eventsDependencies.RemoveEvent(eventID)
if err != nil {
logger.Warnw("Failed to remove event from dependencies manager", "remove reason", "failed probes attachment", "error", err)
}
}
}
// TODO: Update the eBPF maps according to events state after failure of attachments
Expand Down
9 changes: 7 additions & 2 deletions pkg/events/dependencies/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,10 @@ func (m *Manager) buildEventNode(eventNode *EventNode) (*EventNode, error) {
if probe.IsRequired() {
return nil, err
}
eventName := events.Core.GetDefinitionByID(eventNode.GetID()).GetName()
logger.Debugw(
"Non-required probe dependency adding failed for event",
"event", eventNode.GetID(),
"event", eventName,
"probe", probe.GetHandle(), "error", err,
)
continue
Expand Down Expand Up @@ -340,7 +341,11 @@ func (m *Manager) removeEventNodeFromDependencies(eventNode *EventNode) {
// removeEventDependents removes all dependent events from the tree
func (m *Manager) removeEventDependents(eventNode *EventNode) {
for _, dependentEvent := range eventNode.GetDependents() {
m.RemoveEvent(dependentEvent)
err := m.RemoveEvent(dependentEvent)
if err != nil {
eventName := events.Core.GetDefinitionByID(dependentEvent).GetName()
logger.Debugw("failed to remove dependent event", "event", eventName, "error", err)
}
}
}

Expand Down

0 comments on commit 8b8a87b

Please sign in to comment.