ROX-28557: Collector should send complete networking delta when the config is updated #2068
+15
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently if external IPs is disabled and then it is switched to being enabled, the unnormalized connection will be reported open at the next scrape interval, but the normalized connection will only be reported closed after the afterglow period is expired. A similar problem occurs if external IPs is enabled and then is switched to being disabled. In the above example we would like the normalized connection to be reported closed at the same time that the unnormalized connection is reported open.
To accomplish this the afterglow period is set to be slightly less than the scrape interval when the state of the setting for external IPs is changed. This is done so that short lived connections that were opened and closed during the previous scrape interval will be reported as being open, and connections that went from being normalized to unnormalized from one scrape to the next will have the normalized version reported as being closed. Connections that were closed during previous scrape intervals, but are not passed their afterglow period will be reported as being closed. It may be a bit arbitrary that short lived connections within the previous scrape interval will not be reported closed, but connections that were closed during previous scrape intervals will be reported closed.
Alternatives that were considered included clearing the old state of the connections when the runtime config is changed. This would however, result in the normalized connection not being reported as closed as it is would not be in the old or new states. This would be okay if sensor knew that the messages sent constituted a state and not a delta.
Another alternative that was considered was turning off afterglow for scrapes in which the state of the external IPs feature had changed. This didn't work, because short lived connections would be reported as closed, which is not desired.
Checklist
Automated testing
If any of these don't apply, please comment below.
Testing Performed
TODO(replace-me)
Use this space to explain how you tested your PR, or, if you didn't test it, why you did not do so. (Valid reasons include "CI is sufficient" or "No testable changes")
In addition to reviewing your code, reviewers must also review your testing instructions, and make sure they are sufficient.
For more details, ref the Confluence page about this section.