Skip to main content

Log details about ZCatalog query performance

Project description

collective.catalogtrace

Log details about ZCatalog query performance

Features

Logs details about each ZCatalog query:

  • Query parameters
  • Where the query was called
  • Detailed execution:
    • Index name
    • Elapsed time
    • Count of persistent objects loaded
    • Count of new objects tracked by the Python GC

This information can be used to troubleshoot poor query performance.

There is some overhead to recording these measures.

Tracing is enabled for all queries if the TRACE_CATALOG_QUERIES environment variable is set.

Tracing can be enabled for specific requests by setting the catalogtrace cookie.

Example Output

2025-11-04 09:39:39,984 INFO    [collective.catalogtrace:111][waitress-2] Catalog query completed in 0.0570s
    Query parameters:
      { 'allowedRolesAndUsers': [ 'Anonymous',
                                  'Authenticated',
                                  'Manager',
                                  'user:admin'],
        'exclude_from_nav': False,
        'is_default_page': False,
        'path': {'depth': 1, 'query': '/Plone/de'},
        'portal_type': [ 'Document',
                         'Folder',
                         'Link' ],
        'sort_on': 'getObjPositionInParent',
        'sort_order': 'ascending'}
    Query from:
      File "/Users/davisagli/Work/dlr-internet/backend/.venv/lib/python3.12/site-packages/plone/volto/browser/navigation.py", line 84, in topLevelTabs
        rawresult = catalog.searchResults(query)
      File "/Users/davisagli/Work/dlr-internet/backend/.venv/lib/python3.12/site-packages/collective/solr/monkey.py", line 19, in searchResults
        return adapter(REQUEST, **kw)
      File "/Users/davisagli/Work/dlr-internet/backend/.venv/lib/python3.12/site-packages/collective/solr/dispatcher.py", line 40, in __call__
        return self.context._cs_old_searchResults(request, **keywords)
    Details:
      Step: path | Time: 0.0098s | Results: 89 | DB Objects: +0 | GC Objects: +7
      Step: is_default_page | Time: 0.0082s | Results: 89 | DB Objects: +0 | GC Objects: +14
      Step: portal_type | Time: 0.0085s | Results: 21 | DB Objects: +0 | GC Objects: +17
      Step: exclude_from_nav | Time: 0.0102s | Results: 6 | DB Objects: +0 | GC Objects: +7
      Step: allowedRolesAndUsers | Time: 0.0102s | Results: 6 | DB Objects: +0 | GC Objects: +6
      Step: sort_on#getObjPositionInParent#asc | Time: 0.0100s | Results: 6 | DB Objects: +0 | GC Objects: +17

Installation

Install collective.catalogtrace with pip:

pip install collective.catalogtrace

And to create the Plone site:

make create-site

Contribute

Prerequisites ✅

Installation 🔧

  1. Clone this repository, then change your working directory.

    git clone git@github.com:collective/collective.catalogtrace.git
    cd collective.catalogtrace
    
  2. Install this code base.

    make install
    

License

The project is licensed under GPLv2.

Credits and acknowledgements 🙏

Generated using Cookieplone (0.9.10) and cookieplone-templates (888ff69) on 2025-11-03 14:45:41.122916. A special thanks to all contributors and supporters!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

collective_catalogtrace-1.0.2.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

collective_catalogtrace-1.0.2-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file collective_catalogtrace-1.0.2.tar.gz.

File metadata

  • Download URL: collective_catalogtrace-1.0.2.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for collective_catalogtrace-1.0.2.tar.gz
Algorithm Hash digest
SHA256 608eaf0c2301e3567c8ddc6fd69eddf7ccdd56124c3b61a1392f79e14bda94fb
MD5 0e188fab888f7cb8b0527300fd191c68
BLAKE2b-256 456760340ece4a7c3ab08e9b977f6446cc051980bcbeb4b692cf5fe0c2490369

See more details on using hashes here.

File details

Details for the file collective_catalogtrace-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for collective_catalogtrace-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bfa4ccd9752732835a61e29374b6442618952bd505b05239a9e5bdce56afd01f
MD5 1e56e525f83521aa269673c51897c806
BLAKE2b-256 2578bf439e9cb4ad8d4bd759f71a15b7e9a085cdcd81758c4935b01d90d7bb00

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page