From 0229434cb5a3179f63c021105f36270ae7897929 Mon Sep 17 00:00:00 2001 From: drewcorlin1 <82601620+drewcorlin1@users.noreply.github.com> Date: Mon, 5 Feb 2024 07:50:03 -0500 Subject: [PATCH] feat(instrumentation): make InstrumentationAbstract.init public (#4418) * Make InstrumentationAbstract.init public * Update changelog * Update JSDoc --------- Co-authored-by: Marc Pichler --- CHANGELOG.md | 2 ++ experimental/CHANGELOG.md | 1 + .../opentelemetry-instrumentation/src/instrumentation.ts | 7 +++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b57195513..39b7300243 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/ ### :rocket: (Enhancement) +* feat(instrumentation): Make `init()` method public [#4418](https://github.com/open-telemetry/opentelemetry-js/pull/4418) + ### :bug: (Bug Fix) ### :books: (Refine Doc) diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index 6e3d38a000..5911c3af2f 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to experimental packages in this project will be documented ### :rocket: (Enhancement) +* feat(instrumentation): Make `init()` method public [#4418](https://github.com/open-telemetry/opentelemetry-js/pull/4418) * feat(exporter-metrics-otlp-http): add option to set the exporter aggregation preference [#4409](https://github.com/open-telemetry/opentelemetry-js/pull/4409) @AkselAllas * feat(node-sdk): add spanProcessors option [#4454](https://github.com/open-telemetry/opentelemetry-js/pull/4454) @naseemkullah diff --git a/experimental/packages/opentelemetry-instrumentation/src/instrumentation.ts b/experimental/packages/opentelemetry-instrumentation/src/instrumentation.ts index 4552f6dfab..13b305d13c 100644 --- a/experimental/packages/opentelemetry-instrumentation/src/instrumentation.ts +++ b/experimental/packages/opentelemetry-instrumentation/src/instrumentation.ts @@ -134,9 +134,12 @@ export abstract class InstrumentationAbstract /** * Init method in which plugin should define _modules and patches for - * methods + * methods. + * Use `enable()` if you are trying to turn on this plugin. This method + * will return objects to patch specific modules with the appropriate + * instrumentation (or not return anything). */ - protected abstract init(): + abstract init(): | InstrumentationModuleDefinition | InstrumentationModuleDefinition[] | void;