Remove preinvocation hook in Azure Functions (#1067)
This commit is contained in:
Родитель
db4425b610
Коммит
f5869d7a31
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче