@microsoft/applicationinsights-analytics-js 2.8.0-nightly.2202-06 → 2.8.0-nightly.2204-06
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/applicationinsights-analytics-js.integrity.json +9 -9
- package/browser/applicationinsights-analytics-js.js +1917 -1142
- package/browser/applicationinsights-analytics-js.js.map +1 -1
- package/browser/applicationinsights-analytics-js.min.js +2 -2
- package/browser/applicationinsights-analytics-js.min.js.map +1 -1
- package/dist/applicationinsights-analytics-js.api.json +138 -229
- package/dist/applicationinsights-analytics-js.api.md +8 -18
- package/dist/applicationinsights-analytics-js.d.ts +9 -104
- package/dist/applicationinsights-analytics-js.js +1917 -1142
- package/dist/applicationinsights-analytics-js.js.map +1 -1
- package/dist/applicationinsights-analytics-js.min.js +2 -2
- package/dist/applicationinsights-analytics-js.min.js.map +1 -1
- package/dist/applicationinsights-analytics-js.rollup.d.ts +9 -104
- package/dist-esm/JavaScriptSDK/AnalyticsPlugin.js +674 -0
- package/dist-esm/JavaScriptSDK/AnalyticsPlugin.js.map +1 -0
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js +24 -11
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js +15 -14
- package/dist-esm/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Telemetry/PageVisitTimeManager.js +10 -10
- package/dist-esm/JavaScriptSDK/Telemetry/PageVisitTimeManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Timing.js +39 -0
- package/dist-esm/JavaScriptSDK/Timing.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryConfig.js +1 -1
- package/dist-esm/applicationinsights-analytics-js.js +2 -2
- package/dist-esm/applicationinsights-analytics-js.js.map +1 -1
- package/package.json +6 -6
- package/src/JavaScriptSDK/{ApplicationInsights.ts → AnalyticsPlugin.ts} +420 -342
- package/src/JavaScriptSDK/Telemetry/PageViewManager.ts +39 -20
- package/src/JavaScriptSDK/Telemetry/PageViewPerformanceManager.ts +19 -17
- package/src/JavaScriptSDK/Telemetry/PageVisitTimeManager.ts +6 -6
- package/src/JavaScriptSDK/Timing.ts +46 -0
- package/src/applicationinsights-analytics-js.ts +1 -1
- package/types/JavaScriptSDK/{ApplicationInsights.d.ts → AnalyticsPlugin.d.ts} +12 -16
- package/types/JavaScriptSDK/Telemetry/PageViewManager.d.ts +2 -1
- package/types/JavaScriptSDK/Telemetry/PageViewPerformanceManager.d.ts +9 -9
- package/types/JavaScriptSDK/Telemetry/PageVisitTimeManager.d.ts +4 -4
- package/types/JavaScriptSDK/Timing.d.ts +18 -0
- package/types/applicationinsights-analytics-js.d.ts +1 -1
- package/types/tsdoc-metadata.json +1 -1
- package/dist-esm/JavaScriptSDK/ApplicationInsights.js +0 -606
- package/dist-esm/JavaScriptSDK/ApplicationInsights.js.map +0 -1
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
dateTimeUtilsDuration, IPageViewTelemetry, IPageViewTelemetryInternal, IPageViewPerformanceTelemetryInternal
|
|
6
6
|
} from "@microsoft/applicationinsights-common";
|
|
7
7
|
import {
|
|
8
|
-
IAppInsightsCore, IDiagnosticLogger,
|
|
9
|
-
|
|
8
|
+
IAppInsightsCore, IDiagnosticLogger, eLoggingSeverity,
|
|
9
|
+
_eInternalMessageId, getDocument, getLocation, arrForEach, isNullOrUndefined, getExceptionName, dumpObj, IProcessTelemetryUnloadContext, ITelemetryUnloadState, _throwInternal
|
|
10
10
|
} from "@microsoft/applicationinsights-core-js";
|
|
11
11
|
import { PageViewPerformanceManager } from "./PageViewPerformanceManager";
|
|
12
12
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
@@ -25,10 +25,10 @@ export interface IAppInsightsInternal {
|
|
|
25
25
|
export class PageViewManager {
|
|
26
26
|
|
|
27
27
|
constructor(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
appInsights: IAppInsightsInternal,
|
|
29
|
+
overridePageViewDuration: boolean,
|
|
30
|
+
core: IAppInsightsCore,
|
|
31
|
+
pageViewPerformanceManager: PageViewPerformanceManager) {
|
|
32
32
|
|
|
33
33
|
dynamicProto(PageViewManager, this, (_self) => {
|
|
34
34
|
let intervalHandle: any = null;
|
|
@@ -40,11 +40,9 @@ export class PageViewManager {
|
|
|
40
40
|
_logger = core.logger;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
function _flushChannels() {
|
|
43
|
+
function _flushChannels(isAsync: boolean) {
|
|
44
44
|
if (core) {
|
|
45
|
-
|
|
46
|
-
arrForEach(queues, q => q.flush(true))
|
|
47
|
-
});
|
|
45
|
+
core.flush(isAsync);
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
48
|
|
|
@@ -72,7 +70,7 @@ export class PageViewManager {
|
|
|
72
70
|
|
|
73
71
|
if (doFlush) {
|
|
74
72
|
// We process at least one item so flush the queue
|
|
75
|
-
_flushChannels();
|
|
73
|
+
_flushChannels(true);
|
|
76
74
|
}
|
|
77
75
|
}), 100);
|
|
78
76
|
}
|
|
@@ -99,12 +97,12 @@ export class PageViewManager {
|
|
|
99
97
|
pageView,
|
|
100
98
|
customProperties
|
|
101
99
|
);
|
|
102
|
-
_flushChannels();
|
|
100
|
+
_flushChannels(true);
|
|
103
101
|
|
|
104
102
|
// no navigation timing (IE 8, iOS Safari 8.4, Opera Mini 8 - see http://caniuse.com/#feat=nav-timing)
|
|
105
|
-
_logger
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
_throwInternal(_logger,
|
|
104
|
+
eLoggingSeverity.WARNING,
|
|
105
|
+
_eInternalMessageId.NavigationTimingNotSupported,
|
|
108
106
|
"trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.");
|
|
109
107
|
|
|
110
108
|
return;
|
|
@@ -143,7 +141,7 @@ export class PageViewManager {
|
|
|
143
141
|
pageView,
|
|
144
142
|
customProperties
|
|
145
143
|
);
|
|
146
|
-
_flushChannels();
|
|
144
|
+
_flushChannels(true);
|
|
147
145
|
pageViewSent = true;
|
|
148
146
|
}
|
|
149
147
|
|
|
@@ -198,16 +196,33 @@ export class PageViewManager {
|
|
|
198
196
|
}
|
|
199
197
|
}
|
|
200
198
|
} catch (e) {
|
|
201
|
-
_logger
|
|
202
|
-
|
|
203
|
-
|
|
199
|
+
_throwInternal(_logger,
|
|
200
|
+
eLoggingSeverity.CRITICAL,
|
|
201
|
+
_eInternalMessageId.TrackPVFailedCalc,
|
|
204
202
|
"trackPageView failed on page load calculation: " + getExceptionName(e),
|
|
205
203
|
{ exception: dumpObj(e) });
|
|
206
204
|
}
|
|
207
205
|
|
|
208
206
|
return processed;
|
|
209
207
|
});
|
|
210
|
-
}
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
_self.teardown = (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => {
|
|
211
|
+
if (intervalHandle) {
|
|
212
|
+
clearInterval(intervalHandle);
|
|
213
|
+
intervalHandle = null;
|
|
214
|
+
|
|
215
|
+
let allItems = itemQueue.slice(0);
|
|
216
|
+
let doFlush = false;
|
|
217
|
+
itemQueue = [];
|
|
218
|
+
arrForEach(allItems, (item) => {
|
|
219
|
+
if (item()) {
|
|
220
|
+
doFlush = true;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
|
|
211
226
|
});
|
|
212
227
|
}
|
|
213
228
|
|
|
@@ -224,4 +239,8 @@ export class PageViewManager {
|
|
|
224
239
|
public trackPageView(pageView: IPageViewTelemetry, customProperties?: { [key: string]: any }) {
|
|
225
240
|
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
226
241
|
}
|
|
242
|
+
|
|
243
|
+
public teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) {
|
|
244
|
+
// @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
|
|
245
|
+
}
|
|
227
246
|
}
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
IPageViewPerformanceTelemetryInternal, dateTimeUtilsDuration, msToTimeSpan
|
|
6
6
|
} from "@microsoft/applicationinsights-common";
|
|
7
7
|
import {
|
|
8
|
-
IAppInsightsCore, IDiagnosticLogger,
|
|
9
|
-
|
|
8
|
+
IAppInsightsCore, IDiagnosticLogger, eLoggingSeverity,
|
|
9
|
+
_eInternalMessageId, getNavigator, getPerformance, _throwInternal
|
|
10
10
|
} from "@microsoft/applicationinsights-core-js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -74,26 +74,28 @@ export class PageViewPerformanceManager {
|
|
|
74
74
|
dom = dateTimeUtilsDuration(timing.responseEnd, timing.loadEventEnd);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
let logger = this._logger;
|
|
78
|
+
|
|
77
79
|
if (total === 0) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
_throwInternal(logger,
|
|
81
|
+
eLoggingSeverity.WARNING,
|
|
82
|
+
_eInternalMessageId.ErrorPVCalc,
|
|
81
83
|
"error calculating page view performance.",
|
|
82
84
|
{ total, network, request, response, dom });
|
|
83
85
|
|
|
84
86
|
} else if (!this.shouldCollectDuration(total, network, request, response, dom)) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
_throwInternal(logger,
|
|
88
|
+
eLoggingSeverity.WARNING,
|
|
89
|
+
_eInternalMessageId.InvalidDurationValue,
|
|
88
90
|
"Invalid page load duration value. Browser perf data won't be sent.",
|
|
89
91
|
{ total, network, request, response, dom });
|
|
90
92
|
|
|
91
93
|
} else if (total < Math.floor(network) + Math.floor(request) + Math.floor(response) + Math.floor(dom)) {
|
|
92
94
|
// some browsers may report individual components incorrectly so that the sum of the parts will be bigger than total PLT
|
|
93
95
|
// in this case, don't report client performance from this page
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
_throwInternal(logger,
|
|
97
|
+
eLoggingSeverity.WARNING,
|
|
98
|
+
_eInternalMessageId.ClientPerformanceMathError,
|
|
97
99
|
"client performance math error.",
|
|
98
100
|
{ total, network, request, response, dom });
|
|
99
101
|
|
|
@@ -125,15 +127,15 @@ export class PageViewPerformanceManager {
|
|
|
125
127
|
return null;
|
|
126
128
|
}
|
|
127
129
|
|
|
128
|
-
|
|
130
|
+
/**
|
|
129
131
|
* Returns true is window PerformanceNavigationTiming API is supported, false otherwise.
|
|
130
132
|
*/
|
|
131
|
-
|
|
133
|
+
public isPerformanceNavigationTimingSupported() {
|
|
132
134
|
let perf = getPerformance();
|
|
133
135
|
return perf && perf.getEntriesByType && perf.getEntriesByType("navigation").length > 0;
|
|
134
|
-
}
|
|
136
|
+
}
|
|
135
137
|
|
|
136
|
-
|
|
138
|
+
/**
|
|
137
139
|
* Returns true is window performance timing API is supported, false otherwise.
|
|
138
140
|
*/
|
|
139
141
|
public isPerformanceTimingSupported() {
|
|
@@ -141,7 +143,7 @@ export class PageViewPerformanceManager {
|
|
|
141
143
|
return perf && perf.timing;
|
|
142
144
|
}
|
|
143
145
|
|
|
144
|
-
|
|
146
|
+
/**
|
|
145
147
|
* As page loads different parts of performance timing numbers get set. When all of them are set we can report it.
|
|
146
148
|
* Returns true if ready, false otherwise.
|
|
147
149
|
*/
|
|
@@ -160,7 +162,7 @@ export class PageViewPerformanceManager {
|
|
|
160
162
|
&& timing.domLoading > 0;
|
|
161
163
|
}
|
|
162
164
|
|
|
163
|
-
|
|
165
|
+
/**
|
|
164
166
|
* This method tells if given durations should be excluded from collection.
|
|
165
167
|
*/
|
|
166
168
|
public shouldCollectDuration(...durations: number[]): boolean {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
import { utlCanUseSessionStorage, utlGetSessionStorage, utlRemoveSessionStorage, utlSetSessionStorage } from "@microsoft/applicationinsights-common";
|
|
5
|
-
import { IDiagnosticLogger, hasJSON, getJSON, dateNow, dumpObj, throwError } from "@microsoft/applicationinsights-core-js";
|
|
5
|
+
import { IDiagnosticLogger, hasJSON, getJSON, dateNow, dumpObj, throwError, _warnToConsole } from "@microsoft/applicationinsights-core-js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Used to track page visit durations
|
|
@@ -23,7 +23,7 @@ export class PageVisitTimeManager {
|
|
|
23
23
|
this._logger = logger;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
27
|
* Tracks the previous page visit time telemetry (if exists) and starts timing of new page visit time
|
|
28
28
|
* @param currentPageName Name of page to begin timing for visit duration
|
|
29
29
|
* @param currentPageUrl Url of page to begin timing for visit duration
|
|
@@ -39,7 +39,7 @@ export class PageVisitTimeManager {
|
|
|
39
39
|
this.pageVisitTimeTrackingHandler(prevPageVisitTimeData.pageName, prevPageVisitTimeData.pageUrl, prevPageVisitTimeData.pageVisitTime);
|
|
40
40
|
}
|
|
41
41
|
} catch (e) {
|
|
42
|
-
this._logger
|
|
42
|
+
_warnToConsole(this._logger, "Auto track page visit time failed, metric will not be collected: " + dumpObj(e));
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -55,7 +55,7 @@ export class PageVisitTimeManager {
|
|
|
55
55
|
|
|
56
56
|
return prevPageVisitData;
|
|
57
57
|
} catch (e) {
|
|
58
|
-
this._logger
|
|
58
|
+
_warnToConsole(this._logger, "Call to restart failed: " + dumpObj(e));
|
|
59
59
|
return null;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -78,7 +78,7 @@ export class PageVisitTimeManager {
|
|
|
78
78
|
}
|
|
79
79
|
} catch (e) {
|
|
80
80
|
// TODO: Remove this catch in next phase, since if start is called twice in a row the exception needs to be propagated out
|
|
81
|
-
this._logger
|
|
81
|
+
_warnToConsole(this._logger, "Call to start failed: " + dumpObj(e));
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -113,7 +113,7 @@ export class PageVisitTimeManager {
|
|
|
113
113
|
}
|
|
114
114
|
return null;
|
|
115
115
|
} catch (e) {
|
|
116
|
-
this._logger
|
|
116
|
+
_warnToConsole(this._logger, "Stop page visit timer failed: " + dumpObj(e));
|
|
117
117
|
return null;
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import { dateTimeUtilsDuration } from "@microsoft/applicationinsights-common";
|
|
5
|
+
import { IDiagnosticLogger, eLoggingSeverity, _eInternalMessageId, _throwInternal } from "@microsoft/applicationinsights-core-js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Used to record timed events and page views.
|
|
9
|
+
*/
|
|
10
|
+
export class Timing {
|
|
11
|
+
|
|
12
|
+
public action: (name?: string, url?: string, duration?: number, properties?: { [key: string]: string }, measurements?: { [key: string]: number }) => void;
|
|
13
|
+
public start: (name: string) => void;
|
|
14
|
+
public stop: (name: string, url: string, properties?: { [key: string]: string }, measurements?: { [key: string]: number }) => void;
|
|
15
|
+
|
|
16
|
+
constructor(logger: IDiagnosticLogger, name: string) {
|
|
17
|
+
let _self = this;
|
|
18
|
+
let _events: { [key: string]: number; } = {}
|
|
19
|
+
|
|
20
|
+
_self.start = (name: string) => {
|
|
21
|
+
if (typeof _events[name] !== "undefined") {
|
|
22
|
+
_throwInternal(logger,
|
|
23
|
+
eLoggingSeverity.WARNING, _eInternalMessageId.StartCalledMoreThanOnce, "start was called more than once for this event without calling stop.",
|
|
24
|
+
{ name, key: name }, true);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
_events[name] = +new Date;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
_self.stop = (name: string, url: string, properties?: { [key: string]: string }, measurements?: { [key: string]: number }) => {
|
|
31
|
+
const start = _events[name];
|
|
32
|
+
if (isNaN(start)) {
|
|
33
|
+
_throwInternal(logger,
|
|
34
|
+
eLoggingSeverity.WARNING, _eInternalMessageId.StopCalledWithoutStart, "stop was called without a corresponding start.",
|
|
35
|
+
{ name, key: name }, true);
|
|
36
|
+
} else {
|
|
37
|
+
const end = +new Date;
|
|
38
|
+
const duration = dateTimeUtilsDuration(start, end);
|
|
39
|
+
_self.action(name, url, duration, properties, measurements);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
delete _events[name];
|
|
43
|
+
_events[name] = undefined;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
-
export { ApplicationInsights } from "./JavaScriptSDK/
|
|
4
|
+
export { AnalyticsPlugin, AnalyticsPlugin as ApplicationInsights } from "./JavaScriptSDK/AnalyticsPlugin";
|
|
5
5
|
export { IAppInsightsInternal } from "./JavaScriptSDK/Telemetry/PageViewManager";
|
|
@@ -3,22 +3,17 @@
|
|
|
3
3
|
* @copyright Microsoft 2018
|
|
4
4
|
*/
|
|
5
5
|
import { IConfig, IAppInsights, IEventTelemetry, IExceptionTelemetry, ITraceTelemetry, IMetricTelemetry, IAutoExceptionTelemetry, IPageViewTelemetryInternal, IPageViewTelemetry, IPageViewPerformanceTelemetry, IPageViewPerformanceTelemetryInternal } from "@microsoft/applicationinsights-common";
|
|
6
|
-
import { IPlugin, IConfiguration, IAppInsightsCore, BaseTelemetryPlugin, ITelemetryItem, IProcessTelemetryContext, ITelemetryPluginChain, ICustomProperties, ICookieMgr } from "@microsoft/applicationinsights-core-js";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare class ApplicationInsights extends BaseTelemetryPlugin implements IAppInsights, IAppInsightsInternal {
|
|
6
|
+
import { IPlugin, IConfiguration, IAppInsightsCore, BaseTelemetryPlugin, ITelemetryItem, IProcessTelemetryContext, ITelemetryPluginChain, ICustomProperties, ICookieMgr, ITelemetryInitializerHandler } from "@microsoft/applicationinsights-core-js";
|
|
7
|
+
import { IAppInsightsInternal } from "./Telemetry/PageViewManager";
|
|
8
|
+
declare function _getDefaultConfig(config?: IConfig): IConfig;
|
|
9
|
+
export declare class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights, IAppInsightsInternal {
|
|
11
10
|
static Version: string;
|
|
12
|
-
static getDefaultConfig
|
|
11
|
+
static getDefaultConfig: typeof _getDefaultConfig;
|
|
13
12
|
identifier: string;
|
|
14
13
|
priority: number;
|
|
15
14
|
config: IConfig;
|
|
16
15
|
queue: Array<() => void>;
|
|
17
16
|
autoRoutePVDelay: number;
|
|
18
|
-
protected _telemetryInitializers: Array<(envelope: ITelemetryItem) => boolean | void>;
|
|
19
|
-
protected _pageViewManager: PageViewManager;
|
|
20
|
-
protected _pageViewPerformanceManager: PageViewPerformanceManager;
|
|
21
|
-
protected _pageVisitTimeManager: PageVisitTimeManager;
|
|
22
17
|
constructor();
|
|
23
18
|
/**
|
|
24
19
|
* Get the current cookie manager for this instance
|
|
@@ -116,11 +111,11 @@ export declare class ApplicationInsights extends BaseTelemetryPlugin implements
|
|
|
116
111
|
[key: string]: number;
|
|
117
112
|
}): void;
|
|
118
113
|
/**
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
114
|
+
* @ignore INTERNAL ONLY
|
|
115
|
+
* @param exception
|
|
116
|
+
* @param properties
|
|
117
|
+
* @param systemProperties
|
|
118
|
+
*/
|
|
124
119
|
sendExceptionInternal(exception: IExceptionTelemetry, customProperties?: {
|
|
125
120
|
[key: string]: any;
|
|
126
121
|
}, systemProperties?: {
|
|
@@ -142,6 +137,7 @@ export declare class ApplicationInsights extends BaseTelemetryPlugin implements
|
|
|
142
137
|
* @memberof ApplicationInsights
|
|
143
138
|
*/
|
|
144
139
|
_onerror(exception: IAutoExceptionTelemetry): void;
|
|
145
|
-
addTelemetryInitializer(telemetryInitializer: (item: ITelemetryItem) => boolean | void): void;
|
|
140
|
+
addTelemetryInitializer(telemetryInitializer: (item: ITelemetryItem) => boolean | void): ITelemetryInitializerHandler | void;
|
|
146
141
|
initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
147
142
|
}
|
|
143
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IPageViewTelemetry, IPageViewTelemetryInternal, IPageViewPerformanceTelemetryInternal } from "@microsoft/applicationinsights-common";
|
|
2
|
-
import { IAppInsightsCore } from "@microsoft/applicationinsights-core-js";
|
|
2
|
+
import { IAppInsightsCore, IProcessTelemetryUnloadContext, ITelemetryUnloadState } from "@microsoft/applicationinsights-core-js";
|
|
3
3
|
import { PageViewPerformanceManager } from "./PageViewPerformanceManager";
|
|
4
4
|
/**
|
|
5
5
|
* Internal interface to pass appInsights object to subcomponents without coupling
|
|
@@ -26,4 +26,5 @@ export declare class PageViewManager {
|
|
|
26
26
|
trackPageView(pageView: IPageViewTelemetry, customProperties?: {
|
|
27
27
|
[key: string]: any;
|
|
28
28
|
}): void;
|
|
29
|
+
teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void;
|
|
29
30
|
}
|
|
@@ -11,20 +11,20 @@ export declare class PageViewPerformanceManager {
|
|
|
11
11
|
getPerformanceTiming(): PerformanceTiming | null;
|
|
12
12
|
getPerformanceNavigationTiming(): PerformanceNavigationTiming | null;
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
* Returns true is window PerformanceNavigationTiming API is supported, false otherwise.
|
|
15
|
+
*/
|
|
16
16
|
isPerformanceNavigationTimingSupported(): boolean;
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
* Returns true is window performance timing API is supported, false otherwise.
|
|
19
|
+
*/
|
|
20
20
|
isPerformanceTimingSupported(): PerformanceTiming;
|
|
21
21
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
* As page loads different parts of performance timing numbers get set. When all of them are set we can report it.
|
|
23
|
+
* Returns true if ready, false otherwise.
|
|
24
|
+
*/
|
|
25
25
|
isPerformanceTimingDataReady(): boolean;
|
|
26
26
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
* This method tells if given durations should be excluded from collection.
|
|
28
|
+
*/
|
|
29
29
|
shouldCollectDuration(...durations: number[]): boolean;
|
|
30
30
|
}
|
|
@@ -13,10 +13,10 @@ export declare class PageVisitTimeManager {
|
|
|
13
13
|
*/
|
|
14
14
|
constructor(logger: IDiagnosticLogger, pageVisitTimeTrackingHandler: (pageName: string, pageUrl: string, pageVisitTime: number) => void);
|
|
15
15
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
* Tracks the previous page visit time telemetry (if exists) and starts timing of new page visit time
|
|
17
|
+
* @param currentPageName Name of page to begin timing for visit duration
|
|
18
|
+
* @param currentPageUrl Url of page to begin timing for visit duration
|
|
19
|
+
*/
|
|
20
20
|
trackPreviousPageVisit(currentPageName: string, currentPageUrl: string): void;
|
|
21
21
|
/**
|
|
22
22
|
* Stops timing of current page (if exists) and starts timing for duration of visit to pageName
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IDiagnosticLogger } from "@microsoft/applicationinsights-core-js";
|
|
2
|
+
/**
|
|
3
|
+
* Used to record timed events and page views.
|
|
4
|
+
*/
|
|
5
|
+
export declare class Timing {
|
|
6
|
+
action: (name?: string, url?: string, duration?: number, properties?: {
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
}, measurements?: {
|
|
9
|
+
[key: string]: number;
|
|
10
|
+
}) => void;
|
|
11
|
+
start: (name: string) => void;
|
|
12
|
+
stop: (name: string, url: string, properties?: {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
}, measurements?: {
|
|
15
|
+
[key: string]: number;
|
|
16
|
+
}) => void;
|
|
17
|
+
constructor(logger: IDiagnosticLogger, name: string);
|
|
18
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ApplicationInsights } from "./JavaScriptSDK/
|
|
1
|
+
export { AnalyticsPlugin, AnalyticsPlugin as ApplicationInsights } from "./JavaScriptSDK/AnalyticsPlugin";
|
|
2
2
|
export { IAppInsightsInternal } from "./JavaScriptSDK/Telemetry/PageViewManager";
|