Add cache metrics support for LocalResponseCache#4086
Open
LivingLikeKrillin wants to merge 7 commits intospring-cloud:mainfrom
Open
Add cache metrics support for LocalResponseCache#4086LivingLikeKrillin wants to merge 7 commits intospring-cloud:mainfrom
LivingLikeKrillin wants to merge 7 commits intospring-cloud:mainfrom
Conversation
See spring-cloudgh-3722 Signed-off-by: LivingLikeKrillin <143606756+LivingLikeKrillin@users.noreply.github.com>
…actory See spring-cloudgh-3722 Signed-off-by: LivingLikeKrillin <143606756+LivingLikeKrillin@users.noreply.github.com>
Fixes spring-cloudgh-3722 Signed-off-by: LivingLikeKrillin <143606756+LivingLikeKrillin@users.noreply.github.com>
d2db7c3 to
2edc354
Compare
Author
|
The two test failures (GatewayAutoConfigurationTests and FormIntegrationTests) are pre-existing on main and unrelated to this change. |
- Add WARN log when global cache is not CaffeineCache (only when a real metrics listener is present) - Add explanatory comment for always-on recordStats() decision - Remove unused constructor overload in LocalResponseCacheGatewayFilterFactory - Add FQN disambiguation comment in CacheMetricsListener - Align bean method visibility with existing conventions Signed-off-by: LivingLikeKrillin <143606756+LivingLikeKrillin@users.noreply.github.com>
Verify that CaffeineCacheMetrics are registered for the global response-cache when both MeterRegistry and global filter are enabled. Signed-off-by: LivingLikeKrillin <143606756+LivingLikeKrillin@users.noreply.github.com>
- Reorder class-level annotations to match GatewayMetricsAutoConfiguration - Add DispatcherHandler to @ConditionalOnClass for WebFlux environment guard - Move @ConditionalOnBean and metrics property check to bean method level - Make test class public to match existing test conventions - Add test for gateway disabled scenario - Add per-route cache metrics integration test See spring-cloudgh-3722 Signed-off-by: LivingLikeKrillin <143606756+LivingLikeKrillin@users.noreply.github.com>
d53454c to
de87050
Compare
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
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.
Summary
recordStats()so cache statistics are collected at runtimeCacheMetricsListenercallback inLocalResponseCacheGatewayFilterFactoryto notify external components when caches are createdLocalResponseCacheMetricsAutoConfigurationthat binds Caffeine caches toMeterRegistryviaCaffeineCacheMetrics, exposing standard cache metrics (cache.gets,cache.puts,cache.evictions,cache.size) through ActuatorFixes gh-3722
Test plan
CacheMetricsListenerbean is created whenMeterRegistryis presentMeterRegistryis absentgateway.metrics.enabled=falserecordStats()collects hit/miss countsMeterRegistryvia listener callback