-
Notifications
You must be signed in to change notification settings - Fork 174
ROX-30390: Add TransitionBased update computer #16522
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
5d8def6
Add categorized update computer
vikin91 52059aa
AI-review: add test case
vikin91 dcd62a9
Run periodic cleanup synchronously to avoid unbounded concurrent clea…
vikin91 3fee1ab
Add periodicCleanup duration metric as it is now called synchronously
vikin91 c9dfd0a
Rename Categorized to Transition-Based
vikin91 b90fd64
Use seconds and prom.Timer for metric periodicCleanupDurationSeconds
vikin91 7b538e4
Fix issue of gauge metric behaving like counter
vikin91 6251fc9
Reset the gauge metric instead of zeroing it
vikin91 57aa535
Use or remove unused consts
vikin91 9187a9b
Make TransitionType and deduperAction an iota int
vikin91 2daf461
Ensure that returning cachedUpdates has a comment
vikin91 6f79806
Allow selecting deduper hashing algorithm through env
vikin91 0fc581b
Extract common code to computeUpdatedEntitiesNoPast
vikin91 526b33f
Call UpdateEventsGauge.Reset() only once
vikin91 c435711
Avoid excesive copying in computeUpdatedEntitiesNoPast
vikin91 15ce78d
Fix accidentally discovered race
vikin91 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| package updatecomputer | ||
|
|
||
| import ( | ||
| "github.com/prometheus/client_golang/prometheus" | ||
| "github.com/stackrox/rox/pkg/metrics" | ||
| ) | ||
|
|
||
| func init() { | ||
| prometheus.MustRegister( | ||
| UpdateEvents, | ||
| UpdateEventsGauge, | ||
| periodicCleanupDurationSeconds, | ||
| ) | ||
| } | ||
|
|
||
| var ( | ||
| UpdateEvents = prometheus.NewCounterVec(prometheus.CounterOpts{ | ||
| Namespace: metrics.PrometheusNamespace, | ||
| Subsystem: metrics.SensorSubsystem.String(), | ||
| Name: "update_computer_update_events_total", | ||
| Help: "Counts the internal update events for the categorizeUpdate method in TransitionBased updateComputer. " + | ||
| "The 'transition' allows counting the transitions of connections between states 'open' and 'closed'." + | ||
| "Action stores the decision whether a given update was sent to Central.", | ||
| }, []string{"transition", "entity", "action", "reason"}) | ||
| UpdateEventsGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{ | ||
| Namespace: metrics.PrometheusNamespace, | ||
| Subsystem: metrics.SensorSubsystem.String(), | ||
| Name: "update_computer_update_events_current", | ||
| Help: "Counts the internal update events for the categorizeUpdate method in TransitionBased updateComputer in a single tick. " + | ||
| "The 'transition' allows counting the transitions of connections between states 'open' and 'closed'. in a given tick." + | ||
| "Action stores the decision whether a given update was sent to Central.", | ||
| }, []string{"transition", "entity", "action", "reason"}) | ||
| periodicCleanupDurationSeconds = prometheus.NewHistogram(prometheus.HistogramOpts{ | ||
| Namespace: metrics.PrometheusNamespace, | ||
| Subsystem: metrics.SensorSubsystem.String(), | ||
| Name: "update_computer_periodic_cleanup_duration_seconds", | ||
| Help: "Time in seconds taken to perform a single periodic cleanup on the transition-based update computer.", | ||
| Buckets: []float64{0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5}, | ||
| }) | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.