node-redis (OpenTelemetry)
The AppSignal for Node.js integration with OpenTelemetry for node-redis, through the redis
package v3.0.0+.
Installation
First follow the OpenTelemetry installation instructions.
In the appsignal.js
file, disable the AppSignal Redis instrumentation by adding the instrumentRedis: false
option to the configuration.
1
2
3
4
5
6
7
8
9
// appsignal.js
// The start of the appsignal.js file, see the installation instructions
const appsignal = new Appsignal({
// Other config here
instrumentRedis: false
});
// The rest of the appsignal.js file, see the installation instructions
In the tracing.js
file, add the OpenTelemetry RedisInstrumentation to the list of instrumentations.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// tracing.js
// The start of the tracing.js file, see the installation instructions
// Add the RedisInstrumentation import
const { RedisInstrumentation } = require('@opentelemetry/instrumentation-redis');
const sdk = new opentelemetry.NodeSDK({
instrumentations: [
// Other instrumention here
// Add the RedisInstrumentation
RedisInstrumentation
]
});
// The rest of the tracing.js file, see the installation instructions
Configuration
By default the Redis instrumentation does not include any queries in the event data sent to AppSignal, only the type of query (get/set/etc).
If you want to include some sanitized query data, a dbStatementSerializer
needs to be configured. We recommend using the AppSignal dbStatementSerializer
to sanitize queries.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// tracing.js
// The start of the tracing.js file, see the installation instructions
// Add the RedisDbStatementSerializer import
const { RedisDbStatementSerializer } = require('@appsignal/nodejs');
// Add the RedisInstrumentation import
const { RedisInstrumentation } = require('@opentelemetry/instrumentation-redis');
const sdk = new opentelemetry.NodeSDK({
instrumentations: [
// Other instrumention here
// Add the RedisInstrumentation
new RedisInstrumentation({
// Configure the AppSignal RedisDbStatementSerializer to sanitize queries
dbStatementSerializer: RedisDbStatementSerializer
})
]
});
// The rest of the tracing.js file, see the installation instructions
Warning: By configuring a dbStatementSerializer
that does not sanitize Redis queries the app may send Personal Identifiable Information (PII) and other sensitive data to AppSignal. We recommend you do not send any unsanitized queries.