Metrics#
The @@metrics endpoint is a browser view registered on the application root (OFS.interfaces.IApplication).
It collects metrics from all registered IMetricProvider adapters and serializes them with an IMetricFormatter utility.
Request metrics require the observability WSGI filter in your pipeline.
See How to install plone.observability.
Endpoint#
http://your-plone-host/@@metrics
http://your-plone-host/@@metrics?format=json
The default format is Prometheus text.
Pass ?format=json or send an Accept: application/json header to get JSON.
Built-in metrics#
Metric |
Type |
Scope |
Description |
|---|---|---|---|
|
gauge |
instance |
Process uptime |
|
gauge |
instance |
Python, Zope, and Plone version labels, value always |
|
gauge |
instance |
Active Python threads |
|
gauge |
instance |
Current resident set size, from |
|
gauge |
instance |
Peak resident set size since process start |
|
gauge |
instance |
Resident anonymous memory, such as the heap and thread stacks, from |
|
gauge |
instance |
Resident memory of mapped files, such as shared libraries, from |
|
counter |
instance |
Total CPU time (user + system) |
|
gauge |
instance |
Memory blocks in use by the Python object allocator (pymalloc) |
|
gauge |
instance |
Number of interned strings (Python 3.12 and later) |
|
counter |
instance |
Garbage collections, by |
|
counter |
instance |
Objects collected by the garbage collector, by |
|
counter |
instance |
Uncollectable objects found by the garbage collector, by |
|
counter |
instance |
Garbage collection pause histogram buckets, with |
|
gauge |
instance |
Bytes in use through glibc |
|
gauge |
instance |
Bytes glibc |
|
gauge |
instance |
Bytes in large memory-mapped |
|
gauge |
instance |
Bytes of the glibc |
|
gauge |
instance |
Bytes allocated by the application through jemalloc |
|
gauge |
instance |
Bytes in jemalloc pages that hold allocations |
|
gauge |
instance |
Bytes of jemalloc metadata |
|
gauge |
instance |
Upper bound of bytes in resident jemalloc pages |
|
gauge |
instance |
Bytes in extents mapped by jemalloc |
|
gauge |
instance |
Bytes of virtual memory jemalloc retains instead of unmapping |
|
counter |
instance |
Total HTTP requests served |
|
counter |
instance |
Cumulative request duration |
|
counter |
instance |
Request duration histogram buckets |
|
gauge |
instance |
Worst-case request duration since the last scrape |
|
counter |
instance |
HTTP errors by status code |
|
counter |
instance |
Growth of the resident set size per request, histogram buckets with |
|
gauge |
global |
Total objects in ZODB |
|
gauge |
global |
Size of the database in bytes, as reported by the storage |
|
gauge |
instance |
Open ZODB connections, in use or idle in the pool |
|
gauge |
instance |
Idle ZODB connections waiting in the pool |
|
gauge |
instance |
ZODB connections still in memory, including ones the pool has released, per database |
|
gauge |
instance |
Configured ZODB connection pool size ( |
|
gauge |
instance |
Objects in the ZODB object cache |
|
gauge |
instance |
Estimated size of the ZODB object caches in bytes, summed over all connections |
|
counter |
instance |
Cumulative objects loaded from storage |
|
counter |
instance |
Cumulative objects stored to storage |
|
counter |
instance |
ZODB conflict errors during publish, by |
|
gauge |
global |
Content objects by portal type and site |
|
gauge |
global |
Content objects by workflow state and site |
Labels#
All plone_request* metrics carry an auth="authenticated" or auth="anonymous" label.
This label splits traffic by authentication state.
User identity is never a metric label.
It appears only as a span attribute.
See Configuration for the PLONE_OBSERVABILITY_OTEL_USER_ID setting and About metrics and cardinality for the reasoning.
plone_zodb_conflicts_total carries retry="true" for a conflict that was retried and retry="false" for the final attempt that gave up.
Scope#
Every metric carries a scope label with value global or instance.
- global
The value is the same across all Plone instances sharing the same ZODB, for example object count and content totals. When aggregating in Prometheus, filter to a single instance to avoid double-counting.
- instance
The value is specific to this process, for example request counts and resident set size. Sum across instances when aggregating.
The request duration maximum#
plone_request_duration_seconds_max is the longest request duration since the previous scrape.
Each scrape resets it.
You must scrape it from a single Prometheus target.
With several scrapers, each one sees only part of the window.
Memory metrics#
The memory metrics come from the system and python providers.
Each metric is left out where its source is not available.
plone_process_rss_anon_bytesandplone_process_rss_file_bytesRead from the
RssAnonandRssFilefields of/proc/self/status. They require Linux 4.5 or later.plone_python_allocated_blocksRead from
sys.getallocatedblocks(). The value is a number of blocks. It does not convert them to bytes.plone_python_interned_stringsRead from
sys.getunicodeinternedsize(), which exists in Python 3.12 and later. On Python 3.12, interned strings are never freed. The value never decreases there. From Python 3.13, it can decrease.plone_gc_*_totalRead from
gc.get_stats(). Thegenerationlabel is0,1, or2. What a generation holds depends on the Python version.plone_gc_pause_secondsTimed by a
gc.callbackshook that the package installs on the first metrics scrape. Pauses before the first scrape are not counted. Bucket bounds range from 100 microseconds to 1 second.plone_malloc_*Read from glibc’s
mallinfo2(), which exists in glibc 2.33 and later. They are off by default. SetPLONE_OBSERVABILITY_MALLINFO=1to turn them on. The values are cached forPLONE_OBSERVABILITY_METRICS_CACHE_TTLseconds. They cover only memory allocated through glibcmalloc. Memory from other allocators, such as mimalloc in a Rust extension, does not appear in them. When a jemalloc loaded withLD_PRELOADreplacesmalloc, the metrics are left out, and a warning is logged once.plone_jemalloc_*Read from jemalloc’s
mallctl()when a jemalloc loaded withLD_PRELOADreplacesmalloc. They are on whenever jemalloc is detected, without opt-in. Each scrape refreshes jemalloc’s statistics by writingepoch, then readsstats.allocated,stats.active,stats.metadata,stats.resident,stats.mapped, andstats.retained. A jemalloc built with a symbol prefix does not replacemallocand is not detected. When the statistics cannot be read, for example in a build with--disable-stats, the metrics are left out, and a warning is logged once.plone_jemalloc_resident_bytesis an upper bound. jemalloc counts pages that it handed out but the application never touched as resident.
RSS growth per request#
plone_request_rss_growth_bytes is a histogram of how much the resident set size grew during a request.
It is off by default.
Set PLONE_OBSERVABILITY_REQUEST_RSS=1 to turn it on.
The observability WSGI filter reads /proc/self/statm before the request and again when the application returns.
A response body that is streamed after that is not included.
A request during which the resident set size shrank counts as zero growth.
Bucket bounds range from 0 to 256 MiB.
A request that grows the resident set size by more than PLONE_OBSERVABILITY_REQUEST_RSS_WARN_MIB logs a warning with its method and path.
Connections still in memory#
plone_zodb_connections_alive counts every ZODB connection that a database created and that is still in memory.
It carries a database label and is reported for the main database and every database mounted with it.
plone_zodb_connections covers only the main database’s pool.
The package wraps the database’s connection class when Zope opens the database (IDatabaseOpenedWithRoot).
A configured connection-class stays in effect.
Connections that exist at that moment are counted from the pool.
If the event did not reach the package, the first metrics scrape installs the tracking instead.
The count includes historical connections, which plone_zodb_connections does not.
A connection the pool has released stays counted until the garbage collector frees it.
That takes two collections of the oldest generation.
Catalog backends#
plone_content_total and plone_content_by_state come from the content provider.
It reads the portal_type and review_state indexes of each Plone site through the ZCatalog index API.
A catalog backend that does not keep its data per site must replace the content adapter in its overrides.zcml and keep the metric names.
plone-pgcatalog does.
See About metrics and cardinality for the reason and How to add a custom metric provider for how to replace a built-in provider.
See also
How to scrape and query metrics with Prometheus shows scrape configuration and PromQL recipes. About metrics and cardinality explains scope, label cardinality, and the ZODB activity and conflict monitors.