このコンテンツは選択した言語では利用できません。
3.6. Hibernate - Statistics Service
Overview
Description: | Statistics for Hibernate |
Singleton: | no |
Plugin: | Hibernate |
Note
In order to monitor Hibernate statistics via JON, the Hibernate Session Manager MBean must be deployed to an object name of the format {{_"Hibernate:application=%application%,type=statistics"_}}, and statistics must be enabled. Some example code is provided below to register the Hibernate Session MBean within an EJB3 application. {code} public static void enableHibernateStatistics(EntityManager entityManager) { try { StatisticsService mBean = new StatisticsService(); SessionFactory sessionFactory = getHibernateSession(entityManager).getSessionFactory(); mBean.setSessionFactory(sessionFactory); ObjectName objectName = new ObjectName(HIBERNATE_STATISTICS_MBEAN_OBJECTNAME); MBeanServer jbossMBeanServer = getJBossMBeanServer(); jbossMBeanServer.registerMBean(mBean, objectName); sessionFactory.getStatistics().setStatisticsEnabled(true); } catch (InstanceAlreadyExistsException iaee) { LOG.info("Duplicate MBean registration ignored: " + HIBERNATE_STATISTICS_MBEAN_OBJECTNAME); } catch (Exception e) { LOG.warn("Couldn't register Hibernate statistics MBean.", e); } } private static Session getHibernateSession(EntityManager entityManager) { Session session; if (entityManager.getDelegate() instanceof EntityManagerImpl) { EntityManagerImpl entityManagerImpl = (EntityManagerImpl) entityManager.getDelegate(); session = entityManagerImpl.getSession(); } else { session = (Session) entityManager.getDelegate(); } return session; } private static MBeanServer getJBossMBeanServer() { List<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null); MBeanServer jbossServer = null; for (MBeanServer server : servers) { if ("jboss".equals(server.getDefaultDomain())) { jbossServer = server; } } if (jbossServer == null) { jbossServer = ManagementFactory.getPlatformMBeanServer(); } return jbossServer; } {code} See also [Publishing statistics through JMX|http://hibernate.org/216.html] and [Enabling Hibernate statistics|http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.3/doc/hibernate/Hibernate_Reference_Guide/Optional_configuration_properties-Hibernate_statistics.html]
Child Resource Types
Connection Properties
Name | Description | Required | Internal Name |
---|---|---|---|
Object Name | yes | objectName | |
Name Template | yes | nameTemplate | |
Description Template | yes | descriptionTemplate | |
Application | the Hibernate application name | yes | application |
Note
You must use the internal name to reference Configuration Properties in Dynamic Group Definition expressions.
Metrics
Name | Type | Description | Internal Name |
---|---|---|---|
Entity Insert Count | measurement | The global number of entity inserts since the statistics were reset | EntityInsertCount |
Entity Insert Count per Minute | measurement | The global number of entity inserts since the statistics were reset | EntityInsertCount |
Query Execution Max Time | measurement | The amount of time taken by the slowest recorded query since the statistics were reset | QueryExecutionMaxTime |
Entity Update Count | measurement | The global number of entity updates since the statistics were reset | EntityUpdateCount |
Entity Update Count per Minute | measurement | The global number of entity updates since the statistics were reset | EntityUpdateCount |
Collection Update Count | measurement | The global number of collections updated since the statistics were reset | CollectionUpdateCount |
Collection Update Count per Minute | measurement | The global number of collections updated since the statistics were reset | CollectionUpdateCount |
Entity Load Count | measurement | The global number of entity loads since the statistics were reset | EntityLoadCount |
Entity Load Count per Minute | measurement | The global number of entity loads since the statistics were reset | EntityLoadCount |
Entity Fetch Count | measurement | The global number of entity fetches since the statistics were reset | EntityFetchCount |
Entity Fetch Count per Minute | measurement | The global number of entity fetches since the statistics were reset | EntityFetchCount |
Entity Delete Count | measurement | The global number of entity deletes since the statistics were reset | EntityDeleteCount |
Entity Delete Count per Minute | measurement | The global number of entity deletes since the statistics were reset | EntityDeleteCount |
Collection Recreate Count | measurement | The global number of collections recreated since the statistics were reset | CollectionRecreateCount |
Collection Recreate Count per Minute | measurement | The global number of collections recreated since the statistics were reset | CollectionRecreateCount |
Query Execution Count | measurement | The global number of queries executed since the statistics were reset | QueryExecutionCount |
Query Execution Count per Minute | measurement | The global number of queries executed since the statistics were reset | QueryExecutionCount |
Flush Count | measurement | The global number of flushes executed by sessions (either implicit or explicit) since the statistics were reset | FlushCount |
Flush Count per Minute | measurement | The global number of flushes executed by sessions (either implicit or explicit) since the statistics were reset | FlushCount |
Collection Load Count | measurement | The global number of collections loaded since the statistics were reset | CollectionLoadCount |
Collection Load Count per Minute | measurement | The global number of collections loaded since the statistics were reset | CollectionLoadCount |
Successful Transaction Count | measurement | The global number of transactions known to have been successful since the statistics were reset | SuccessfulTransactionCount |
Successful Transaction Count per Minute | measurement | The global number of transactions known to have been successful since the statistics were reset | SuccessfulTransactionCount |
Query Cache Hit Count | measurement | The global number of cached queries successfully retrieved from cache since the statistics were reset | QueryCacheHitCount |
Query Cache Hit Count per Minute | measurement | The global number of cached queries successfully retrieved from cache since the statistics were reset | QueryCacheHitCount |
Collection Remove Count | measurement | The global number of collections removed since the statistics were reset | CollectionRemoveCount |
Collection Remove Count per Minute | measurement | The global number of collections removed since the statistics were reset | CollectionRemoveCount |
Connect Count | measurement | The global number of connections asked by the sessions (the actual number of connections used may be much smaller depending whether you use a connection pool or not) since the statistics were reset | ConnectCount |
Connect Count per Minute | measurement | The global number of connections asked by the sessions (the actual number of connections used may be much smaller depending whether you use a connection pool or not) since the statistics were reset | ConnectCount |
Start Time | trait | The time when the statistics collection started or were last reset | StartTime |
Second Level Cache Put Count | measurement | The global number of cacheable entities/collections put in the cache since the statistics were reset | SecondLevelCachePutCount |
Second Level Cache Put Count per Minute | measurement | The global number of cacheable entities/collections put in the cache since the statistics were reset | SecondLevelCachePutCount |
Query Cache Put Count | measurement | The global number of cacheable queries put in cache since the statistics were reset | QueryCachePutCount |
Query Cache Put Count per Minute | measurement | The global number of cacheable queries put in cache since the statistics were reset | QueryCachePutCount |
Session Open Count | measurement | The global number of sessions closed since the statistics were reset | SessionOpenCount |
Session Open Count per Minute | measurement | The global number of sessions closed since the statistics were reset | SessionOpenCount |
Transaction Count | measurement | The global number of transactions known to have completed since the statistics were reset | TransactionCount |
Transaction Count per Minute | measurement | The global number of transactions known to have completed since the statistics were reset | TransactionCount |
Collection Fetch Count | measurement | The global number of collections fetched since the statistics were reset | CollectionFetchCount |
Collection Fetch Count per Minute | measurement | The global number of collections fetched since the statistics were reset | CollectionFetchCount |
Session Close Count | measurement | The global number of sessions closed since the statistics were reset | SessionCloseCount |
Session Close Count per Minute | measurement | The global number of sessions closed since the statistics were reset | SessionCloseCount |
Query Cache Miss Count | measurement | The global number of cached queries *not* found in cache since the statistics were reset | QueryCacheMissCount |
Query Cache Miss Count per Minute | measurement | The global number of cached queries *not* found in cache since the statistics were reset | QueryCacheMissCount |
Second Level Cache Miss Count | measurement | The global number of cacheable entities/collections not found in the cache and loaded from the database since the statistics were reset | SecondLevelCacheMissCount |
Second Level Cache Miss Count per Minute | measurement | The global number of cacheable entities/collections not found in the cache and loaded from the database since the statistics were reset | SecondLevelCacheMissCount |
Note
You must use the internal name to reference Traits in Dynamic Group Definition expressions.
Configuration Properties
none
Operations
Name | Description |
---|---|
Clear Statistics | Clear the collected statistics and begin collecting again |
View Queries | View statistical information about queries executed by Hibernate |
Package Types
none
3.6.1. Hibernate - Entity Service
Overview
Description: | A Hibernate persistent entity |
Singleton: | no |
Plugin: | Hibernate |
Child Resource Types
none
Connection Properties
none
Metrics
Name | Type | Description | Internal Name |
---|---|---|---|
Load Count | measurement | The number of times this entity was loaded since the statistics were reset | loadCount |
Update Count | measurement | The number of times this entity was updated since the statistics were reset | updateCount |
Insert Count | measurement | The number of times this entity was inserted since the statistics were reset | insertCount |
Delete Count | measurement | The number of times this entity was deleted since the statistics were reset | deleteCount |
Fetch Count | measurement | The number of times this entity was fetched since the statistics were reset | fetchCount |
Optimistic Lock Failure Count | measurement | The number of StaleObjectStateExceptions for this entity that occurred since the statistics were reset | optimisticFailureCount |
Note
You must use the internal name to reference Traits in Dynamic Group Definition expressions.
Configuration Properties
none
Operations
none
Package Types
none