Skip to content

Commit 8711f2b

Browse files
xiao-lixvmarchauddyladan
committed
chore: add instruction for pg-pool plugin (open-telemetry#733)
* chore: add instruction for pg-pool plugin * chore: update NodeTracer to NodeTracerRegistry * chore: address comments Co-authored-by: Valentin Marchaud <thisismac47@gmail.com> Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
1 parent 53dda64 commit 8711f2b

9 files changed

Lines changed: 53 additions & 26 deletions

File tree

packages/opentelemetry-plugin-grpc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const registry = new NodeTracerRegistry({
3535
});
3636
```
3737

38-
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.
38+
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.
3939
```javascript
4040
const { NodeTracerRegistry } = require('@opentelemetry/node');
4141

packages/opentelemetry-plugin-http/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const registry = new NodeTracerRegistry({
3636
});
3737
```
3838

39-
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.
39+
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.
4040
```js
4141
const { NodeTracerRegistry } = require('@opentelemetry/node');
4242

packages/opentelemetry-plugin-https/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const registry = new NodeTracerRegistry({
3636
});
3737
```
3838

39-
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.
39+
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.
4040
```js
4141
const { NodeTracerRegistry } = require('@opentelemetry/node');
4242

packages/opentelemetry-plugin-ioredis/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ npm install --save @opentelemetry/plugin-ioredis
2222

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

27-
const tracer = new NodeTracer({
27+
const registry = new NodeTracerRegistry({
2828
plugins: {
2929
ioredis: {
3030
enabled: true,
@@ -35,11 +35,11 @@ const tracer = new NodeTracer({
3535
});
3636
```
3737

38-
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.
38+
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.
3939
```javascript
40-
const { NodeTracer } = require('@opentelemetry/node');
40+
const { NodeTracerRegistry } = require('@opentelemetry/node');
4141

42-
const tracer = new NodeTracer();
42+
const registry = new NodeTracerRegistry();
4343
```
4444

4545
## Useful links

packages/opentelemetry-plugin-mongodb/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const registry = new NodeTracerRegistry({
3636
});
3737
```
3838

39-
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.
39+
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.
4040
```js
4141
const { NodeTracerRegistry } = require('@opentelemetry/node');
4242

packages/opentelemetry-plugin-mysql/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ OpenTelemetry MySQL Instrumentation allows the user to automatically collect tra
2424

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

29-
const tracer = new NodeTracer({
29+
const registry = new NodeTracerRegistry({
3030
plugins: {
3131
mysql: {
3232
enabled: true,
@@ -37,11 +37,11 @@ const tracer = new NodeTracer({
3737
});
3838
```
3939

40-
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.
40+
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.
4141
```js
42-
const { NodeTracer } = require('@opentelemetry/node');
42+
const { NodeTracerRegistry } = require('@opentelemetry/node');
4343

44-
const tracer = new NodeTracer();
44+
const registry = new NodeTracerRegistry();
4545
```
4646

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

packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg-pool/README.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,47 @@ For automatic instrumentation see the
1212
## Installation
1313

1414
```bash
15+
npm install --save @opentelemetry/plugin-pg
1516
npm install --save @opentelemetry/plugin-pg-pool
1617
```
1718

1819
## Usage
1920

21+
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.
22+
2023
```js
21-
const opentelemetry = require('@opentelemetry/plugin-pg-pool');
24+
const { NodeTracerRegistry } = require('@opentelemetry/node');
2225

23-
// TODO: DEMONSTRATE API
26+
const registry = new NodeTracerRegistry(); // All default plugins will be used
2427
```
2528

29+
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.
30+
31+
```js
32+
const { NodeTracerRegistry } = require('@opentelemetry/node');
33+
34+
const registry = new NodeTracerRegistry({
35+
plugins: {
36+
pg: {
37+
enabled: true,
38+
// You may use a package name or absolute path to the module
39+
path: '@opentelemetry/plugin-pg',
40+
},
41+
'pg-pool': {
42+
enabled: true,
43+
// You may use a package name or absolute path to the module
44+
path: '@opentelemetry/plugin-pg-pool',
45+
}
46+
}
47+
});
48+
```
49+
50+
See [examples/postgres](https://github.com/open-telemetry/opentelemetry-js/tree/master/examples/postgres) for a short example.
51+
2652
## Supported Versions
2753

28-
- [pg](https://npmjs.com/package/pg-pool): `2.x`
54+
- [pg](https://npmjs.com/package/pg): `7.x`
55+
- [pg-pool](https://npmjs.com/package/pg-pool): `2.x`
2956

3057
## Useful links
3158
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>

packages/opentelemetry-plugin-postgres/opentelemetry-plugin-pg/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ npm install --save @opentelemetry/plugin-pg-pool
1818

1919
## Usage
2020

21-
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.
21+
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.
2222

2323
```js
24-
const { NodeTracer } = require('@opentelemetry/node');
24+
const { NodeTracerRegistry } = require('@opentelemetry/node');
2525

26-
const tracer = new NodeTracer(); // All default plugins will be used
26+
const registry = new NodeTracerRegistry(); // All default plugins will be used
2727
```
2828

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

3131
```js
32-
const { NodeTracer } = require('@opentelemetry/node');
32+
const { NodeTracerRegistry } = require('@opentelemetry/node');
3333

34-
const tracer = new NodeTracer({
34+
const registry = new NodeTracerRegistry({
3535
plugins: {
3636
pg: {
3737
enabled: true,
@@ -45,9 +45,9 @@ const tracer = new NodeTracer({
4545
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).
4646

4747
```js
48-
const { NodeTracer } = require('@opentelemetry/node');
48+
const { NodeTracerRegistry } = require('@opentelemetry/node');
4949

50-
const tracer = new NodeTracer({
50+
const registry = new NodeTracerRegistry({
5151
plugins: {
5252
pg: {
5353
enabled: true,

packages/opentelemetry-plugin-redis/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const registry = new NodeTracerRegistry({
3737
});
3838
```
3939

40-
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.
40+
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.
4141
```javascript
4242
const { NodeTracerRegistry } = require('@opentelemetry/node');
4343

0 commit comments

Comments
 (0)