opensearch-project / OpenSearch

🔎 Open source distributed and RESTful search engine.
https://opensearch.org/docs/latest/opensearch/index/
Apache License 2.0
8.83k stars 1.62k forks source link

[Backport 2.14] [Tiered Caching] Adds stats implementation for TieredSpilloverCache #13521

Closed peteralfonsi closed 2 weeks ago

peteralfonsi commented 2 weeks ago

Original PR: https://github.com/opensearch-project/OpenSearch/pull/13236

2.x backport PR: https://github.com/opensearch-project/OpenSearch/pull/13520

Description

As part of tiered caching stats, integrates stats with TieredSpilloverCache. This TieredSpilloverCacheStatsHolder implementation is aware of the tier concept and will support aggregating the TSC's stats by tier as well as any other dimension values that are passed into it. It overrides some incrementing logic from DefaultCacheStatsHolder so it can properly combine heap and disk tier stats into stats for the cache as a whole.

TieredSpilloverCache tracks its own stats, rather than pulling stats from its tiers, because its getOrCompute() implementation can cause double-counting of a single hit or miss. To avoid redundancy, the individual tiers do not track their stats when they're part of TieredSpilloverCache.

Related Issues

Followup to https://github.com/opensearch-project/OpenSearch/pull/12531.

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.

peteralfonsi commented 2 weeks ago

@dblock @VachaShah @msfroh @andrross @reta Would any of you be able to approve this backport PR?

github-actions[bot] commented 2 weeks ago

:white_check_mark: Gradle check result for 2801cf501a9cd46ad2fee8f597c9d8ded6b10b95: SUCCESS

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 95.90643% with 7 lines in your changes are missing coverage. Please review.

:exclamation: No coverage uploaded for pull request base (2.14@d160ecb). Click here to learn what that means.

Files Patch % Lines
...search/cache/common/tier/TieredSpilloverCache.java 94.17% 3 Missing and 3 partials :warning:
...e/common/tier/TieredSpilloverCacheStatsHolder.java 97.95% 0 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## 2.14 #13521 +/- ## ======================================= Coverage ? 71.15% Complexity ? 61140 ======================================= Files ? 5027 Lines ? 287602 Branches ? 42027 ======================================= Hits ? 204640 Misses ? 65733 Partials ? 17229 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.