Remove preinvocation hook in Azure Functions (#1067)

This commit is contained in:
Hector Hernandez 2023-01-18 13:44:37 -08:00 коммит произвёл GitHub
Родитель db4425b610
Коммит f5869d7a31
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 16 добавлений и 15 удалений

Просмотреть файл

@ -17,14 +17,15 @@ export class AzureFunctionsHook {
constructor(client: TelemetryClient) {
this._client = client;
this._autoGenerateIncomingRequests = false;
try {
this._functionsCoreModule = require("@azure/functions-core");
}
catch (error) {
Logging.info("AzureFunctionsHook failed to load, not running in Azure Functions");
return;
}
this._addPreInvocationHook();
// TODO: Enable when all Azure Functions scenarios are covered
// try {
// this._functionsCoreModule = require("@azure/functions-core");
// }
// catch (error) {
// Logging.info("AzureFunctionsHook failed to load, not running in Azure Functions");
// return;
// }
// this._addPreInvocationHook();
}
public enable(isEnabled: boolean) {

Просмотреть файл

@ -32,13 +32,13 @@ describe("AutoCollection/AzureFunctionsHook", () => {
});
it("Hook not added if not running in Azure Functions", () => {
const spy = sandbox.spy(Logging, "info");
let hook = new AzureFunctionsHook(client);
assert.equal(hook["_functionsCoreModule"], undefined);
assert.ok(spy.called);
assert.equal(spy.args[0][0], "AzureFunctionsHook failed to load, not running in Azure Functions");
});
// it("Hook not added if not running in Azure Functions", () => {
// const spy = sandbox.spy(Logging, "info");
// let hook = new AzureFunctionsHook(client);
// assert.equal(hook["_functionsCoreModule"], undefined);
// assert.ok(spy.called);
// assert.equal(spy.args[0][0], "AzureFunctionsHook failed to load, not running in Azure Functions");
// });
it("Hook added if running in Azure Functions", () => {
let hook = new AzureFunctionsHook(client);