Skip to content

Commit

Permalink
chore: add instruction for pg-pool plugin (#733)
Browse files Browse the repository at this point in the history
* chore: add instruction for pg-pool plugin

* chore: update NodeTracer to NodeTracerRegistry

* chore: address comments

Co-authored-by: Valentin Marchaud <[email protected]>
Co-authored-by: Daniel Dyla <[email protected]>
  • Loading branch information
3 people committed Jan 28, 2020
1 parent 53dda64 commit 8711f2b
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 26 deletions.
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-grpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const registry = new NodeTracerRegistry({
});
```

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.
To load all of 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 { NodeTracerRegistry } = require('@opentelemetry/node');

Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const registry = new NodeTracerRegistry({
});
```

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.
To load all of 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.
```js
const { NodeTracerRegistry } = require('@opentelemetry/node');

Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-https/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const registry = new NodeTracerRegistry({
});
```

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.
To load all of 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.
```js
const { NodeTracerRegistry } = require('@opentelemetry/node');

Expand Down
10 changes: 5 additions & 5 deletions packages/opentelemetry-plugin-ioredis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ npm install --save @opentelemetry/plugin-ioredis

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

const tracer = new NodeTracer({
const registry = new NodeTracerRegistry({
plugins: {
ioredis: {
enabled: true,
Expand All @@ -35,11 +35,11 @@ const tracer = new NodeTracer({
});
```

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.
To load all of 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 { NodeTracerRegistry } = require('@opentelemetry/node');

const tracer = new NodeTracer();
const registry = new NodeTracerRegistry();
```

## Useful links
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-mongodb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const registry = new NodeTracerRegistry({
});
```

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.
To load all of 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.
```js
const { NodeTracerRegistry } = require('@opentelemetry/node');

Expand Down
10 changes: 5 additions & 5 deletions packages/opentelemetry-plugin-mysql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ OpenTelemetry MySQL Instrumentation allows the user to automatically collect tra

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

const tracer = new NodeTracer({
const registry = new NodeTracerRegistry({
plugins: {
mysql: {
enabled: true,
Expand All @@ -37,11 +37,11 @@ const tracer = new NodeTracer({
});
```

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.
To load all of 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.
```js
const { NodeTracer } = require('@opentelemetry/node');
const { NodeTracerRegistry } = require('@opentelemetry/node');

const tracer = new NodeTracer();
const registry = new NodeTracerRegistry();
```

See [examples/mysql](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/mysql) for a short example.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,47 @@ For automatic instrumentation see the
## Installation

```bash
npm install --save @opentelemetry/plugin-pg
npm install --save @opentelemetry/plugin-pg-pool
```

## Usage

To load all of the [default supported plugins](https://github.com/open-telemetry/opentelemetry-js#plugins), use the 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.

```js
const opentelemetry = require('@opentelemetry/plugin-pg-pool');
const { NodeTracerRegistry } = require('@opentelemetry/node');

// TODO: DEMONSTRATE API
const registry = new NodeTracerRegistry(); // All default plugins will be used
```

If instead you would just want to load a specific plugin (**pg** and **pg-pool** in this case), specify it in the `NodeTracer` configuration. You'll need to install both plugins for full functionality.

```js
const { NodeTracerRegistry } = require('@opentelemetry/node');

const registry = new NodeTracerRegistry({
plugins: {
pg: {
enabled: true,
// You may use a package name or absolute path to the module
path: '@opentelemetry/plugin-pg',
},
'pg-pool': {
enabled: true,
// You may use a package name or absolute path to the module
path: '@opentelemetry/plugin-pg-pool',
}
}
});
```

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

## Supported Versions

- [pg](https://npmjs.com/package/pg-pool): `2.x`
- [pg](https://npmjs.com/package/pg): `7.x`
- [pg-pool](https://npmjs.com/package/pg-pool): `2.x`

## Useful links
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ npm install --save @opentelemetry/plugin-pg-pool

## Usage

To load all of the [default supported plugins](https://github.com/open-telemetry/opentelemetry-js#plugins), use the 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 plugsin for unused modules.
To load all of the [default supported plugins](https://github.com/open-telemetry/opentelemetry-js#plugins), use the 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.

```js
const { NodeTracer } = require('@opentelemetry/node');
const { NodeTracerRegistry } = require('@opentelemetry/node');

const tracer = new NodeTracer(); // All default plugins will be used
const registry = new NodeTracerRegistry(); // All default plugins will be used
```

If instead you would just load a specific plugin (**pg** in this case), specify it in the `NodeTracer` configuration.
If instead you would just want to load a specific plugin (**pg** in this case), specify it in the `NodeTracer` configuration.

```js
const { NodeTracer } = require('@opentelemetry/node');
const { NodeTracerRegistry } = require('@opentelemetry/node');

const tracer = new NodeTracer({
const registry = new NodeTracerRegistry({
plugins: {
pg: {
enabled: true,
Expand All @@ -45,9 +45,9 @@ const tracer = new NodeTracer({
If you are using any of the [`pg.Pool`](https://node-postgres.com/api/pool) APIs, you will also need to include the [`pg-pool` plugin](../opentelemetry-plugin-pg-pool).

```js
const { NodeTracer } = require('@opentelemetry/node');
const { NodeTracerRegistry } = require('@opentelemetry/node');

const tracer = new NodeTracer({
const registry = new NodeTracerRegistry({
plugins: {
pg: {
enabled: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-redis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const registry = new NodeTracerRegistry({
});
```

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.
To load all of 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 { NodeTracerRegistry } = require('@opentelemetry/node');

Expand Down

0 comments on commit 8711f2b

Please sign in to comment.