Skip to content
Closed
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 180 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions plugins/node/opentelemetry-instrumentation-redis/.tav.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
redis:
versions:
include: '>=2.6.0 <4'
mode: latest-minors
commands: npm run test
- versions:
include: '>=2.6.0 <4'
mode: latest-minors
commands: npm run test-v2-v3-run
- versions:
include: '>=4 <5'
# "4.6.9" was a bad release that accidentally broke node v14 support.
exclude: "4.6.9"
mode: latest-minors
commands: npm run test-v4-run
6 changes: 2 additions & 4 deletions plugins/node/opentelemetry-instrumentation-redis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-image]

This module provides automatic instrumentation for the [`redis`](https://github.com/NodeRedis/node_redis) module versions `>=2.6.0 <4`, which may be loaded using the [`@opentelemetry/sdk-trace-node`](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package and is included in the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle.
This module provides automatic instrumentation for the [`redis`](https://github.com/NodeRedis/node_redis) module versions `>=2.6.0 <5`, which may be loaded using the [`@opentelemetry/sdk-trace-node`](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package and is included in the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle.

If total installation size is not constrained, it is recommended to use the [`@opentelemetry/auto-instrumentations-node`](https://www.npmjs.com/package/@opentelemetry/auto-instrumentations-node) bundle with [@opentelemetry/sdk-node](`https://www.npmjs.com/package/@opentelemetry/sdk-node`) for the most seamless instrumentation experience.

Expand All @@ -17,9 +17,7 @@ npm install --save @opentelemetry/instrumentation-redis

### Supported Versions

- [`redis`](https://www.npmjs.com/package/redis) versions `>=2.6.0 <4`

For versions `redis@^4.0.0`, please use `@opentelemetry/instrumentation-redis-4`
- [`redis`](https://www.npmjs.com/package/redis) versions `>=2.6.0 <5`

## Usage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{
"name": "@opentelemetry/instrumentation-redis",
"version": "0.49.0",
"description": "OpenTelemetry instrumentation for `redis` v2 and v3 database client for Redis",
"description": "OpenTelemetry instrumentation for `redis` database client for Redis",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js-contrib",
"scripts": {
"test": "nyc mocha 'test/**/*.test.ts'",
"test": "npm run test-v2-v3 && npm run test-v4",
"test-v2-v3": "tav redis 3.1.2 npm run test-v2-v3-run",
"test-v4": "tav redis 4.7.1 npm run test-v4-run",
"test-v2-v3-run": "nyc mocha --no-clean --require '@opentelemetry/contrib-test-utils' 'test/v2-v3/*.test.ts'",
"test-v4-run": "nyc mocha --no-clean --require '@opentelemetry/contrib-test-utils' 'test/v4/*.test.ts'",
Comment on lines +9 to +13
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewer note:

this is aligned with @opentelemetry/instrumentation-mongodb

Copy link
Contributor

@trentm trentm Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we should be leaving testing of multiple versions of the target library to test-all-versions tests -- that's what test-all-versions is for. I think the mongodb testing change was misguided.

I have an alternative PR that builds on yours that shows what I mean: #2915
That PR also has a few other changes. PTAL.

"test:debug": "cross-env RUN_REDIS_TESTS_LOCAL=true mocha --inspect-brk --no-timeouts 'test/**/*.test.ts'",
"test:local": "cross-env RUN_REDIS_TESTS_LOCAL=true npm run test",
"test:docker:run": "docker run --rm -d --name otel-redis -p 63790:6379 redis:alpine",
Expand Down Expand Up @@ -59,6 +63,7 @@
"cross-env": "7.0.3",
"nyc": "17.1.0",
"redis": "3.1.2",
"redis-v4": "npm:[email protected]",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewer note: this is needed for the v4 tests.
Since redis version is 3 by default, then npm run compile would fail when trying to import RedisClientType if not pulled into node_modules somehow.

When running the tests, tav redis 4.7.1 would take care of updating the redis to make the test pass, but compile is run before that

"rimraf": "5.0.10",
"test-all-versions": "6.1.0",
"typescript": "5.0.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
export { RedisInstrumentation } from './instrumentation';
export type {
DbStatementSerializer,
RedisCommand,
RedisInstrumentationConfig,
RedisResponseCustomAttributeFunction,
} from './types';
Loading