diff --git a/sdk/monitor/monitor-opentelemetry/src/traces/azureFnHook.ts b/sdk/monitor/monitor-opentelemetry/src/traces/azureFnHook.ts index 6762e9120231..9ff2c71581a3 100644 --- a/sdk/monitor/monitor-opentelemetry/src/traces/azureFnHook.ts +++ b/sdk/monitor/monitor-opentelemetry/src/traces/azureFnHook.ts @@ -18,16 +18,7 @@ export class AzureFunctionsHook { try { // TODO: Add types files when publicly available this._functionsCoreModule = require("@azure/functions-core"); - // Only v3 of Azure Functions library is supported right now. See matrix of versions here: - // https://github.com/Azure/azure-functions-nodejs-library - const funcProgModel = this._functionsCoreModule.getProgrammingModel(); - if (funcProgModel.name === "@azure/functions" && funcProgModel.version.startsWith("3.")) { - this._addPreInvocationHook(); - } else { - Logger.getInstance().debug( - `AzureFunctionsHook does not support model "${funcProgModel.name}" version "${funcProgModel.version}"` - ); - } + this._addPreInvocationHook(); } catch (error) { Logger.getInstance().debug( "@azure/functions-core failed to load, not running in Azure Functions" diff --git a/sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/azureFnHook.test.ts b/sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/azureFnHook.test.ts index 338ab02bbec8..c24aadda1dbb 100644 --- a/sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/azureFnHook.test.ts +++ b/sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/azureFnHook.test.ts @@ -55,32 +55,6 @@ describe("Library/AzureFunctionsHook", () => { Module.prototype.require = originalRequire; }); - it("Hook not added if using not supported programming model", () => { - var Module = require("module"); - var preInvocationCalled = false; - Module.prototype.require = function () { - if (arguments[0] === "@azure/functions-core") { - return { - registerHook(name: string) { - if (name === "preInvocation") { - preInvocationCalled = true; - } - }, - getProgrammingModel() { - return { - name: "@azure/functions", - version: "2.x", - }; - }, - }; - } - return originalRequire.apply(this, arguments); - }; - let azureFnHook = new AzureFunctionsHook(); - assert.ok(azureFnHook, "azureFnHook"); - assert.ok(!preInvocationCalled, "preInvocationCalled"); - }); - it("Pre Invokation Hook added if running in Azure Functions and context is propagated", () => { let Module = require("module"); let preInvocationCalled = false; diff --git a/sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/sampler.test..ts b/sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/sampler.test.ts similarity index 100% rename from sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/sampler.test..ts rename to sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/sampler.test.ts