From 852fa5f9cc2f255a5b89be5bbd0eb7eab3ef2395 Mon Sep 17 00:00:00 2001 From: CahidArda Date: Mon, 20 Oct 2025 14:49:28 +0300 Subject: [PATCH] fix: document telemetry configuration option --- README.md | 9 +++++++++ platforms/cloudflare.ts | 2 +- platforms/nodejs.ts | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d9687461..fff2cb5e 100644 --- a/README.md +++ b/README.md @@ -134,3 +134,12 @@ to any truthy value. ```sh UPSTASH_DISABLE_TELEMETRY=1 ``` + +Alternatively, you can pass `enableTelemetry: false` when initializing the Redis client: + +```ts +const redis = new Redis({ + // ..., + enableTelemetry: false, +}); +``` diff --git a/platforms/cloudflare.ts b/platforms/cloudflare.ts index 4bf620e2..908736d6 100644 --- a/platforms/cloudflare.ts +++ b/platforms/cloudflare.ts @@ -89,7 +89,7 @@ export class Redis extends core.Redis { }); super(client, { - enableTelemetry: !env?.UPSTASH_DISABLE_TELEMETRY, + enableTelemetry: config.enableTelemetry ?? !env?.UPSTASH_DISABLE_TELEMETRY, automaticDeserialization: config.automaticDeserialization, latencyLogging: config.latencyLogging, enableAutoPipelining: config.enableAutoPipelining, diff --git a/platforms/nodejs.ts b/platforms/nodejs.ts index 0bf3b077..95d9dc41 100644 --- a/platforms/nodejs.ts +++ b/platforms/nodejs.ts @@ -144,7 +144,7 @@ export class Redis extends core.Redis { super(client, { automaticDeserialization: configOrRequester.automaticDeserialization, - enableTelemetry: !process.env.UPSTASH_DISABLE_TELEMETRY, + enableTelemetry: configOrRequester.enableTelemetry ?? !process.env.UPSTASH_DISABLE_TELEMETRY, latencyLogging: configOrRequester.latencyLogging, enableAutoPipelining: configOrRequester.enableAutoPipelining, });