Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add instruction for pg-pool plugin #733

Merged
merged 5 commits into from
Jan 28, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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
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