[MAGNOLIA-9183] Expose QueryStatManagerMBean for monitoring Created: 10/Nov/23  Updated: 22/Jan/24  Resolved: 16/Jan/24

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: None
Fix Version/s: 6.3.0

Type: Story Priority: Neutral
Reporter: Michael Duerig Assignee: Michael Duerig
Resolution: Done Votes: 0
Labels: dx-core-6.3
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File popular queries.png     PNG File slow queries.png    
Issue Links:
Cloners
clones MAGNOLIA-9181 Expose EventListenerMBean for monitoring Closed
is cloned by MAGNOLIA-9184 Expose RepositoryStatistics for monit... Closed
dependency
depends upon MAGNOLIA-9198 Refactor ProviderImpl to gain access ... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Release notes required:
Yes
Documentation update required:
Yes
Epic Link: Collect Usage Metrics
Work Started:
Approved:
Yes

 Description   

Jackrabbit provides the org.apache.jackrabbit.api.jmx.QueryStatManagerMBean exposing information about queries and its performance. We should register it either with the MBean server info.magnolia.cms.util.MBeanUtil#registerMBean or Dropwizard metrics (info.magnolia.monitoring.MicrometerRegistryProvider).

Discovery

  • The QueryStatManagerMBean is exposed by org.apache.jackrabbit.stats.jmx.QueryStatManager, which needs a org.apache.jackrabbit.api.stats.QueryStat instance. The latter is available via the org.apache.jackrabbit.core.RepositoryContext, which is an internal class that is only available when creating the repository via org.apache.jackrabbit.core.RepositoryContext#create.
  • ProviderImpl currently allocated the Repository instance through a call to org.apache.jackrabbit.core.jndi.RegistryHelper#registerRepository. The latter internally uses org.apache.jackrabbit.core.jndi.BindableRepositoryFactory to create a  org.apache.jackrabbit.core.jndi.BindableRepository but does not offer extension points for creating a custom Repository instance.
  • To customize repository allocation we need to copy and modify org.apache.jackrabbit.core.jndi.RegistryHelper and org.apache.jackrabbit.core.jndi.BindableRepositoryFactory for the latter to create our own {{org.apache.jackrabbit.core.jndi.BindableMgnlRepository}} that exposes the RepositoryContext.
  • See this PR for the details described above.


 Comments   
Comment by Michael Duerig [ 15/Jan/24 ]

For documentation:

The QueryStats MBean exposes the following metrics about the JCR queries. See Javadoc of org.apache.jackrabbit.api.jmx.QueryStatManagerMBean for details.


/cc amansell 

Generated at Mon Feb 12 04:39:21 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.