add upserts to micrometer metrics

This commit is contained in:
Gavin King 2024-12-15 17:43:13 +01:00
parent d3ce8d45ea
commit fd1a957c13
3 changed files with 7 additions and 0 deletions

View File

@ -207,6 +207,11 @@ public class HibernateMetrics implements MeterBinder {
"The number of entity updates", "The number of entity updates",
Statistics::getEntityUpdateCount Statistics::getEntityUpdateCount
); );
counter(registry,
"hibernate.entities.upserts",
"The number of entity upserts",
Statistics::getEntityUpsertCount
);
// Collections // Collections
counter(registry, counter(registry,

View File

@ -111,6 +111,7 @@ public class MicrometerCacheStatisticsTest extends BaseNonConfigCoreFunctionalTe
Assert.assertNotNull(registry.get("hibernate.entities.inserts").functionCounter()); Assert.assertNotNull(registry.get("hibernate.entities.inserts").functionCounter());
Assert.assertNotNull(registry.get("hibernate.entities.loads").functionCounter()); Assert.assertNotNull(registry.get("hibernate.entities.loads").functionCounter());
Assert.assertNotNull(registry.get("hibernate.entities.updates").functionCounter()); Assert.assertNotNull(registry.get("hibernate.entities.updates").functionCounter());
Assert.assertNotNull(registry.get("hibernate.entities.upserts").functionCounter());
Assert.assertNotNull(registry.get("hibernate.collections.deletes").functionCounter()); Assert.assertNotNull(registry.get("hibernate.collections.deletes").functionCounter());
Assert.assertNotNull(registry.get("hibernate.collections.fetches").functionCounter()); Assert.assertNotNull(registry.get("hibernate.collections.fetches").functionCounter());

View File

@ -82,6 +82,7 @@ public class MicrometerStatisticsTest extends BaseCoreFunctionalTestCase {
Assert.assertNotNull(registry.get("hibernate.entities.inserts").functionCounter()); Assert.assertNotNull(registry.get("hibernate.entities.inserts").functionCounter());
Assert.assertNotNull(registry.get("hibernate.entities.loads").functionCounter()); Assert.assertNotNull(registry.get("hibernate.entities.loads").functionCounter());
Assert.assertNotNull(registry.get("hibernate.entities.updates").functionCounter()); Assert.assertNotNull(registry.get("hibernate.entities.updates").functionCounter());
Assert.assertNotNull(registry.get("hibernate.entities.upserts").functionCounter());
Assert.assertNotNull(registry.get("hibernate.collections.deletes").functionCounter()); Assert.assertNotNull(registry.get("hibernate.collections.deletes").functionCounter());
Assert.assertNotNull(registry.get("hibernate.collections.fetches").functionCounter()); Assert.assertNotNull(registry.get("hibernate.collections.fetches").functionCounter());