Skip to main content

Metrics

The following document outlines the steps required to set up application metrics for Drupal.

You don't have to use these instructions but they are recommended as they are designed to work well with Skpr's hosting environment and are tested and maintained by our team.

This document assumes you already have a working Drupal site running on Skpr. If not please see the configuration instructions for Drupal.

Step 1: Install the required packages

composer require drupal/prometheus_exporter:^2.0

Step 2: Enable the modules

drush en prometheus_exporter prometheus_exporter_token_access -y

Step 3: Set up the metrics you want to collect

Visit /admin/config/system/prometheus_exporter on your Drupal site and enable the metrics you want to collect.

note

It's important not to choose any Types for Node, Revision or Queue items as they are currently not supported and you will collect incorrect data.

Step 4: Use the local Skpr secret for the token

Add the following to your settings.php file:

$config['prometheus_exporter_token_access.settings']['access_token'] = $skpr->get('skpr.token', '');

Step 5: Enable the metrics recording for the application

In .skpr/defaults.yml (or one of the specific environment yml files) add the following:

metrics:
enabled: true

Step 6: Test your metrics

A short period after deploying your changes, Skpr will automatically detect the available metrics and make them available through the Skpr UI Application Metrics page.