-
Notifications
You must be signed in to change notification settings - Fork 67
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
Fix failing file handler test #38
Conversation
src/main/java/org/opensearch/performanceanalyzer/PerformanceAnalyzerPlugin.java
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## main #38 +/- ##
============================================
+ Coverage 72.09% 72.25% +0.15%
- Complexity 346 356 +10
============================================
Files 44 44
Lines 2473 2505 +32
Branches 155 160 +5
============================================
+ Hits 1783 1810 +27
- Misses 585 590 +5
Partials 105 105
Continue to review full report at Codecov.
|
Signed-off-by: Sruti Parthiban <partsrut@amazon.com>
0be71fc
to
04236b3
Compare
Is there an issue we can link to in the PR description? |
timeMillis % MetricsConfiguration.SAMPLING_INTERVAL | ||
== 0) |
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.
It seems a little inefficient to test every number. What if we did something like this?
List<String> filesForCleanup = new ArrayList<>();
// ugly expression to handle the case when lastCleanupTimeBucket is divisible by SAMPLING_INTERVAL
// If I did this correctly, then k should satisfy the following:
// (k - 1) * SAMPLING_INTERVAL < lastCleanupTimeBucket <= k * SAMPLING_INTERVAL
long k = lastCleanupTimeBucket / SAMPLING_INTERVAL +
lastCleanupTimebucket % SAMPLING_INTERVAL == 0 ? 0L : 1L;
for (int tick = k * SAMPLING_INTERVAL; tick < currCleanupTimeBucket; tick += SAMPLING_INTERVAL) {
filesForCleanup.add(String::valueOf(tick));
}
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.
LGTM.
Recommendation would have been to just fetch the list of "obsolete" files from the FS, but with a 1sec iteration, this might be an overhead. Probably the better approach is to test on the FS every 5 mins. But this isn't a blocker.
Signed-off-by: Sruti Parthiban <partsrut@amazon.com>
* Create writer file if metrics are available (#31) Signed-off-by: Sruti Parthiban <partsrut@amazon.com> * Add tests to check for writer file only if metrics are present (#35) Signed-off-by: Sruti Parthiban <partsrut@amazon.com> * Merge pull request #36 from opensearch-project/khushbr-writer-purge-fix Fixing Event Log file cleanup issue * Moving deleteAllFiles() to inside scheduleExecutor() * Fixing the Link Checker errors, updating the official documentation * nit: Fixing spotlessJava indentation issue * Merge pull request #37 from khushbr/feature/purge-fix Handling purging of lingering files before scheduleExecutor start. * Fix failing file handler test (#38) Signed-off-by: Sruti Parthiban <partsrut@amazon.com> * Remove dependency on main branch when running spotless. (#47) Signed-off-by: Marc Handalian <handalm@amazon.com> * Updates to gradle build file (#48) * Updates to gradle build file Signed-off-by: Sruti Parthiban <partsrut@amazon.com> * Add ability to specify RCA branch Signed-off-by: Sruti Parthiban <partsrut@amazon.com> * Fix build when opensearch_version flag is provided. (#52) Signed-off-by: Marc Handalian <handalm@amazon.com> * Update the version to 1.0.1 Signed-off-by: Sruti Parthiban <partsrut@amazon.com> Co-authored-by: Khushboo Rajput <59671881+khushbr@users.noreply.github.com> Co-authored-by: Khushboo Rajput <khushbr@amazon.com> Co-authored-by: Marc Handalian <handalm@amazon.com>
Signed-off-by: Sruti Parthiban partsrut@amazon.com
Is your feature request related to a problem? Please provide an existing Issue # , or describe.
#39
Fix failing event file handler test. Formatting changes was brought in by spotless.
Describe the solution you are proposing
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.