Documentation

Backend

Cache

Monitor cache hit rates, latency, and per-key performance

Monocle provides a dedicated Cache dashboard for monitoring your cache layer. See how your cache is performing at a glance and identify which keys need attention.

Cache dashboard with hit and miss rates, latency, and the per-key table

What Monocle tracks

  • Hit rate with color-coded percentage (green for healthy, red for low)
  • Total operations count and average/P95 latency
  • Hit/miss chart showing cache efficiency over time
  • Latency chart tracking response time trends
  • Per-key breakdown with individual hit/miss ratio and latency metrics

Key sanitization

Cache keys often contain dynamic values (user IDs, UUIDs, session tokens) that would create high-cardinality attributes. Monocle automatically sanitizes keys by replacing dynamic segments with *:

  • users:550e8400-e29b-41d4-a716-446655440000 becomes users:*
  • post:12345 becomes post:*
  • hash:a1b2c3d4e5f6 becomes hash:*

This keeps the per-key table useful instead of showing thousands of unique entries. You can provide a custom sanitizer if the defaults do not match your key format.

Span attributes

All cache instrumentations must emit these attributes for the Cache dashboard to work correctly.

AttributeDashboard Feature
cache.operationOperation type grouping (get, set, getOrSet, delete, etc.)
cache.keyPer-key breakdown table (sanitized)
cache.hitHit rate calculation and hit/miss charts
cache.storeCache store identification

Supported libraries

Getting started

The Bentocache page covers setup with the AdonisJS agent, including caches created through @adonisjs/cache.

Search documentation

Search pages and sections of the Monocle documentation