forked from elastic/logstash
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Flow metrics: provide lazy-initiazed implementation #3
Draft
yaauie
wants to merge
4
commits into
flow-metrics-extended
Choose a base branch
from
flow-metrics-lazy-init
base: flow-metrics-extended
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
…tation In preparation of landing an additional implementation of FlowMetric, we shuffle the current parts net-unchanged to provide interfaces for `FlowMetric` and `FlowCapture`, along with a sharable-common `BaseFlowMetric`, and move our initial implementation to a new `SimpleFlowMetric`, accessible only through a static factory method on our new `FlowMetric` interface.
The new ExtendedFlowMetric is an alternate implementation of the FlowMetric introduced in Logstash 8.5.0 that is capable of producing windoes for a set of policies, which dictate the desired retention for the rate along with a desired resolution. - `current`: 10s retention, 1s resolution [*] - `last_1_minute`: one minute retention, at 3s resolution [*] - `last_5_minutes`: five minutes retention, at 15s resolution - `last_15_minutes`: fifteen minutes retention, at 30s resolution - `last_1_hour`: one hour retention, at 60s resolution - `last_24_hours`: one day retention at 15 minute resolution A given series may report a range for slightly longer than its configured retention period, up to the either the series' configured resolution or our capture rate (currently ~5s), whichever is greater. This approach allows us to retain sufficient data-points to present meaningful rolling averages while ensuring that our memory footprint is bounded. When recording these captures, we first stage the newest capture, and then promote the previously-staged caputure to the tail of a linked list IFF the gap between our new capture and the newest promoted capture is larger than our desired resolution. When _reading_ these rates, we compact the head of that linked list forward in time as far as possible without crossing the desired retention barrier, at which point the head points to the youngest record that is old enough to satisfy the period for the series. We also occesionally compact the head during writes, but only if the head is significantly out-of-date relative to the allowed retention. As implemented here, this extended flow rates are on by default, but can be disabled by setting the JVM system property `-Dlogstash.flowMetric=simple`
mashhurs
approved these changes
Sep 29, 2022
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.
Agree with the logic. LGTM!
yaauie
force-pushed
the
flow-metrics-extended
branch
3 times, most recently
from
October 3, 2022 19:11
26ecd05
to
fa972c2
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
@mashhurs this is a
FlowMetric
imlementation that takes a pair ofSupplier<Metric>
s, and will instantiate and use an innerFlowMetric
once both suppliers return a non-null value.