Skip to content

Commit 0bcd901

Browse files
blumamirpichlermarc
authored andcommitted
docs(instrumentation): better docs for supportedVersions option (open-telemetry#4693)
* docs(instrumentation): better docs for supportedVersions option * docs: add recomundation to bound major version * revert: Instrumentation class changes * docs: add recommendation in both places * docs: lint fix * chore: CHANGLOG * Update experimental/packages/opentelemetry-instrumentation/src/types.ts * Update experimental/packages/opentelemetry-instrumentation/src/types.ts --------- Co-authored-by: Marc Pichler <[email protected]>
1 parent 2238bf0 commit 0bcd901

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

experimental/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ All notable changes to experimental packages in this project will be documented
3131

3232
### :books: (Refine Doc)
3333

34+
* docs(instrumentation): better docs for supportedVersions option [#4693](https://github.com/open-telemetry/opentelemetry-js/pull/4693) @blumamir
3435
* docs: align all supported versions to a common format [#4696](https://github.com/open-telemetry/opentelemetry-js/pull/4696) @blumamir
3536

3637
### :house: (Internal)

experimental/packages/opentelemetry-instrumentation/src/types.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,19 @@ export interface InstrumentationModuleFile {
8888

8989
moduleExports?: unknown;
9090

91-
/** Supported version this file */
91+
/** Supported versions for the file.
92+
*
93+
* A module version is supported if one of the supportedVersions in the array satisfies the module version.
94+
* The syntax of the version is checked with the `satisfies` function of "The semantic versioner for npm", see
95+
* [`semver` package](https://www.npmjs.com/package/semver)
96+
* If the version is not supported, we won't apply instrumentation patch.
97+
* If omitted, all versions of the module will be patched.
98+
*
99+
* It is recommended to always specify a range that is bound to a major version, to avoid breaking changes.
100+
* New major versions should be reviewed and tested before being added to the supportedVersions array.
101+
*
102+
* Example: ['>=1.2.3 <3']
103+
*/
92104
supportedVersions: string[];
93105

94106
/** Method to patch the instrumentation */
@@ -108,7 +120,19 @@ export interface InstrumentationModuleDefinition {
108120
/** Instrumented module version */
109121
moduleVersion?: string;
110122

111-
/** Supported version of module */
123+
/** Supported version of module.
124+
*
125+
* A module version is supported if one of the supportedVersions in the array satisfies the module version.
126+
* The syntax of the version is checked with the `satisfies` function of "The semantic versioner for npm", see
127+
* [`semver` package](https://www.npmjs.com/package/semver)
128+
* If the version is not supported, we won't apply instrumentation patch (see `enable` method).
129+
* If omitted, all versions of the module will be patched.
130+
*
131+
* It is recommended to always specify a range that is bound to a major version, to avoid breaking changes.
132+
* New major versions should be reviewed and tested before being added to the supportedVersions array.
133+
*
134+
* Example: ['>=1.2.3 <3']
135+
*/
112136
supportedVersions: string[];
113137

114138
/** Module internal files to be patched */

0 commit comments

Comments
 (0)