# Metrics

> Configuration for metrics.

To enable performance and error measurement of connected services, Directus can provide Prometheus metrics.

<table>
<thead>
  <tr>
    <th>
      Variable
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Default Value
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        METRICS_ENABLED
      </code>
    </td>
    
    <td>
      Whether or not to enable metrics.
    </td>
    
    <td>
      <code>
        false
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        METRICS_SCHEDULE
      </code>
    </td>
    
    <td>
      The cron schedule at which to generate the metrics.
    </td>
    
    <td>
      <code>
        */1 * * * *
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        METRICS_TOKENS
      </code>
    </td>
    
    <td>
      A comma-separated list of tokens (e.g. <code>
        token1,token2
      </code>
      
      ) that grant access via the <code>
        Authorization: Metrics <token>
      </code>
      
       header. By default, access is restricted to admins.
    </td>
    
    <td>
      --
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        METRICS_SERVICES
      </code>
    </td>
    
    <td>
      A comma-separated list of Directus services to observe metrics for. Supported values: <code>
        database
      </code>
      
      , <code>
        cache
      </code>
      
      , <code>
        redis
      </code>
      
      , <code>
        storage
      </code>
      
      .
    </td>
    
    <td>
      <code>
        database,cache,redis,storage
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        METRICS_NAME_PREFIX
      </code>
    </td>
    
    <td>
      Prefix applied to all Prometheus metric names.
    </td>
    
    <td>
      <code>
        directus_
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        METRICS_HEALTH_CHECK_PREFIX
      </code>
    </td>
    
    <td>
      Prefix for health check keys used in cache, Redis, and storage checks.
    </td>
    
    <td>
      <code>
        directus-metric-
      </code>
    </td>
  </tr>
</tbody>
</table>

<callout color="warning" icon="i-lucide-triangle-alert">

**Metric Aggregation**
If Directus is running within a PM2 context, then metrics will be aggregated on a per scheduled job frequency. Ensure
Prometheus' scrape frequency takes that into account.

</callout>
