-
Notifications
You must be signed in to change notification settings - Fork 7
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
[POA-2928] Changed the event watcher to watch pod changes not event changes #82
Conversation
mudit-postman
commented
Feb 18, 2025
•
edited
Loading
edited
- Change from event watcher to pod watcher in k8s
- Changes in k8s event worker, also added modified state handler
- Remove state change to traffic stopped from traffic ended and errored
- Change inspectPodForEnvVars func, it will now except podArgs object
- Change the state management of pod traffic monitoring, state diagram
- Changes in dump log formatting
…rt apidump process in next healthcheck run
…bs/postman-insights-agent into mudit/poa-2609-testing-changes
Before: ``` [INFO] Running learn mode on interfaces lo, wlan0 [INFO] Send SIGINT (Ctrl-C) to stop... ^C[INFO] Received interrupt, stopping trace collection... panic: close of closed channel ``` After: ``` [INFO] Running learn mode on interfaces lo, wlan0 [INFO] Send SIGINT (Ctrl-C) to stop... ^C[INFO] Received interrupt, stopping trace collection... [INFO] Trace collection stopped [INFO] Did not capture any TCP packets matching the filter. This may mean your filter is incorrect, such as the wrong TCP port. [ERROR] No HTTP calls captured! 🛑 [ERROR] Error during initiaization: API trace is empty [INFO] This process will not exit, to avoid boot loops. Please correct the command line flags or environment and retry. ```
…into mudit/event-watcher-changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK, let's clean up the use of a bool for the double-close fix.
It would be nicer to identify what the underlying cause is to make sure there's not some other logic change -- it should be unambiguous whose job it is to stop the background process.
// Empty podArgs object for PodPending state | ||
args := &PodArgs{ | ||
PodName: pod.Name, | ||
// though 1 buffer size is enough, keeping 2 for safety | ||
StopChan: make(chan error, 2), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This creation of a PodArgs in a particular state should be encapsulated in a function? It appears at least twice.
} | ||
printer.Debugf("Pod in pending state added to map, pod name: %s\n", pod.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The log message makes it sound like it has already occurred, but we could fail -- maybe move this below the error check, or adjust its wording?
|
||
// Whether this redactor is still running. False if and only if exitChannel is | ||
// closed. | ||
running *atomic.Bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, any use of an atomic.Bool is a code smell, particularly if you're trying to signal the state of some other object. Is there a higher-level construct that will do the job?
It looks like what you want is for StopPeriodicUpdates() to call close() exactly once. Maybe a sync.Once
is the appropriate thing then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why those changes were merged into this branch, then?
Fixes from other PRs should go into the main branch or a feature branch, then merged from there back into the development branch, so they don't have to be reviewed twice.
…hts-agent into mudit/event-watcher-changes