Skip to main content
This guide covers how to instrument Bentocache for monitoring cache operations. You will learn how to:
  • Install and configure the instrumentation
  • Customize key sanitization
For the full list of required span attributes and what powers the Cache dashboard, see the Cache feature page.

Installation

Peer dependency: bentocache >= 1.0.0

Usage

Create an instance of BentoCacheInstrumentation and call enable().
instrumentation.ts
If the ESM hook does not automatically patch Bentocache (e.g., timing issues), you can register it manually:
instrumentation.ts
Once enabled, all cache operations (get, set, getOrSet, delete, has, clear, etc.) create spans automatically.

Configuration

Bentocache-specific behavior

Internal operation suppression

When suppressInternalOperations: true, internal spans from the underlying store (Redis commands, L2 calls) are suppressed. This keeps traces clean by only showing the high-level cache operations.

Key sanitization

The Monocle agent applies a default sanitizer that replaces UUIDs, numeric IDs, and hex hashes with *. You can provide your own: