Skip to main content
This guide explains how to:
  • Install and enable the cache integration
  • Customize key sanitization
  • Suppress internal cache operations

Overview

The explicit integration traces Bentocache operations, including caches used through @adonisjs/cache, using your agent’s OpenTelemetry provider. See the Cache dashboard for the attributes it uses.
This integration requires AdonisJS agent 2.x. To replace the 1.x top-level cache option, follow the migration guide.

Installation

Install the integration and declare Bentocache in your application. The integration supports Bentocache ^1.6.0.
Terminal

With the AdonisJS agent

Register bentocache() in config/monocle.ts. Keep otel.ts first in your application entry points so hooks initialize before application modules load.
config/monocle.ts
Omit the integration or use bentocache({ enabled: false }) to disable it. Installing the package alone does not activate tracing.

Configuration

The default options preserve the agent’s previous cache behavior: keys are captured and sanitized, parent spans are not required, and internal Redis/L2 operations are suppressed. Override key handling or require a parent span through the factory.
config/monocle.ts

Key sanitization

The default sanitizer replaces UUIDs, numeric IDs, and hexadecimal identifiers with *. For example, users:123 becomes users:*. A custom keySanitizer replaces this default. Set includeKeys: false to omit keys.

Internal operation suppression

The Monocle integration suppresses internal Redis, L2, and bus spans so traces show high-level cache operations. This retains the previous Adonis agent behavior.

Without the AdonisJS agent

For a standalone OpenTelemetry setup, use BentoCacheInstrumentation from @bentocache/otel directly. Its defaults differ from the Monocle wrapper. Initialize your SDK and module hooks before loading your application, and include the instrumentation in your existing SDK setup.
instrumentation.ts