Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose internal log poller #1674

Merged
merged 10 commits into from
Oct 1, 2021
2 changes: 2 additions & 0 deletions AISKU/Tests/applicationinsights.e2e.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ export class ApplicationInsightsTests extends TestClass {
Assert.ok(this._ai.appInsights.core, 'Core exists');
Assert.equal(true, this._ai.appInsights.core.isInitialized(),
'Core is initialized');
Assert.ok(this._ai.getInternalPollLogger, 'getInternalPollLogger exists');
Assert.ok(this._ai.getInternalPollLogger() > 0, 'getInternalPollLogger returns numeric value');
}
});
}
Expand Down
9 changes: 7 additions & 2 deletions AISKU/src/Initialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export class Initialization implements IApplicationInsights {
private properties: PropertiesPlugin;
private _sender: Sender;
private _snippetVersion: string;
private _internalLogPoller: number;

constructor(snippet: Snippet) {
let _self = this;
Expand Down Expand Up @@ -463,7 +464,7 @@ export class Initialization implements IApplicationInsights {
}

public pollInternalLogs(): void {
this.core.pollInternalLogs();
this._internalLogPoller = this.core.pollInternalLogs();
kryalama marked this conversation as resolved.
Show resolved Hide resolved
}

public addHousekeepingBeforeUnload(appInsightsInstance: IApplicationInsights): void {
Expand Down Expand Up @@ -524,10 +525,14 @@ export class Initialization implements IApplicationInsights {
return this._sender;
}

public getInternalPollLogger(): number {
return this._internalLogPoller;
}

private getSKUDefaults() {
let _self = this;
_self.config.diagnosticLogInterval =
_self.config.diagnosticLogInterval && _self.config.diagnosticLogInterval > 0 ? _self.config.diagnosticLogInterval : 10000;
_self.config.diagnosticLogInterval && _self.config.diagnosticLogInterval >= 0 ? _self.config.diagnosticLogInterval : 10000;
kryalama marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
7 changes: 6 additions & 1 deletion AISKULight/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { Sender } from "@microsoft/applicationinsights-channel-js";
export class ApplicationInsights {
public config: IConfiguration & IConfig;
private core: IAppInsightsCore;
private _internalLogPoller: number;

/**
* Creates an instance of ApplicationInsights.
Expand Down Expand Up @@ -91,13 +92,17 @@ export class ApplicationInsights {
}

private pollInternalLogs(): void {
this.core.pollInternalLogs()
this._internalLogPoller = this.core.pollInternalLogs()
}

private getSKUDefaults() {
this.config.diagnosticLogInterval =
this.config.diagnosticLogInterval && this.config.diagnosticLogInterval > 0 ? this.config.diagnosticLogInterval : 10000;
}

public getInternalPollLogger(): number {
return this._internalLogPoller;
}
}

export {
Expand Down
129 changes: 0 additions & 129 deletions common/config/rush/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.