PR-5.3-dev Pending

User tests: Successful: Unsuccessful:

avatar AlterBrains
AlterBrains
8 Jun 2025

Summary of Changes

Allow debug plugin to use instance of QueryMonitorInterface in query collector.

Currently, it's hard-coded to instance of DebugMonitor (which is a final class for some reason). Hence, we can't use custom monitors with debug plugin enabled.

Testing Instructions

Apply patch. Enable debug in global configuration and debug plugin.

Actual result BEFORE applying this Pull Request

See debug.

Expected result AFTER applying this Pull Request

See same debug, nothing is changed.

Link to documentations

Please select:

  • No documentation changes for docs.joomla.org needed
  • No documentation changes for manual.joomla.org needed
avatar AlterBrains AlterBrains - open - 8 Jun 2025
avatar AlterBrains AlterBrains - change - 8 Jun 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 8 Jun 2025
Category Front End Plugins
avatar ceford ceford - test_item - 10 Jun 2025 - Tested successfully
avatar ceford
ceford - comment - 10 Jun 2025

I have tested this item ✅ successfully on 1f1117f

No change in Database section of debug bar on applying this PR.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45579.

avatar RickR2H RickR2H - test_item - 31 Jul 2025 - Tested successfully
avatar RickR2H
RickR2H - comment - 31 Jul 2025

I have tested this item ✅ successfully on 1f1117f


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45579.

avatar RickR2H
RickR2H - comment - 31 Jul 2025

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45579.

avatar richard67 richard67 - change - 1 Aug 2025
Status Pending Ready to Commit
Labels Added: PR-5.3-dev
avatar richard67
richard67 - comment - 1 Aug 2025

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/45579.

avatar AlterBrains
AlterBrains - comment - 6 Aug 2025

I created Sentry.io integration plugin (already in JED) and need to log SQL queries via custom monitor class. If debug is enabled, we have to apply a weird workaround to replace our custom debug monitor with native debug monitor, otherwise debug plugin fails.

I am happy to add missing methods to interface, it will help and won't break anything.

avatar laoneo
laoneo - comment - 6 Aug 2025

Adding new methods to an interface breaks per se the classes implementing the interface ;-)

avatar AlterBrains
AlterBrains - comment - 6 Aug 2025

I am afraid I was the first one who created non-core monitor :)

Maybe we can at least not make the current monitor class final?

avatar AlterBrains
AlterBrains - comment - 7 Aug 2025

@laoneo , @HLeithner
So, can we just remove the final statement from Joomla\Database\Monitor\DebugMonitor? I will update the PR.
Otherwise, we have hard-coded debug plugin which limits 3rd-party debugging functionality. Sentry is life-saver and really helps the developers, but with enabled debug we have a headache to collect SQL data for Sentry.

avatar laoneo
laoneo - comment - 7 Aug 2025

Can you prepare the pr in a way how it would work then for you, so we can discus this in maintainers meeting. There should be reason why the class is final.

avatar AlterBrains
AlterBrains - comment - 8 Aug 2025

@laoneo I think it's easier to just remove final class limitation, but it requires a patch in Joomla database package https://github.com/joomla-framework/database

Btw it's strange that Joomla\Database\Monitor\DebugMonitor contains plugin-specific logic, framework package relies on QueryMonitorInterface but DebugMonitor should be in plugin src as plugin-specific class.

If I add plugin-specific Joomla\Plugin\System\Debug\Monitor\DebugMonitor class (copy from package) but without final limitations, there will be no need to patch framework package.

What do you think?

avatar HLeithner
HLeithner - comment - 8 Aug 2025

Btw it's strange that Joomla\Database\Monitor\DebugMonitor contains plugin-specific logic, framework package relies on QueryMonitorInterface but DebugMonitor should be in plugin src as plugin-specific class.

can you elaborate where you see plugin specific code in this class?

I see 2 ways to go, create an Interface or remove final... I personally would go the interface way.

avatar AlterBrains
AlterBrains - comment - 8 Aug 2025

Joomla\Database\Monitor\DebugMonitor has methods only used in debug plugin, but not in database package - the methods you mentioned:

  • getLogs()
  • getBoundParams()
  • getTimings()
  • getMemoryLogs()
  • getCallStacks()

This logic is out of database package, it's the logic from debug plugin itself.

So, you think to: either remove final or create a new debug plugin-specific interface and use it in the plugin.
But, with the new interface the final DebugMonitor still can't be extended and used in my code. Useless.

Final is evil here. We can't extend Joomla code.

avatar AlterBrains
AlterBrains - comment - 11 Aug 2025

Joomla\Database\Monitor\DebugMonitor has methods only used in debug plugin, but not in database package - the methods you mentioned:

  • getLogs()
  • getBoundParams()
  • getTimings()
  • getMemoryLogs()
  • getCallStacks()

This logic is out of database package, it's the logic from debug plugin itself.

So: either remove final or create a new debug plugin-specific interface and use it in the plugin.
But, with the new interface the final DebugMonitor still can't be extended and used in my code. Useless.

Final is evil here. We can't extend Joomla code.

For me the best and simplest solution is to have non-final DebugMonitor class in debug plugin src.

Add a Comment

Login with GitHub to post a comment