Documentation for agents: an index at /llms.txt, every docs page in one file at /llms-full.txt, and Markdown for any docs page by adding .md to its URL.

Effect KitRedis

Observability

Turn on metrics and spans for Redis operations, and know what the package never records.

RedisTelemetry records Effect metrics and, optionally, spans for calls made through the Redis service. It is off by default, and the package has no logging.

Enabling telemetry

Merge RedisTelemetry.layer with your runtime layer. Metrics are on and tracing is off unless you say otherwise.

Example (Enabling Metrics and Spans)

import {  } from "effect";
import { RedisTelemetry } from "@effect-kit/redis";
import {  } from "@effect-kit/redis/node";

const  = .({ : "redis://localhost:6379" });

export const  = .(
  ,
  RedisTelemetry.({ : true, : true }),
);
OptionDefaultMeaning
metricstrueRecord the counters and the histogram below
tracingfalseCreate one client span per operation

Without the layer, both are off and instrumented calls skip the work. Telemetry adds no service to the requirements of a command.

The package does not export anything. Exporters for metrics and traces belong to your application, for example an OpenTelemetry layer.

Metrics

Each operation is a command, a pipeline or a transaction. A pipeline or transaction counts once, not once per command inside it.

MetricTypeAttributes
effect_redis.operationsCounteroperation, outcome
effect_redis.operations.activeCounter, up on start and down on finishoperation
effect_redis.operation.duration_msHistogramoperation

outcome is success, failure, defect or interrupted. The histogram boundaries are 0, 0.1, 0.5, 1, 2, 5, 10, 50, 100, 500, 1000, 5000 and 30000 milliseconds.

Example (Reading the Redis Metrics)

import { ,  } from "effect";

export const  = .(function* () {
  const  = yield* .;
  return .(() => ..("effect_redis."));
});

Spans

With tracing: true, each operation runs in a span named redis.command, redis.pipeline or redis.transaction, with kind client and an outcome attribute. On failure the span ends with a fixed RedisOperationFailure value and the outcome, never your error.

What is never recorded

Names and attributes never come from command arguments. The command name, keys and values are not recorded, so you cannot get per-command or per-key metrics from this layer.

Only the Redis service is instrumented

Calls on Redis are counted, including execute, raw, redis.pipeline and redis.transaction. Sessions, Pub/Sub and Streams are not.

Inspecting pools and subscriptions

RedisSessions and RedisPubSub expose a snapshot effect that reports their current state without any telemetry setup.

Example (Reading Pool and Subscription State)

import {  } from "effect";
import { ,  } from "@effect-kit/redis";

export const  = .(function* () {
  const  = yield* ;
  const  = yield* ;

  const  = yield* .;
  const  = yield* .;

  return { : ., : ., : . };
});

sessions.snapshot reports closed, waiting, leased, connections, idle, generations and retired. pubsub.snapshot reports generation, listeners, retiring, interests and retainedBytes.