Commits
Tarun Sukhani authored 27665c8600d
feat: bind Hibernate + JCache (L2) metrics to Micrometer (PF-86 follow-up) Extends PF-86's cache observability beyond the framework's CaffeineImpl to cover the Hibernate side of the stack: * HibernateMetrics.monitor() — bound per SessionFactory at JPAPlugin startup, tagged with db=<dbName>. Emits hibernate.connections.obtained, hibernate.transactions, hibernate.flushes, hibernate.cache.requests (with result=hit|miss, region=<region> tags), and the dedicated hibernate.second.level.cache.* series. * JCacheMetrics.monitor() — iterates the default JSR-107 CacheManager and binds each cache, picking up Hibernate L2 regions when L2 is configured with hibernate.cache.region.factory_class= org.hibernate.cache.jcache.JCacheRegionFactory. Apps without L2 trigger CachingProvider not-found which is demoted to debug-level. * hibernate.generate_statistics defaulted to true (via putIfAbsent so app overrides win). HibernateMetrics produces zeros without it. The HibernateMetrics call goes through reflection deliberately: Micrometer 1.13.x..1.16.x ships the binder with overloads referencing both org.hibernate.SessionFactory and the legacy javax.persistence.EntityManagerFactory. Java's overload resolution loads every overload's parameter types up front, so a direct call fails to compile on this jakarta-only classpath. Reflection names the SessionFactory overload only and dodges the issue without polluting the dependency graph with javax.persistence-api just to satisfy javac. Cache surface audit summary: framework caches now bound — Caffeine (PF-86), Hibernate aggregate (this commit), Hibernate L2 / JCache (this commit), HikariCP pool (PF-85). MemcachedImpl is uncovered because spymemcached has no Micrometer binder upstream; that's an alternative cache backend used by a minority of deployments. Internal LRU caches (BytecodeCache, classDefsInFileCache, staticPathsCache) are intentionally skipped — low-value internal state, not user-facing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>