[MAGNOLIA-8503] Ability to log JCR queries Created: 14/Jul/22  Updated: 31/Jan/23  Resolved: 25/Jan/23

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 6.2.21
Fix Version/s: 6.3.0, 6.2.28

Type: New Feature Priority: Neutral
Reporter: Mikaël Geljić Assignee: Roman Kovařík
Resolution: Fixed Votes: 2
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Issue Links:
causality
is causing MAGNOLIA-8726 Setting magnolia.jcr.query.logging.th... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MAGNOLIA-8700 Impl Sub-task Completed Roman Kovařík  
MAGNOLIA-8701 Rw Sub-task Completed Fernando Cherchi  
MAGNOLIA-8702 Preint QA Sub-task Closed Antonín Juran  
MAGNOLIA-8703 QA Sub-task Completed Adam Siska  
MAGNOLIA-8705 Docu Sub-task Completed Roman Kovařík  
MAGNOLIA-8720 Docu rw Sub-task Completed Adrian Brooks  
Template:
Acceptance criteria:
Empty
Release notes required:
Yes
Documentation update required:
Yes
Date of First Response:
Epic Link: [JCR] Search Performance issues
Sprint: Nucleus 28
Story Points: 3
Team: Nucleus
Work Started:

 Description   

In Jackrabbit / org.apache.jackrabbit.core.query.QueryImpl, it is possible to turn on debug logs, however this will log every query, not just slow ones.

It would be helpful to add logs for slow queries, in similar fashion as for pages which took a long time to render, as this would help identify regular "offenders" and correlate slowness with other events (e.g. concurrent access, CPU activity).



 Comments   
Comment by Roman Kovařík [ 12/Jan/23 ]

Discovery:

  1. Take inspiration from the logging implementation in https://github.com/nabils/jackrabbit/blob/master/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/QueryImpl.java#L141
  2. Create a wrapper for javax.jcr.query.Query with similar code.
  3. Override #getQueryManager in https://git.magnolia-cms.com/projects/PLATFORM/repos/main/browse/magnolia-core/src/main/java/info/magnolia/jcr/decoration/ContentDecoratorWorkspaceWrapper.java?at=refs%2Fheads%2Fmaster
  4. If a certain system property with a threshold for logging slow queries exist (e.g. in magnolia.properties file), wrap the manager with the new wrapper
  5. Unit/manual tests
Generated at Mon Feb 12 04:33:17 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.