Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Prometheus Metrics

31 sites No security coverage
View on drupal.org

This module provides a configurable endpoint for your Drupal site to expose metrics in the Prometheus format. It can track metrics like entity creation/updates and request timings, helping you monitor your site's performance and usage.

Prometheus Metrics

Introduction

This module provides a configurable endpoint to output metrics in the Prometheus text format. Prometheus is a widely used tool for monitoring key metrics of a service. With this module out of the box you can get some great insight into some metrics for your Drupal site. Such as how many entities are created/ updated and how long are requests taking.

Combining just the default data provided by this module to Prometheus with a graphing tool such as Grafana can be a great starting point for monitoring and gaining insight to how your site is being used and performing.

From the Prometheus site:

From metrics to insight

Power your metrics and alerting with a leading open-source monitoring solution.

This modules uses the PromPHP/prometheus_client_php to collect/ render the metrics and expose different storage options:

  • Redis
  • InMemory
  • APC

Installation

Download or use composer require drupal/prometheus_metrics as you usually would with any contrib module. Depending upon which storage adapter you choose you may require some underlying php extensions to be available and enabled such as apc or redis e.g. pecl install -o -f redis.

Configuration

Default configuration will make metrics available at '/metrics', with a namespace of 'drupal' however there is a configuration page available at '/admin/config/system/prometheus that allows' you to set the endpoint for your Prometheus server to read the metrics and to define the namespace for the metrics presented by this module.

The default storage backend for this collected data is the 'in memory' storage adapter provided by the 'PromPHP/prometheus_client_php' library. However the module makes it possible to easily alter the storage type.

To alter the storage type from the default you'll need to add some settings to your sites settings.php. The possible storage type options are 'apc'/ 'redis'. 'apc' requires only the prometheus_metrics_storage_type to be defined.

$settings['prometheus_metrics_storage_type'] = 'redis';

or

$settings['prometheus_metrics_storage_type'] = 'apc';

To use redis the following additional configuration must be defined:

$settings['prometheus_metrics_redis_host'] = 'redis-host'
$settings['prometheus_metrics_redis_port'] = 3679;
$settings['prometheus_metrics_redis_timeout'] = 0.1;
$settings['prometheus_metrics_redis_read_timeout'] = 10;
$settings['prometheus_metrics_redis_persist_conns'] = false;
$settings['prometheus_metrics_redis_database'] = null;

Both the apc and redis storage adapters require the respective extension is enabled for PHP.

Metrics

By default, this module provides a few different metrics:

  • Request timings - By route, method and status code
  • Request counts - By route, method and status code
  • Entity CRUD metrics - By bundle and Create/Update/Delete

Example of metrics for request timings and counts:

cms_http_requests_total_bucket{method="GET",route="prometheus_metrics_collect",status="2xx",le="0.005"} 11972
cms_http_requests_total_bucket{method="GET",route="prometheus_metrics_collect",status="2xx",le="0.01"} 12122
cms_http_requests_total_bucket{method="GET",route="prometheus_metrics_collect",status="2xx",le="0.025"} 14087
cms_http_requests_total_bucket{method="GET",route="prometheus_metrics_collect",status="2xx",le="0.05"} 14122
cms_http_requests_total_bucket{method="GET",route="prometheus_metrics_collect",status="2xx",le="0.075"} 14128
cms_http_requests_total_bucket{method="GET",route="prometheus_metrics_collect",status="2xx",le="0.1"} 14128
cms_http_requests_total_bucket{method="GET",route="prometheus_metrics_collect",status="2xx",le="0.25"} 14128
cms_http_requests_total_bucket{method="GET",route="prometheus_metrics_collect",status="2xx",le="0.5"} 14129
cms_http_requests_total_bucket{method="GET",route="prometheus_metrics_collect",status="2xx",le="0.75"} 14130
cms_http_requests_total_bucket{method="GET",route="prometheus_metrics_collect",status="2xx",le="1"} 14130
cms_http_requests_total_bucket{method="GET",route="prometheus_metrics_collect",status="2xx",le="2.5"} 14130
cms_http_requests_total_bucket{method="GET",route="prometheus_metrics_collect",status="2xx",le="5"} 14130
cms_http_requests_total_bucket{method="GET",route="prometheus_metrics_collect",status="2xx",le="7.5"} 14130
cms_http_requests_total_bucket{method="GET",route="prometheus_metrics_collect",status="2xx",le="10"} 14130
cms_http_requests_total_bucket{method="GET",route="prometheus_metrics_collect",status="2xx",le="+Inf"} 14130
cms_http_requests_total_count{method="GET",route="prometheus_metrics_collect",status="2xx"} 14130
cms_http_requests_total_sum{method="GET",route="prometheus_metrics_collect",status="2xx"} 35.46717
cms_http_requests_total{method="GET",route="prometheus_metrics_collect",status="2xx"} 14130

Extending metrics returned

There are likely cases where you'll want/ need more metrics reported for a bespoke project or something contributed that you use that this module doesn't cover out of the box. If you think the extension to metrics is something that the module should support by default and would likely be useful to others please feel free to raise an issue.

However if the metrics you are looking to measure are quite niche and unlikely to be of benefit to others then its time to create your own extension to this module.

See our guide to extending the module for detailed instructions on how to create custom metrics collectors.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
8
Tracked since
Mar 2025
Latest release
8 months ago
Releases (12 mo)
1 ▼ from 7
Maintenance
Slowing

Release Timeline

Releases

Version Type Core Release date
1.1.0-rc1 Pre-release 11 Dec 16, 2025
1.0.0-alpha23 Pre-release 10–11 Mar 23, 2025
1.0.0-alpha22 Pre-release 10–11 Mar 23, 2025
1.0.0-alpha21 Pre-release 10–11 Mar 22, 2025
1.0.0-alpha20 Pre-release 10–11 Mar 22, 2025
1.0.0-alpha19 Pre-release 10–11 Mar 21, 2025
1.0.0-alpha17 Pre-release 10–11 Mar 21, 2025
1.0.0-alpha16 Pre-release 10–11 Mar 21, 2025