Links

Monitoring

CiviForm supports server monitoring via Prometheus metrics visualized in Grafana. These metrics are related to server status, things like latency and error rates, and do not contain sensitive data, such as who is applying to what programs.

Enabling metrics export

Exporting metrics from the server is optional, and must be enabled by setting the CIVIFORM_SERVER_METRICS_ENABLED environment variable to true. When enabled, the server exports metrics from the /metrics HTTP route. While these metrics data are not sensitive, it is a good practice to prevent access to this route from the public internet (which is done by default when using the CiviForm terraform deployment system).

Viewing metrics

AWS

The CiviForm terraform deployment system for AWS deploys the monitoring stack automatically. After deployment, user access to the Grafana dashboard and configuration of the dashboard need to be done manually.

Configure access

AWS Managed Grafana uses AWS IAM Identity Center for access management.
Note that this is a different service from AWS IAM the accounts/user profiles in AWS IAM Identity Center are completely separate from accounts in AWS IAM.
  1. 1.
    Login to the AWS console and navigate to the IAM Identity Center service
  2. 2.
    In the left nav, click "Users"
  3. 3.
    For each user you'd like to grant access to viewing metrics, click the "Add user" button and follow the workflow
  4. 4.
    Follow instructions here for adding users to your Grafana workspace
  5. 5.
    In AWS console for your Grafana workspace, grant permissions to the users you added for the workspace

Configure dashboard

Once you have an Identity Center user with permissions to administer your Grafana workspace, it's time to configure the workspace dashboard. From the Grafana workspace page in the AWS console, click the link under "Grafana workspace URL". After signing in this will take you to your Grafana workspace.
To enable viewing metrics, add the Prometheus server as a data source for your Grafana workspace:
  1. 1.
    In AWS console for your Grafana workspace, lick on the 'Data sources' tab
  2. 2.
    Click on the 'Configure in Grafana' link on the 'Amazon Managed Service for Prometheus' row
  3. 3.
    Select the region where civiform is deployed
  4. 4.
    Select the '[deployment name]-CiviForm_metrics' row
  5. 5.
    Select 'add 1 data source'
With Prometheus connected as a Grafana workspace, panels can now be created in Grafana that display metrics from the CiviForm server. There are many metrics available, and many ways to display them. You can get started with the some basic metrics by importing a pre-built CiviForm dashboard. This pre-built dashboard includes:
  • Requests per minute, split out by controller action
  • Requests per minute, split out by URL path pattern
  • Client errors (4XX status codes) per minute, split out by controller action and status code
  • Server erors per minute (500 status code), split out by controller action
  • 50th percentile 5-minute trailing average request latency, split out by controller action
  • 90th percentile 5-minute trailing average request latency, split out by controller action
  • 99th percentile 5-minute trailing average request latency, split out by controller action
To import this pre-built dashboard:
  1. 1.
    Hover over the "+" icon in the left nav
  2. 2.
    Click the "Import" option
  3. 3.
    Paste the JSON here into the "Import via panel JSON" and click "Load"
  4. 4.
    Fill in the details for the imported dashboard, selecting your CiviForm prometheus instance for the data source