# How to install plone.observability This guide shows you how to add plone.observability to a Plone instance and wire its WSGI filters into the pipeline. The package ships three WSGI filters: healthserver : Starts the health probe server. observability : Populates the request metrics (`plone_requests_total`, `plone_request_duration_seconds_*`). opentelemetry : Sets up OpenTelemetry tracing and emits the root request span. Tracing does not work without it. Add it only if you use the tracing extra. Without the filters the package is loaded but inert: the health server never starts and request metrics stay empty. (install-add-the-dependency)= ## Add the dependency Add `plone.observability` to your project dependencies. ```toml [project] dependencies = [ "plone.observability", ] ``` Plone loads the package's ZCML automatically through `z3c.autoinclude`. On a plain Zope instance without Plone, include it yourself: ```xml ``` (install-wire-the-filters)= ## Wire the filters Choose the approach that matches how your `zope.ini` is produced. `````{tab-set} ````{tab-item} cookiecutter-zope-instance If your `zope.ini` is generated by [cookiecutter-zope-instance](https://github.com/plone/cookiecutter-zope-instance) (3.1.0 or newer), do not edit `zope.ini` by hand. Declare the filters through `wsgi_filters` in your `instance.yaml`: ```yaml default_context: wsgi_filters: healthserver: use: "egg:plone.observability#healthserver" observability: use: "egg:plone.observability#observability" opentelemetry: use: "egg:plone.observability#opentelemetry" ``` Regenerating renders the `[filter:*]` sections and wires them into `[pipeline:main]`. Each entry also accepts `options` for extra `key: value` lines and `position` (`outer`, the default, or `inner`). Drop the `opentelemetry` entry if you do not use the tracing extra. ```` ````{tab-item} Hand-written zope.ini Add the filters to the pipeline and declare them as PasteDeploy filters: ```ini [pipeline:main] pipeline = egg:Zope#httpexceptions healthserver observability opentelemetry zope [filter:healthserver] use = egg:plone.observability#healthserver [filter:observability] use = egg:plone.observability#observability [filter:opentelemetry] use = egg:plone.observability#opentelemetry ``` Keep the names in `pipeline` and the `[filter:*]` sections in sync with your existing `zope.ini`. Leave out `opentelemetry` and its section if you do not use the tracing extra. ```` ````` (install-verify)= ## Verify Start the instance and check the health port. ```console $ curl http://localhost:8081/live {"status": "ok", "checks": {}} ``` Then open the metrics endpoint. ```console $ curl http://localhost:8080/@@metrics # HELP plone_uptime_seconds Process uptime in seconds # TYPE plone_uptime_seconds gauge plone_uptime_seconds{scope="instance"} 42.0 ``` ```{seealso} - {doc}`/reference/configuration` for the environment variables that control the health port and metrics. - {doc}`/how-to/configure-kubernetes-probes` to point Kubernetes at the health server. - {doc}`/explanation/health-probes` for why the health server runs on its own port. ```