Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 3 additions & 2 deletions lib/instrumentation/@node-redis/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ function getRedisParams(clientOpts) {
}

return new DatastoreParameters({
host: clientOpts?.socket?.host || 'localhost',
port_path_or_id: clientOpts?.socket?.path || clientOpts?.socket?.port || '6379',
host: clientOpts?.host || clientOpts?.socket?.host || 'localhost',
port_path_or_id:
clientOpts?.port || clientOpts?.socket?.path || clientOpts?.socket?.port || '6379',
database_name: clientOpts?.database || 0
})
}
Expand Down
3 changes: 2 additions & 1 deletion test/versioned/redis/redis-v4-legacy-mode.tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ test('Redis instrumentation', function (t) {
const redis = require('redis')
client = redis.createClient({
legacyMode: true,
socket: { port: params.redis_port, host: params.redis_host }
port: params.redis_port,
host: params.redis_host
Comment on lines +33 to +34
Copy link
Contributor

Choose a reason for hiding this comment

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

For future readers: the alternate form is tested in another suite:

const redis = require('redis')
client = redis.createClient({ socket: { port: params.redis_port, host: params.redis_host } })

})

await client.connect()
Expand Down