Skip to content

Commit 01c28ae

Browse files
blumamirtrentmJamieDanielson
authored
fix!: standardize supported versions and set upper bound limit (open-telemetry#2196)
* feat(amqplib): cap supported versions to 1 * docs: update guideline with supportedVersions instructions * refactor: align all supported version to common format * chore: markdown lint * chore: markdown lint * docs: add supported versions for aws-sdk * fix(bunyan): README text * docs: update README * chore: use caret for single major version * docs: fixes to README * docs: fix example in guidelines * docs: task list in guidelines * docs: fix markdown * fix: README nits * docs: add supported versions for node internal modules * docs: remove comment from redis packages * chore: lint markdown * docs: create a script to update node dist README automatically * docs: make supportedVersions md list * ci: verify node dist readme * ci: update script name * chore: align all READMEs to use dash for list style * chore: markdown lint * fix(restify): forgotten supportedVersions * revert: remove script for auto instrumentation README generation * Update GUIDELINES.md Co-authored-by: Trent Mick <[email protected]> * Update GUIDELINES.md Co-authored-by: Trent Mick <[email protected]> * Update GUIDELINES.md Co-authored-by: Trent Mick <[email protected]> * Update plugins/node/instrumentation-amqplib/src/amqplib.ts Co-authored-by: Trent Mick <[email protected]> * fix: typo * chore: use Node.js in texts * Update GUIDELINES.md Co-authored-by: Jamie Danielson <[email protected]> * Update GUIDELINES.md Co-authored-by: Jamie Danielson <[email protected]> * Update GUIDELINES.md Co-authored-by: Jamie Danielson <[email protected]> * Update GUIDELINES.md Co-authored-by: Jamie Danielson <[email protected]> * Update GUIDELINES.md Co-authored-by: Jamie Danielson <[email protected]> * Update GUIDELINES.md Co-authored-by: Jamie Danielson <[email protected]> * Update GUIDELINES.md Co-authored-by: Jamie Danielson <[email protected]> * Update GUIDELINES.md Co-authored-by: Jamie Danielson <[email protected]> * revert: add back guideline on versioning of redis instrumentations * Update GUIDELINES.md Co-authored-by: Jamie Danielson <[email protected]> * Update GUIDELINES.md Co-authored-by: Jamie Danielson <[email protected]> * Update GUIDELINES.md Co-authored-by: Jamie Danielson <[email protected]> * Update GUIDELINES.md Co-authored-by: Jamie Danielson <[email protected]> * Update plugins/node/instrumentation-lru-memoizer/README.md Co-authored-by: Jamie Danielson <[email protected]> * Update plugins/node/opentelemetry-instrumentation-connect/README.md Co-authored-by: Jamie Danielson <[email protected]> * fix: from code review * docs: make GUIDELINES shorter * docs: align runtime metrics * fix: some fixes from code review * docs: remove quote from README * chore: replace caret range to >= < * Update GUIDELINES.md Co-authored-by: Trent Mick <[email protected]> * Update GUIDELINES.md Co-authored-by: Trent Mick <[email protected]> * docs: nit lower bound version --------- Co-authored-by: Trent Mick <[email protected]> Co-authored-by: Jamie Danielson <[email protected]>
1 parent c3afab7 commit 01c28ae

File tree

66 files changed

+211
-99
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+211
-99
lines changed

GUIDELINES.md

+78
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,84 @@ Instrumentation may add additional patch/unpatch messages for specific functions
198198
199199
The cases above are not covered by the base class and offer additional context to the user troubleshooting an issue with the instrumentation.
200200
201+
## Supported Versions
202+
203+
Supported versions can refer to 2 entities in the context of OpenTelemetry instrumentations:
204+
205+
- `Instrumented Package` - This is the user-facing package/s that the end user has installed in his application and is familiar with.
206+
- `Patched Package` - These are the packages that are being patched in practice to achieve the instrumentation goals. It may be `Instrumented Package` itself or transitive internal dependencies of the `Instrumented Package`.
207+
208+
### `Instrumented Package` Documentation
209+
210+
Instrumentation should have a "## Supported Versions" section in the README file that lists the supported versions range of the instrumented package. This range should hide and consolidate any internal implementation details like the use of internal modules, different patch logic for different versions, etc. It should focus on the relevance to the human consumer.
211+
212+
### `Patched Package`s Supported Versions
213+
214+
The packages to patch are specified in the `InstrumentationNodeModuleDefinition` and `InstrumentationNodeModuleFile` classes. Instrumentation can specify arrays with different package names and version ranges to use to implement the instrumentation logic. example use:
215+
216+
```js
217+
const supportedVersions = ['>=1.2.3 <3'];
218+
219+
protected init() {
220+
221+
const someModuleFile = new InstrumentationNodeModuleFile(
222+
'foo/lib/some-file.js',
223+
supportedVersions,
224+
myFilePatch,
225+
myFileUnpatch,
226+
);
227+
228+
const module = new InstrumentationNodeModuleDefinition(
229+
'foo',
230+
supportedVersions,
231+
myModulePatch,
232+
myModuleUnpatch,
233+
[someModuleFile]
234+
);
235+
return module
236+
}
237+
```
238+
239+
### Variations
240+
241+
There can be few variations between the instrumented package and the patched package:
242+
243+
- Single Module - instrumentation patches the same module that is instrumented.
244+
- Different Modules - instrumentation patches internal modules with different names and version ranges as of the instrumented package.
245+
- Node.js Core Modules - instrumentation patches a Node.js internal module.
246+
- Multiple Modules - instrumentation may instrument a set of (potentially large number of) user-facing instrumented packages.
247+
- Patch Logic - instrumentation may use the `moduleExports` to patch, or hooks up to other mechanisms for recording signals. examples are: Node.js diagnostics channel, patching globals (like `window` being patched in browser instrumentations, or patches arbitrary lambda function handlers, etc.
248+
249+
### Range Specification
250+
251+
For versions that are a closed range, instrumentations should prefer to specify the supported versions of the instrumented package as `>=x.y.z <w` to promote consistency and readability across the code-base.
252+
253+
If an instrumentation supports just one major version of the instrumented package, it can specify the version range as `^x.y.z` or `^x`, which are equivalent but more readable.
254+
255+
Instrumentation should use an upper and lower bounds for the version ranges it uses for patches. This is to ensure that any new major versions of the instrumented package are not automatically patched by the instrumentation, which could lead to unexpected behavior.
256+
257+
New major versions should be reviewed and tested before being added to the supported versions list.
258+
259+
Specific guidelines for different cases:
260+
261+
- For `Different Modules`, instrumentations can use an upper limit on patched packages but it is unknown which future versions of the instrumented package will continue to use it. Thus it is ok to use an open upper limit, for example `>=1.2.3`, for the instrumented package.
262+
- For `Node.js Core Modules`, the supported versions range is set to `['*']` to advertise that the instrumentation is compatible with all versions of Node.js that OpenTelemetry supports.
263+
- For `Multiple Modules`, the supported versions range should be specified for each module in the README file with the supported versions.
264+
- For `Different Patch Logic`, the use of supported versions can sometimes be more flexible, and the README should specify useful versioning information.
265+
266+
### Add New Supported Versions
267+
268+
When a new major version of the instrumented package is released, renovate bot will open a PR in contrib which helps maintainers to become aware of it. The instrumentation maintainer should review the new version and check compatibility with existing code. It can then be added to the supported versions list to be released in the next version of the instrumentation.
269+
270+
Checklist for adding a new version to the supported versions list:
271+
272+
- [ ] Review which functions are patched by the instrumentation and if they were changed in the new version that need support in code.
273+
- [ ] Check for breaking changes in the new version that could affect the instrumentation.
274+
- [ ] Test the instrumentation with the new version to ensure it works as expected.
275+
- [ ] Update the supported versions list in the instrumentation code, perhaps with different patches and additional `InstrumentationNodeModuleDefinition`s that target the new version.
276+
- [ ] Update the README file to reflect the support for new versions.
277+
- [ ] For instrumentations that use test-all-versions `.tav.yml`, add the new version to the list of versions to test.
278+
201279
## package.json
202280
203281
### Description

packages/winston-transport/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const logger = winston.createLogger({
5151

5252
### Supported versions
5353

54-
Winston `3.x`
54+
- [`winston`](https://www.npmjs.com/package/winston) versions `>=3.0.0 <4`
5555

5656
## Useful links
5757

plugins/node/instrumentation-amqplib/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ npm install --save @opentelemetry/instrumentation-amqplib
1717

1818
## Supported Versions
1919

20-
- `>=0.5.5`
20+
- [`amqplib`](https://www.npmjs.com/package/amqplib) versions `>=0.5.5 <1`
2121

2222
## Usage
2323

plugins/node/instrumentation-amqplib/src/amqplib.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ import {
7474
} from './utils';
7575
import { PACKAGE_NAME, PACKAGE_VERSION } from './version';
7676

77+
const supportedVersions = ['>=0.5.5 <1'];
78+
7779
export class AmqplibInstrumentation extends InstrumentationBase {
7880
protected override _config!: AmqplibInstrumentationConfig;
7981

@@ -92,28 +94,28 @@ export class AmqplibInstrumentation extends InstrumentationBase {
9294
protected init() {
9395
const channelModelModuleFile = new InstrumentationNodeModuleFile(
9496
'amqplib/lib/channel_model.js',
95-
['>=0.5.5'],
97+
supportedVersions,
9698
this.patchChannelModel.bind(this),
9799
this.unpatchChannelModel.bind(this)
98100
);
99101

100102
const callbackModelModuleFile = new InstrumentationNodeModuleFile(
101103
'amqplib/lib/callback_model.js',
102-
['>=0.5.5'],
104+
supportedVersions,
103105
this.patchChannelModel.bind(this),
104106
this.unpatchChannelModel.bind(this)
105107
);
106108

107109
const connectModuleFile = new InstrumentationNodeModuleFile(
108110
'amqplib/lib/connect.js',
109-
['>=0.5.5'],
111+
supportedVersions,
110112
this.patchConnect.bind(this),
111113
this.unpatchConnect.bind(this)
112114
);
113115

114116
const module = new InstrumentationNodeModuleDefinition(
115117
'amqplib',
116-
['>=0.5.5'],
118+
supportedVersions,
117119
undefined,
118120
undefined,
119121
[channelModelModuleFile, connectModuleFile, callbackModelModuleFile]

plugins/node/instrumentation-cucumber/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Compatible with OpenTelemetry JS API and SDK `1.0+`.
1515
npm install --save @opentelemetry/instrumentation-cucumber
1616
```
1717

18+
## Supported Versions
19+
20+
- [`@cucumber/cucumber`](https://www.npmjs.com/package/@cucumber/cucumber) versions `>=8.0.0 <11`
21+
1822
## Usage
1923

2024
```js

plugins/node/instrumentation-cucumber/src/instrumentation.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ type Cucumber = typeof cucumber;
4646
type Hook = (typeof hooks)[number];
4747
type Step = (typeof steps)[number];
4848

49+
const supportedVersions = ['>=8.0.0 <11'];
50+
4951
export class CucumberInstrumentation extends InstrumentationBase {
5052
private module: Cucumber | undefined;
5153

@@ -57,7 +59,7 @@ export class CucumberInstrumentation extends InstrumentationBase {
5759
return [
5860
new InstrumentationNodeModuleDefinition(
5961
'@cucumber/cucumber',
60-
['^8.0.0', '^9.0.0', '^10.0.0'],
62+
supportedVersions,
6163
(moduleExports: Cucumber) => {
6264
this.module = moduleExports;
6365
steps.forEach(step => {
@@ -83,7 +85,7 @@ export class CucumberInstrumentation extends InstrumentationBase {
8385
[
8486
new InstrumentationNodeModuleFile(
8587
'@cucumber/cucumber/lib/runtime/test_case_runner.js',
86-
['^8.0.0', '^9.0.0', '^10.0.0'],
88+
supportedVersions,
8789
moduleExports => {
8890
if (isWrapped(moduleExports.default.prototype.run)) {
8991
this._unwrap(moduleExports.default.prototype, 'run');

plugins/node/instrumentation-dataloader/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Compatible with OpenTelemetry JS API and SDK `1.0+`.
1515
npm install --save @opentelemetry/instrumentation-dataloader
1616
```
1717

18-
### Supported Versions
18+
## Supported Versions
1919

20-
- `^2.0.0`
20+
- [`dataloader`](https://www.npmjs.com/package/dataloader) versions `>=2.0.0 <3`
2121

2222
## Usage
2323

plugins/node/instrumentation-dataloader/src/instrumentation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class DataloaderInstrumentation extends InstrumentationBase {
5252
return [
5353
new InstrumentationNodeModuleDefinition(
5454
MODULE_NAME,
55-
['^2.0.0'],
55+
['>=2.0.0 <3'],
5656
dataloader => {
5757
this._patchLoad(dataloader.prototype);
5858
this._patchLoadMany(dataloader.prototype);

plugins/node/instrumentation-fs/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ See the full list of instrumented functions in [constants.ts](src/constants.ts);
1717
npm install --save @opentelemetry/instrumentation-fs
1818
```
1919

20+
## Supported Versions
21+
22+
- Node.js `>=14`
23+
2024
## Usage
2125

2226
```js

plugins/node/instrumentation-kafkajs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ npm install --save @opentelemetry/instrumentation-kafkajs
1717

1818
### Supported versions
1919

20-
- `<3.0.0`
20+
- [`kafkajs`](https://www.npmjs.com/package/kafkajs) versions `>=0.1.0 <3`
2121

2222
## Usage
2323

plugins/node/instrumentation-kafkajs/src/instrumentation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class KafkaJsInstrumentation extends InstrumentationBase {
7272

7373
const module = new InstrumentationNodeModuleDefinition(
7474
'kafkajs',
75-
['< 3'],
75+
['>=0.1.0 <3'],
7676
(moduleExports: typeof kafkaJs) => {
7777
unpatch(moduleExports);
7878
this._wrap(

plugins/node/instrumentation-lru-memoizer/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ npm install --save @opentelemetry/instrumentation-lru-memoizer
1717

1818
## Supported Versions
1919

20-
- `>=1.3 <3`
20+
- [`lru-memorizer`](https://www.npmjs.com/package/lru-memoizer) versions `>=1.3.0 <3`
2121

2222
## Usage
2323

plugins/node/instrumentation-mongoose/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ npm install --save @opentelemetry/instrumentation-mongoose
1717

1818
## Supported Versions
1919

20-
- `>=5.9.7 <7`
20+
- [`mongoose`](https://www.npmjs.com/package/mongoose) versions `>=5.9.7 <7`
2121

2222
## Usage
2323

plugins/node/instrumentation-runtime-node/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
This module provides automatic metric instrumentation that exposes measurements from the [Performance measurement APIs](https://nodejs.org/api/perf_hooks.html) (i.e. `perf_hooks`).
77
While currently it is limited to metrics, it may be modified to produce other signals in the future.
88

9+
## Supported Versions
10+
11+
- Node.js `>=14.10`
12+
13+
<!-- - 14.6.0 - this package uses _private properties_ -->
14+
915
## Example
1016

1117
```bash
@@ -58,12 +64,6 @@ nodejs_performance_event_loop_utilization 0.010140079547955264
5864
|---|---|---|---|---|
5965
| [`eventLoopUtilizationMeasurementInterval`](./src/types.ts#L25) | `int` | millisecond | `5000` | The approximate number of milliseconds for which to calculate event loop utilization averages. A larger value will result in more accurate averages at the expense of less granular data. Should be set to below the scrape interval of your metrics collector to avoid duplicated data points. |
6066
61-
## Supported Node.js versions
62-
63-
v14.10.0+
64-
65-
<!-- - 14.6.0 - this package uses _private properties_ -->
66-
6767
## Useful links
6868
6969
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>

plugins/node/instrumentation-socket.io/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ npm install --save @opentelemetry/instrumentation-socket.io
1717

1818
## Supported Versions
1919

20-
- `>=2 <5`
20+
- [socket.io](https://www.npmjs.com/package/socket.io) versions `>=2.0.0 <5`
2121

2222
## Usage
2323

plugins/node/instrumentation-tedious/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ npm install --save @opentelemetry/instrumentation-tedious
1717

1818
## Supported Versions
1919

20-
- `>=1.11.0 <=17`
20+
- [tedious](https://www.npmjs.com/package/tedious) `>=1.11.0 <18`
2121

2222
## Usage
2323

plugins/node/instrumentation-undici/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ npm install --save @opentelemetry/instrumentation-undici
1616

1717
## Supported Versions
1818

19-
- `undici@>=5.12.0`
19+
- [`undici`](https://www.npmjs.com/package/undici) version `>=5.12.0`
2020

2121
## Usage
2222

plugins/node/opentelemetry-instrumentation-aws-lambda/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Compatible with OpenTelemetry JS API and SDK `1.0+`.
1919
npm install --save @opentelemetry/instrumentation-aws-lambda
2020
```
2121

22+
## Supported Versions
23+
24+
- This package will instrument the lambda execution regardless of versions.
25+
2226
## Usage
2327

2428
Create a file to initialize the instrumentation, such as `lambda-wrapper.js`.

plugins/node/opentelemetry-instrumentation-aws-sdk/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ If total installation size is not constrained, it is recommended to use the [`@o
1515
npm install --save @opentelemetry/instrumentation-aws-sdk
1616
```
1717

18+
## Supported Versions
19+
20+
- [`aws-sdk`](https://www.npmjs.com/package/aws-sdk) versions `>=2.308.0 <3`
21+
- `@aws-sdk/client-*` versions `>=3.0.0 <4`
22+
1823
## Usage
1924

2025
For further automatic instrumentation instruction see the [@opentelemetry/instrumentation](https://www.npmjs.com/package/@opentelemetry/instrumentation) package.

plugins/node/opentelemetry-instrumentation-bunyan/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ npm install --save @opentelemetry/instrumentation-bunyan
1717

1818
## Supported Versions
1919

20-
- `bunyan@^1.0.0`
20+
- [`bunyan`](https://www.npmjs.com/package/bunyan) versions `>=1.0.0 <2`
2121

2222
## Usage
2323

plugins/node/opentelemetry-instrumentation-bunyan/src/instrumentation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class BunyanInstrumentation extends InstrumentationBase {
4545
return [
4646
new InstrumentationNodeModuleDefinition(
4747
'bunyan',
48-
['<2.0'],
48+
['>=1.0.0 <2'],
4949
(module: any) => {
5050
const instrumentation = this;
5151
const Logger =

plugins/node/opentelemetry-instrumentation-cassandra/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Compatible with OpenTelemetry JS API and SDK `1.0+`.
1515
npm install --save @opentelemetry/instrumentation-cassandra-driver
1616
```
1717

18+
### Supported Versions
19+
20+
- [`cassandra-driver`](https://www.npmjs.com/package/cassandra-driver) versions `>=4.4.0 <5`
21+
1822
## Usage
1923

2024
```js
@@ -45,10 +49,6 @@ await client.execute('select * from foo');
4549
| `responseHook` | `CassandraDriverResponseCustomAttributeFunction` | `undefined` | Hook for adding custom attributes before response is handled |
4650
| `maxQueryLength` | `number` | `65536` | If `enhancedDatabaseReporting` is enabled, limits the attached query strings to this length. |
4751

48-
### Supported versions
49-
50-
`>=4.4 <5.0`
51-
5252
## Semantic Conventions
5353

5454
This package uses `@opentelemetry/semantic-conventions` version `1.22+`, which implements Semantic Convention [Version 1.7.0](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/semantic_conventions/README.md)

plugins/node/opentelemetry-instrumentation-cassandra/src/instrumentation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import { PACKAGE_NAME, PACKAGE_VERSION } from './version';
4343
import { EventEmitter } from 'events';
4444
import type * as CassandraDriver from 'cassandra-driver';
4545

46-
const supportedVersions = ['>=4.4 <5.0'];
46+
const supportedVersions = ['>=4.4.0 <5'];
4747

4848
export class CassandraDriverInstrumentation extends InstrumentationBase {
4949
protected override _config!: CassandraDriverInstrumentationConfig;

plugins/node/opentelemetry-instrumentation-connect/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ npm install --save @opentelemetry/instrumentation-http @opentelemetry/instrument
2323

2424
### Supported Versions
2525

26-
- `^3.0.0`
26+
- [`connect`](https://www.npmjs.com/package/connect) versions `>=3.0.0 <4`
2727

2828
## Usage
2929

plugins/node/opentelemetry-instrumentation-connect/src/instrumentation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class ConnectInstrumentation extends InstrumentationBase {
5050
return [
5151
new InstrumentationNodeModuleDefinition(
5252
'connect',
53-
['^3.0.0'],
53+
['>=3.0.0 <4'],
5454
moduleExports => {
5555
return this._patchConstructor(moduleExports);
5656
}

0 commit comments

Comments
 (0)