Skip to content

Commit

Permalink
fix: pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Wolff committed Nov 12, 2019
1 parent abddfe0 commit 391326b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
29 changes: 26 additions & 3 deletions packages/opentelemetry-plugin-redis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![devDependencies][devDependencies-image]][devDependencies-url]
[![Apache License][license-image]][license-image]

This module provides automatic instrumentation for [`redis`](https://github.com/NodeRedis/node_redis).
This module provides automatic instrumentation for [`redis@^2.6.0`](https://github.com/NodeRedis/node_redis).

For automatic instrumentation see the
[@opentelemetry/node](https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-node) package.
Expand All @@ -15,14 +15,37 @@ For automatic instrumentation see the
npm install --save @opentelemetry/plugin-redis
```

### Supported Versions
- `>=2.6.0`

## Usage

OptenTelemetry Redis Instrumentation allows the user to automatically collect trace data and export them to the backend of choice, to give observability to distributed systems when working with [redis](https://www.npmjs.com/package/redis).

To load a specific plugin (**redis** in this case), specify it in the Node Tracer's configuration
```js
const { NodeTracer } = require('@opentelemetry/node');

const tracer = new NodeTracer({
plugins: {
redis: {
enabled: true,
// You may use a package name or absolute path to the file.
path: '@opentelemetry/plugin-redis',
}
}
});
```
const opentelemetry = require('@opentelemetry/plugin-redis');

// TODO: DEMONSTRATE API
To load all the [supported plugins](https://github.com/open-telemetry/opentelemetry-js#plugins), use below approach. Each plugin is only loaded when the module that it patches is loaded; in other words, there is no computational overhead for listing plugins for unused modules.
```javascript
const { NodeTracer } = require('@opentelemetry/node');

const tracer = new NodeTracer();
```

<!-- See [examples/redis](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/redis) for a short example. -->

## Useful links
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
Expand Down
1 change: 0 additions & 1 deletion packages/opentelemetry-plugin-redis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "@opentelemetry/plugin-redis",
"version": "0.2.0",
"description": "OpenTelemetry redis automatic instrumentation package.",
"private": true,
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"repository": "open-telemetry/opentelemetry-js",
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-redis/src/redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class RedisPlugin extends BasePlugin<typeof redisTypes> {
// New versions of redis (2.4+) use a single options object
// instead of named arguments
if (arguments.length === 1 && typeof cmd === 'object') {
const span = plugin._tracer.startSpan(`redis-${cmd.command}`, {
const span = plugin._tracer.startSpan(`${RedisPlugin.COMPONENT}-${cmd.command}`, {
kind: SpanKind.CLIENT,
parent: parentSpan || undefined,
attributes: {
Expand Down

0 comments on commit 391326b

Please sign in to comment.