@textback/notification-widget 2.0.3 → 2.0.4-110500
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/build/index.js +12 -0
- package/{release/builds/textback/notificationwidget/build → build}/sdk.js +2 -2
- package/package.json +2 -2
- package/src/widget/components/tb-notification-widget/index.js +22 -6
- package/src/widget/components/tb-nw-wahunter/index.js +4 -2
- package/src/widget/icons/tb-logo-dark-en.svg +17 -0
- package/src/widget/icons/tb-logo-dark-ru.svg +17 -0
- package/src/widget/icons/tb-logo-dark.svg +16 -0
- package/src/widget/icons/tb-logo-light-en.svg +17 -0
- package/src/widget/icons/tb-logo-light-ru.svg +17 -0
- package/src/widget/icons/tb-logo-white.svg +16 -0
- package/src/widget/icons/tb-logo.svg +15 -20
- package/release/builds/textback/notificationwidget/.eslintrc.js +0 -291
- package/release/builds/textback/notificationwidget/.gitlab-ci.yml +0 -34
- package/release/builds/textback/notificationwidget/build/index.js +0 -12
- package/release/builds/textback/notificationwidget/package-lock.json +0 -9985
- package/release/builds/textback/notificationwidget/package.json +0 -70
- package/release/builds/textback/notificationwidget/promote_tag.sh +0 -2
- package/release/builds/textback/notificationwidget/readme.md +0 -569
- package/release/builds/textback/notificationwidget/server.js +0 -224
- package/release/builds/textback/notificationwidget/src/libraries/ai.1.0.11.js +0 -4089
- package/release/builds/textback/notificationwidget/src/libraries/localization/getLocale.js +0 -17
- package/release/builds/textback/notificationwidget/src/libraries/localization/locales/.tern-port +0 -1
- package/release/builds/textback/notificationwidget/src/libraries/localization/locales/cs.js +0 -23
- package/release/builds/textback/notificationwidget/src/libraries/localization/locales/en.js +0 -23
- package/release/builds/textback/notificationwidget/src/libraries/localization/locales/index.js +0 -9
- package/release/builds/textback/notificationwidget/src/libraries/localization/locales/pl.js +0 -23
- package/release/builds/textback/notificationwidget/src/libraries/localization/locales/ro.js +0 -23
- package/release/builds/textback/notificationwidget/src/libraries/localization/locales/ru.js +0 -22
- package/release/builds/textback/notificationwidget/src/libraries/localization/locales/uk.js +0 -23
- package/release/builds/textback/notificationwidget/src/libraries/localization/text.js +0 -9
- package/release/builds/textback/notificationwidget/src/libraries/t.js +0 -82
- package/release/builds/textback/notificationwidget/src/sdk/channels/channel.js +0 -31
- package/release/builds/textback/notificationwidget/src/sdk/channels/facebook.js +0 -13
- package/release/builds/textback/notificationwidget/src/sdk/channels/factory.js +0 -34
- package/release/builds/textback/notificationwidget/src/sdk/channels/skype.js +0 -13
- package/release/builds/textback/notificationwidget/src/sdk/channels/telegram.js +0 -18
- package/release/builds/textback/notificationwidget/src/sdk/channels/viber.js +0 -13
- package/release/builds/textback/notificationwidget/src/sdk/channels/vk-modal/vk-modal.html +0 -17
- package/release/builds/textback/notificationwidget/src/sdk/channels/vk-modal/vk-modal.js +0 -25
- package/release/builds/textback/notificationwidget/src/sdk/channels/vk-modal/vk-modal.scss +0 -116
- package/release/builds/textback/notificationwidget/src/sdk/channels/vk.js +0 -195
- package/release/builds/textback/notificationwidget/src/sdk/channels/whatsapp.js +0 -27
- package/release/builds/textback/notificationwidget/src/sdk/channels/whatsappb.js +0 -27
- package/release/builds/textback/notificationwidget/src/sdk/events/observer.js +0 -46
- package/release/builds/textback/notificationwidget/src/sdk/index.js +0 -6
- package/release/builds/textback/notificationwidget/src/sdk/sdk.entry.js +0 -1
- package/release/builds/textback/notificationwidget/src/sdk/sdk.js +0 -67
- package/release/builds/textback/notificationwidget/src/sdk/utils/apiErrorHandler.js +0 -12
- package/release/builds/textback/notificationwidget/src/sdk/utils/appInsights.js +0 -88
- package/release/builds/textback/notificationwidget/src/sdk/utils/browserInfo.js +0 -9
- package/release/builds/textback/notificationwidget/src/sdk/utils/constants.js +0 -18
- package/release/builds/textback/notificationwidget/src/sdk/utils/cookies.js +0 -67
- package/release/builds/textback/notificationwidget/src/sdk/utils/find.js +0 -8
- package/release/builds/textback/notificationwidget/src/sdk/utils/loadConfig.js +0 -21
- package/release/builds/textback/notificationwidget/src/sdk/utils/loadDeepLink.js +0 -48
- package/release/builds/textback/notificationwidget/src/sdk/utils/loadScript.js +0 -26
- package/release/builds/textback/notificationwidget/src/sdk/utils/loadSubscriptions.js +0 -6
- package/release/builds/textback/notificationwidget/src/sdk/utils/parseQueryString.js +0 -34
- package/release/builds/textback/notificationwidget/src/sdk/utils/windowHelper.js +0 -25
- package/release/builds/textback/notificationwidget/src/sdk/widget/widget.js +0 -192
- package/release/builds/textback/notificationwidget/src/widget/components/index.js +0 -52
- package/release/builds/textback/notificationwidget/src/widget/components/tb-notification-button/facebook.js +0 -55
- package/release/builds/textback/notificationwidget/src/widget/components/tb-notification-button/index.js +0 -35
- package/release/builds/textback/notificationwidget/src/widget/components/tb-notification-button/styles.scss +0 -657
- package/release/builds/textback/notificationwidget/src/widget/components/tb-notification-button/telegram.js +0 -55
- package/release/builds/textback/notificationwidget/src/widget/components/tb-notification-button/viber.js +0 -57
- package/release/builds/textback/notificationwidget/src/widget/components/tb-notification-button/vk.js +0 -92
- package/release/builds/textback/notificationwidget/src/widget/components/tb-notification-button/whatsapp.js +0 -58
- package/release/builds/textback/notificationwidget/src/widget/components/tb-notification-button/whatsappb.js +0 -58
- package/release/builds/textback/notificationwidget/src/widget/components/tb-notification-widget/index.js +0 -678
- package/release/builds/textback/notificationwidget/src/widget/components/tb-notification-widget/normalize.scss +0 -395
- package/release/builds/textback/notificationwidget/src/widget/components/tb-notification-widget/styles.scss +0 -543
- package/release/builds/textback/notificationwidget/src/widget/components/tb-nw-wahunter/index.js +0 -259
- package/release/builds/textback/notificationwidget/src/widget/components/tb-nw-wahunter/styles.scss +0 -471
- package/release/builds/textback/notificationwidget/src/widget/config.js +0 -5
- package/release/builds/textback/notificationwidget/src/widget/icons/bell-icon.png +0 -0
- package/release/builds/textback/notificationwidget/src/widget/icons/broadcast-icon.png +0 -0
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_chat_window.svg +0 -1
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_close.svg +0 -1
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_facebook.svg +0 -7
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_facebook_circle.svg +0 -7
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_instagram_circle.svg +0 -96
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_skype.svg +0 -44
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_skype_circle.svg +0 -46
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_skype_new.svg +0 -114
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_tg.svg +0 -25
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_tg_circle.svg +0 -17
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_viber.svg +0 -75
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_viber_circle.svg +0 -67
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_viber_new.svg +0 -102
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_vk.svg +0 -14
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_vk_circle.svg +0 -16
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_whatsapp.svg +0 -147
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_whatsapp_circle.svg +0 -4
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_whatsapp_hollow.svg +0 -128
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_whatsapp_new.svg +0 -127
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_whatsappb.svg +0 -147
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_whatsappb_circle.svg +0 -4
- package/release/builds/textback/notificationwidget/src/widget/icons/icon_whatsappb_new.svg +0 -127
- package/release/builds/textback/notificationwidget/src/widget/icons/paper-plane-arrow.svg +0 -3
- package/release/builds/textback/notificationwidget/src/widget/icons/paper-plane-icon.png +0 -0
- package/release/builds/textback/notificationwidget/src/widget/icons/tb-logo.svg +0 -21
- package/release/builds/textback/notificationwidget/src/widget/index.js +0 -29
- package/release/builds/textback/notificationwidget/src/widget/locales/cs.js +0 -42
- package/release/builds/textback/notificationwidget/src/widget/locales/en.js +0 -42
- package/release/builds/textback/notificationwidget/src/widget/locales/index.js +0 -9
- package/release/builds/textback/notificationwidget/src/widget/locales/pl.js +0 -42
- package/release/builds/textback/notificationwidget/src/widget/locales/ro.js +0 -41
- package/release/builds/textback/notificationwidget/src/widget/locales/ru.js +0 -41
- package/release/builds/textback/notificationwidget/src/widget/locales/uk.js +0 -41
- package/release/builds/textback/notificationwidget/src/widget/utils/cookiesEx.js +0 -41
- package/release/builds/textback/notificationwidget/src/widget/utils/getLocale.js +0 -17
- package/release/builds/textback/notificationwidget/src/widget/utils/stringifyAttributes.js +0 -19
- package/release/builds/textback/notificationwidget/src/widget/utils/text.js +0 -10
- package/release/builds/textback/notificationwidget/src/widget/utils/widgetsStorage.js +0 -28
- package/release/builds/textback/notificationwidget/src/widget/widget.entry.js +0 -3
- package/release/builds/textback/notificationwidget/tests/gf.html +0 -35
- package/release/builds/textback/notificationwidget/tests/gf.js +0 -22
- package/release/builds/textback/notificationwidget/tests/index.js +0 -62
- package/release/builds/textback/notificationwidget/views/examples.ejs +0 -51
- package/release/builds/textback/notificationwidget/views/sdk.html +0 -274
- package/release/builds/textback/notificationwidget/webpack.common.js +0 -72
- package/release/builds/textback/notificationwidget/webpack.dev.js +0 -15
- package/release/builds/textback/notificationwidget/webpack.prod.js +0 -10
- package/widget.tar.gz +0 -0
|
@@ -1,4089 +0,0 @@
|
|
|
1
|
-
//!!!ES5 syntax
|
|
2
|
-
//patched version to work without garbage in global scope - by textback team - search for textback in code to see what changed
|
|
3
|
-
window.TextBack = window.TextBack || {};
|
|
4
|
-
// window.TextBack.NotificationWidget = window.TextBack.NotificationWidget || {};
|
|
5
|
-
// var context = window.TextBack.NotificationWidget;
|
|
6
|
-
var context = window.TextBack;
|
|
7
|
-
//textback end
|
|
8
|
-
var __extends = (this && this.__extends) || function (d, b) {
|
|
9
|
-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
10
|
-
function __() { this.constructor = d; }
|
|
11
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
-
};
|
|
13
|
-
var Microsoft;
|
|
14
|
-
(function (Microsoft) {
|
|
15
|
-
var ApplicationInsights;
|
|
16
|
-
(function (ApplicationInsights) {
|
|
17
|
-
(function (LoggingSeverity) {
|
|
18
|
-
LoggingSeverity[LoggingSeverity["CRITICAL"] = 0] = "CRITICAL";
|
|
19
|
-
LoggingSeverity[LoggingSeverity["WARNING"] = 1] = "WARNING";
|
|
20
|
-
})(ApplicationInsights.LoggingSeverity || (ApplicationInsights.LoggingSeverity = {}));
|
|
21
|
-
var LoggingSeverity = ApplicationInsights.LoggingSeverity;
|
|
22
|
-
(function (_InternalMessageId) {
|
|
23
|
-
_InternalMessageId[_InternalMessageId["BrowserDoesNotSupportLocalStorage"] = 0] = "BrowserDoesNotSupportLocalStorage";
|
|
24
|
-
_InternalMessageId[_InternalMessageId["BrowserCannotReadLocalStorage"] = 1] = "BrowserCannotReadLocalStorage";
|
|
25
|
-
_InternalMessageId[_InternalMessageId["BrowserCannotReadSessionStorage"] = 2] = "BrowserCannotReadSessionStorage";
|
|
26
|
-
_InternalMessageId[_InternalMessageId["BrowserCannotWriteLocalStorage"] = 3] = "BrowserCannotWriteLocalStorage";
|
|
27
|
-
_InternalMessageId[_InternalMessageId["BrowserCannotWriteSessionStorage"] = 4] = "BrowserCannotWriteSessionStorage";
|
|
28
|
-
_InternalMessageId[_InternalMessageId["BrowserFailedRemovalFromLocalStorage"] = 5] = "BrowserFailedRemovalFromLocalStorage";
|
|
29
|
-
_InternalMessageId[_InternalMessageId["BrowserFailedRemovalFromSessionStorage"] = 6] = "BrowserFailedRemovalFromSessionStorage";
|
|
30
|
-
_InternalMessageId[_InternalMessageId["CannotSendEmptyTelemetry"] = 7] = "CannotSendEmptyTelemetry";
|
|
31
|
-
_InternalMessageId[_InternalMessageId["ClientPerformanceMathError"] = 8] = "ClientPerformanceMathError";
|
|
32
|
-
_InternalMessageId[_InternalMessageId["ErrorParsingAISessionCookie"] = 9] = "ErrorParsingAISessionCookie";
|
|
33
|
-
_InternalMessageId[_InternalMessageId["ErrorPVCalc"] = 10] = "ErrorPVCalc";
|
|
34
|
-
_InternalMessageId[_InternalMessageId["ExceptionWhileLoggingError"] = 11] = "ExceptionWhileLoggingError";
|
|
35
|
-
_InternalMessageId[_InternalMessageId["FailedAddingTelemetryToBuffer"] = 12] = "FailedAddingTelemetryToBuffer";
|
|
36
|
-
_InternalMessageId[_InternalMessageId["FailedMonitorAjaxAbort"] = 13] = "FailedMonitorAjaxAbort";
|
|
37
|
-
_InternalMessageId[_InternalMessageId["FailedMonitorAjaxDur"] = 14] = "FailedMonitorAjaxDur";
|
|
38
|
-
_InternalMessageId[_InternalMessageId["FailedMonitorAjaxOpen"] = 15] = "FailedMonitorAjaxOpen";
|
|
39
|
-
_InternalMessageId[_InternalMessageId["FailedMonitorAjaxRSC"] = 16] = "FailedMonitorAjaxRSC";
|
|
40
|
-
_InternalMessageId[_InternalMessageId["FailedMonitorAjaxSend"] = 17] = "FailedMonitorAjaxSend";
|
|
41
|
-
_InternalMessageId[_InternalMessageId["FailedToAddHandlerForOnBeforeUnload"] = 18] = "FailedToAddHandlerForOnBeforeUnload";
|
|
42
|
-
_InternalMessageId[_InternalMessageId["FailedToSendQueuedTelemetry"] = 19] = "FailedToSendQueuedTelemetry";
|
|
43
|
-
_InternalMessageId[_InternalMessageId["FailedToReportDataLoss"] = 20] = "FailedToReportDataLoss";
|
|
44
|
-
_InternalMessageId[_InternalMessageId["FlushFailed"] = 21] = "FlushFailed";
|
|
45
|
-
_InternalMessageId[_InternalMessageId["MessageLimitPerPVExceeded"] = 22] = "MessageLimitPerPVExceeded";
|
|
46
|
-
_InternalMessageId[_InternalMessageId["MissingRequiredFieldSpecification"] = 23] = "MissingRequiredFieldSpecification";
|
|
47
|
-
_InternalMessageId[_InternalMessageId["NavigationTimingNotSupported"] = 24] = "NavigationTimingNotSupported";
|
|
48
|
-
_InternalMessageId[_InternalMessageId["OnError"] = 25] = "OnError";
|
|
49
|
-
_InternalMessageId[_InternalMessageId["SessionRenewalDateIsZero"] = 26] = "SessionRenewalDateIsZero";
|
|
50
|
-
_InternalMessageId[_InternalMessageId["SenderNotInitialized"] = 27] = "SenderNotInitialized";
|
|
51
|
-
_InternalMessageId[_InternalMessageId["StartTrackEventFailed"] = 28] = "StartTrackEventFailed";
|
|
52
|
-
_InternalMessageId[_InternalMessageId["StopTrackEventFailed"] = 29] = "StopTrackEventFailed";
|
|
53
|
-
_InternalMessageId[_InternalMessageId["StartTrackFailed"] = 30] = "StartTrackFailed";
|
|
54
|
-
_InternalMessageId[_InternalMessageId["StopTrackFailed"] = 31] = "StopTrackFailed";
|
|
55
|
-
_InternalMessageId[_InternalMessageId["TelemetrySampledAndNotSent"] = 32] = "TelemetrySampledAndNotSent";
|
|
56
|
-
_InternalMessageId[_InternalMessageId["TrackEventFailed"] = 33] = "TrackEventFailed";
|
|
57
|
-
_InternalMessageId[_InternalMessageId["TrackExceptionFailed"] = 34] = "TrackExceptionFailed";
|
|
58
|
-
_InternalMessageId[_InternalMessageId["TrackMetricFailed"] = 35] = "TrackMetricFailed";
|
|
59
|
-
_InternalMessageId[_InternalMessageId["TrackPVFailed"] = 36] = "TrackPVFailed";
|
|
60
|
-
_InternalMessageId[_InternalMessageId["TrackPVFailedCalc"] = 37] = "TrackPVFailedCalc";
|
|
61
|
-
_InternalMessageId[_InternalMessageId["TrackTraceFailed"] = 38] = "TrackTraceFailed";
|
|
62
|
-
_InternalMessageId[_InternalMessageId["TransmissionFailed"] = 39] = "TransmissionFailed";
|
|
63
|
-
_InternalMessageId[_InternalMessageId["FailedToSetStorageBuffer"] = 40] = "FailedToSetStorageBuffer";
|
|
64
|
-
_InternalMessageId[_InternalMessageId["FailedToRestoreStorageBuffer"] = 41] = "FailedToRestoreStorageBuffer";
|
|
65
|
-
_InternalMessageId[_InternalMessageId["InvalidBackendResponse"] = 42] = "InvalidBackendResponse";
|
|
66
|
-
_InternalMessageId[_InternalMessageId["FailedToFixDepricatedValues"] = 43] = "FailedToFixDepricatedValues";
|
|
67
|
-
_InternalMessageId[_InternalMessageId["InvalidDurationValue"] = 44] = "InvalidDurationValue";
|
|
68
|
-
_InternalMessageId[_InternalMessageId["CannotSerializeObject"] = 45] = "CannotSerializeObject";
|
|
69
|
-
_InternalMessageId[_InternalMessageId["CannotSerializeObjectNonSerializable"] = 46] = "CannotSerializeObjectNonSerializable";
|
|
70
|
-
_InternalMessageId[_InternalMessageId["CircularReferenceDetected"] = 47] = "CircularReferenceDetected";
|
|
71
|
-
_InternalMessageId[_InternalMessageId["ClearAuthContextFailed"] = 48] = "ClearAuthContextFailed";
|
|
72
|
-
_InternalMessageId[_InternalMessageId["ExceptionTruncated"] = 49] = "ExceptionTruncated";
|
|
73
|
-
_InternalMessageId[_InternalMessageId["IllegalCharsInName"] = 50] = "IllegalCharsInName";
|
|
74
|
-
_InternalMessageId[_InternalMessageId["ItemNotInArray"] = 51] = "ItemNotInArray";
|
|
75
|
-
_InternalMessageId[_InternalMessageId["MaxAjaxPerPVExceeded"] = 52] = "MaxAjaxPerPVExceeded";
|
|
76
|
-
_InternalMessageId[_InternalMessageId["MessageTruncated"] = 53] = "MessageTruncated";
|
|
77
|
-
_InternalMessageId[_InternalMessageId["NameTooLong"] = 54] = "NameTooLong";
|
|
78
|
-
_InternalMessageId[_InternalMessageId["SampleRateOutOfRange"] = 55] = "SampleRateOutOfRange";
|
|
79
|
-
_InternalMessageId[_InternalMessageId["SetAuthContextFailed"] = 56] = "SetAuthContextFailed";
|
|
80
|
-
_InternalMessageId[_InternalMessageId["SetAuthContextFailedAccountName"] = 57] = "SetAuthContextFailedAccountName";
|
|
81
|
-
_InternalMessageId[_InternalMessageId["StringValueTooLong"] = 58] = "StringValueTooLong";
|
|
82
|
-
_InternalMessageId[_InternalMessageId["StartCalledMoreThanOnce"] = 59] = "StartCalledMoreThanOnce";
|
|
83
|
-
_InternalMessageId[_InternalMessageId["StopCalledWithoutStart"] = 60] = "StopCalledWithoutStart";
|
|
84
|
-
_InternalMessageId[_InternalMessageId["TelemetryInitializerFailed"] = 61] = "TelemetryInitializerFailed";
|
|
85
|
-
_InternalMessageId[_InternalMessageId["TrackArgumentsNotSpecified"] = 62] = "TrackArgumentsNotSpecified";
|
|
86
|
-
_InternalMessageId[_InternalMessageId["UrlTooLong"] = 63] = "UrlTooLong";
|
|
87
|
-
_InternalMessageId[_InternalMessageId["SessionStorageBufferFull"] = 64] = "SessionStorageBufferFull";
|
|
88
|
-
_InternalMessageId[_InternalMessageId["CannotAccessCookie"] = 65] = "CannotAccessCookie";
|
|
89
|
-
})(ApplicationInsights._InternalMessageId || (ApplicationInsights._InternalMessageId = {}));
|
|
90
|
-
var _InternalMessageId = ApplicationInsights._InternalMessageId;
|
|
91
|
-
var _InternalLogMessage = (function () {
|
|
92
|
-
function _InternalLogMessage(msgId, msg, isUserAct, properties) {
|
|
93
|
-
if (isUserAct === void 0) { isUserAct = false; }
|
|
94
|
-
this.messageId = msgId;
|
|
95
|
-
this.message =
|
|
96
|
-
(isUserAct ? _InternalLogMessage.AiUserActionablePrefix : _InternalLogMessage.AiNonUserActionablePrefix) +
|
|
97
|
-
_InternalMessageId[msgId].toString();
|
|
98
|
-
var diagnosticText = (msg ? " message:" + _InternalLogMessage.sanitizeDiagnosticText(msg) : "") +
|
|
99
|
-
(properties ? " props:" + _InternalLogMessage.sanitizeDiagnosticText(JSON.stringify(properties)) : "");
|
|
100
|
-
this.message += diagnosticText;
|
|
101
|
-
}
|
|
102
|
-
_InternalLogMessage.sanitizeDiagnosticText = function (text) {
|
|
103
|
-
return "\"" + text.replace(/\"/g, "") + "\"";
|
|
104
|
-
};
|
|
105
|
-
_InternalLogMessage.AiNonUserActionablePrefix = "AI (Internal): ";
|
|
106
|
-
_InternalLogMessage.AiUserActionablePrefix = "AI: ";
|
|
107
|
-
return _InternalLogMessage;
|
|
108
|
-
}());
|
|
109
|
-
ApplicationInsights._InternalLogMessage = _InternalLogMessage;
|
|
110
|
-
var _InternalLogging = (function () {
|
|
111
|
-
function _InternalLogging() {
|
|
112
|
-
}
|
|
113
|
-
_InternalLogging.throwInternal = function (severity, msgId, msg, properties, isUserAct) {
|
|
114
|
-
if (isUserAct === void 0) { isUserAct = false; }
|
|
115
|
-
var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
|
|
116
|
-
if (this.enableDebugExceptions()) {
|
|
117
|
-
throw message;
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
if (typeof (message) !== "undefined" && !!message) {
|
|
121
|
-
if (typeof (message.message) !== "undefined") {
|
|
122
|
-
if (isUserAct) {
|
|
123
|
-
var messageKey = _InternalMessageId[message.messageId];
|
|
124
|
-
if (!this._messageLogged[messageKey] || this.verboseLogging()) {
|
|
125
|
-
this.warnToConsole(message.message);
|
|
126
|
-
this._messageLogged[messageKey] = true;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
if (this.verboseLogging()) {
|
|
131
|
-
this.warnToConsole(message.message);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
this.logInternalMessage(severity, message);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
_InternalLogging.warnToConsole = function (message) {
|
|
140
|
-
if (typeof console !== "undefined" && !!console) {
|
|
141
|
-
if (typeof console.warn === "function") {
|
|
142
|
-
console.warn(message);
|
|
143
|
-
}
|
|
144
|
-
else if (typeof console.log === "function") {
|
|
145
|
-
console.log(message);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
_InternalLogging.resetInternalMessageCount = function () {
|
|
150
|
-
this._messageCount = 0;
|
|
151
|
-
this._messageLogged = {};
|
|
152
|
-
};
|
|
153
|
-
_InternalLogging.clearInternalMessageLoggedTypes = function () {
|
|
154
|
-
if (ApplicationInsights.Util.canUseSessionStorage()) {
|
|
155
|
-
var sessionStorageKeys = ApplicationInsights.Util.getSessionStorageKeys();
|
|
156
|
-
for (var i = 0; i < sessionStorageKeys.length; i++) {
|
|
157
|
-
if (sessionStorageKeys[i].indexOf(_InternalLogging.AIInternalMessagePrefix) === 0) {
|
|
158
|
-
ApplicationInsights.Util.removeSessionStorage(sessionStorageKeys[i]);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
_InternalLogging.setMaxInternalMessageLimit = function (limit) {
|
|
164
|
-
if (!limit) {
|
|
165
|
-
throw new Error('limit cannot be undefined.');
|
|
166
|
-
}
|
|
167
|
-
this.MAX_INTERNAL_MESSAGE_LIMIT = limit;
|
|
168
|
-
};
|
|
169
|
-
_InternalLogging.logInternalMessage = function (severity, message) {
|
|
170
|
-
if (this._areInternalMessagesThrottled()) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
var logMessage = true;
|
|
174
|
-
var messageKey = _InternalLogging.AIInternalMessagePrefix + _InternalMessageId[message.messageId];
|
|
175
|
-
if (ApplicationInsights.Util.canUseSessionStorage()) {
|
|
176
|
-
var internalMessageTypeLogRecord = ApplicationInsights.Util.getSessionStorage(messageKey);
|
|
177
|
-
if (internalMessageTypeLogRecord) {
|
|
178
|
-
logMessage = false;
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
ApplicationInsights.Util.setSessionStorage(messageKey, "1");
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
if (this._messageLogged[messageKey]) {
|
|
186
|
-
logMessage = false;
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
this._messageLogged[messageKey] = true;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
if (logMessage) {
|
|
193
|
-
if (this.verboseLogging() || severity === LoggingSeverity.CRITICAL) {
|
|
194
|
-
this.queue.push(message);
|
|
195
|
-
this._messageCount++;
|
|
196
|
-
}
|
|
197
|
-
if (this._messageCount == this.MAX_INTERNAL_MESSAGE_LIMIT) {
|
|
198
|
-
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
199
|
-
var throttleMessage = new _InternalLogMessage(_InternalMessageId.MessageLimitPerPVExceeded, throttleLimitMessage, false);
|
|
200
|
-
this.queue.push(throttleMessage);
|
|
201
|
-
this.warnToConsole(throttleLimitMessage);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
_InternalLogging._areInternalMessagesThrottled = function () {
|
|
206
|
-
return this._messageCount >= this.MAX_INTERNAL_MESSAGE_LIMIT;
|
|
207
|
-
};
|
|
208
|
-
_InternalLogging.AIInternalMessagePrefix = "AITR_";
|
|
209
|
-
_InternalLogging.enableDebugExceptions = function () { return false; };
|
|
210
|
-
_InternalLogging.verboseLogging = function () { return false; };
|
|
211
|
-
_InternalLogging.queue = [];
|
|
212
|
-
_InternalLogging.MAX_INTERNAL_MESSAGE_LIMIT = 25;
|
|
213
|
-
_InternalLogging._messageCount = 0;
|
|
214
|
-
_InternalLogging._messageLogged = {};
|
|
215
|
-
return _InternalLogging;
|
|
216
|
-
}());
|
|
217
|
-
ApplicationInsights._InternalLogging = _InternalLogging;
|
|
218
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
219
|
-
})(Microsoft || (Microsoft = {}));
|
|
220
|
-
var Microsoft;
|
|
221
|
-
(function (Microsoft) {
|
|
222
|
-
var ApplicationInsights;
|
|
223
|
-
(function (ApplicationInsights) {
|
|
224
|
-
var StorageType;
|
|
225
|
-
(function (StorageType) {
|
|
226
|
-
StorageType[StorageType["LocalStorage"] = 0] = "LocalStorage";
|
|
227
|
-
StorageType[StorageType["SessionStorage"] = 1] = "SessionStorage";
|
|
228
|
-
})(StorageType || (StorageType = {}));
|
|
229
|
-
var Util = (function () {
|
|
230
|
-
function Util() {
|
|
231
|
-
}
|
|
232
|
-
Util.disableStorage = function () {
|
|
233
|
-
Util._canUseLocalStorage = false;
|
|
234
|
-
Util._canUseSessionStorage = false;
|
|
235
|
-
};
|
|
236
|
-
Util._getLocalStorageObject = function () {
|
|
237
|
-
if (Util.canUseLocalStorage()) {
|
|
238
|
-
return Util._getVerifiedStorageObject(StorageType.LocalStorage);
|
|
239
|
-
}
|
|
240
|
-
return null;
|
|
241
|
-
};
|
|
242
|
-
Util._getVerifiedStorageObject = function (storageType) {
|
|
243
|
-
var storage = null;
|
|
244
|
-
var fail;
|
|
245
|
-
var uid;
|
|
246
|
-
try {
|
|
247
|
-
uid = new Date;
|
|
248
|
-
storage = storageType === StorageType.LocalStorage ? window.localStorage : window.sessionStorage;
|
|
249
|
-
storage.setItem(uid, uid);
|
|
250
|
-
fail = storage.getItem(uid) != uid;
|
|
251
|
-
storage.removeItem(uid);
|
|
252
|
-
if (fail) {
|
|
253
|
-
storage = null;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
catch (exception) {
|
|
257
|
-
storage = null;
|
|
258
|
-
}
|
|
259
|
-
return storage;
|
|
260
|
-
};
|
|
261
|
-
Util.canUseLocalStorage = function () {
|
|
262
|
-
if (Util._canUseLocalStorage === undefined) {
|
|
263
|
-
Util._canUseLocalStorage = !!Util._getVerifiedStorageObject(StorageType.LocalStorage);
|
|
264
|
-
}
|
|
265
|
-
return Util._canUseLocalStorage;
|
|
266
|
-
};
|
|
267
|
-
Util.getStorage = function (name) {
|
|
268
|
-
var storage = Util._getLocalStorageObject();
|
|
269
|
-
if (storage !== null) {
|
|
270
|
-
try {
|
|
271
|
-
return storage.getItem(name);
|
|
272
|
-
}
|
|
273
|
-
catch (e) {
|
|
274
|
-
Util._canUseLocalStorage = false;
|
|
275
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + Util.getExceptionName(e), { exception: Util.dump(e) });
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
return null;
|
|
279
|
-
};
|
|
280
|
-
Util.setStorage = function (name, data) {
|
|
281
|
-
var storage = Util._getLocalStorageObject();
|
|
282
|
-
if (storage !== null) {
|
|
283
|
-
try {
|
|
284
|
-
storage.setItem(name, data);
|
|
285
|
-
return true;
|
|
286
|
-
}
|
|
287
|
-
catch (e) {
|
|
288
|
-
Util._canUseLocalStorage = false;
|
|
289
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + Util.getExceptionName(e), { exception: Util.dump(e) });
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
return false;
|
|
293
|
-
};
|
|
294
|
-
Util.removeStorage = function (name) {
|
|
295
|
-
var storage = Util._getLocalStorageObject();
|
|
296
|
-
if (storage !== null) {
|
|
297
|
-
try {
|
|
298
|
-
storage.removeItem(name);
|
|
299
|
-
return true;
|
|
300
|
-
}
|
|
301
|
-
catch (e) {
|
|
302
|
-
Util._canUseLocalStorage = false;
|
|
303
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + Util.getExceptionName(e), { exception: Util.dump(e) });
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
return false;
|
|
307
|
-
};
|
|
308
|
-
Util._getSessionStorageObject = function () {
|
|
309
|
-
if (Util.canUseSessionStorage()) {
|
|
310
|
-
return Util._getVerifiedStorageObject(StorageType.SessionStorage);
|
|
311
|
-
}
|
|
312
|
-
return null;
|
|
313
|
-
};
|
|
314
|
-
Util.canUseSessionStorage = function () {
|
|
315
|
-
if (Util._canUseSessionStorage === undefined) {
|
|
316
|
-
Util._canUseSessionStorage = !!Util._getVerifiedStorageObject(StorageType.SessionStorage);
|
|
317
|
-
}
|
|
318
|
-
return Util._canUseSessionStorage;
|
|
319
|
-
};
|
|
320
|
-
Util.getSessionStorageKeys = function () {
|
|
321
|
-
var keys = [];
|
|
322
|
-
if (Util.canUseSessionStorage()) {
|
|
323
|
-
for (var key in window.sessionStorage) {
|
|
324
|
-
keys.push(key);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return keys;
|
|
328
|
-
};
|
|
329
|
-
Util.getSessionStorage = function (name) {
|
|
330
|
-
var storage = Util._getSessionStorageObject();
|
|
331
|
-
if (storage !== null) {
|
|
332
|
-
try {
|
|
333
|
-
return storage.getItem(name);
|
|
334
|
-
}
|
|
335
|
-
catch (e) {
|
|
336
|
-
Util._canUseSessionStorage = false;
|
|
337
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + Util.getExceptionName(e), { exception: Util.dump(e) });
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
return null;
|
|
341
|
-
};
|
|
342
|
-
Util.setSessionStorage = function (name, data) {
|
|
343
|
-
var storage = Util._getSessionStorageObject();
|
|
344
|
-
if (storage !== null) {
|
|
345
|
-
try {
|
|
346
|
-
storage.setItem(name, data);
|
|
347
|
-
return true;
|
|
348
|
-
}
|
|
349
|
-
catch (e) {
|
|
350
|
-
Util._canUseSessionStorage = false;
|
|
351
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + Util.getExceptionName(e), { exception: Util.dump(e) });
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
return false;
|
|
355
|
-
};
|
|
356
|
-
Util.removeSessionStorage = function (name) {
|
|
357
|
-
var storage = Util._getSessionStorageObject();
|
|
358
|
-
if (storage !== null) {
|
|
359
|
-
try {
|
|
360
|
-
storage.removeItem(name);
|
|
361
|
-
return true;
|
|
362
|
-
}
|
|
363
|
-
catch (e) {
|
|
364
|
-
Util._canUseSessionStorage = false;
|
|
365
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + Util.getExceptionName(e), { exception: Util.dump(e) });
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
return false;
|
|
369
|
-
};
|
|
370
|
-
Util.disableCookies = function () {
|
|
371
|
-
Util._canUseCookies = false;
|
|
372
|
-
};
|
|
373
|
-
Util.canUseCookies = function () {
|
|
374
|
-
if (Util._canUseCookies === undefined) {
|
|
375
|
-
Util._canUseCookies = false;
|
|
376
|
-
try {
|
|
377
|
-
Util._canUseCookies = Util.document.cookie !== undefined;
|
|
378
|
-
}
|
|
379
|
-
catch (e) {
|
|
380
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.CannotAccessCookie, "Cannot access document.cookie - " + Util.getExceptionName(e), { exception: Util.dump(e) });
|
|
381
|
-
}
|
|
382
|
-
;
|
|
383
|
-
}
|
|
384
|
-
return Util._canUseCookies;
|
|
385
|
-
};
|
|
386
|
-
Util.setCookie = function (name, value, domain) {
|
|
387
|
-
var domainAttrib = "";
|
|
388
|
-
var secureAttrib = "";
|
|
389
|
-
if (domain) {
|
|
390
|
-
domainAttrib = ";domain=" + domain;
|
|
391
|
-
}
|
|
392
|
-
if (Util.document.location && Util.document.location.protocol === "https:") {
|
|
393
|
-
secureAttrib = ";secure";
|
|
394
|
-
}
|
|
395
|
-
if (Util.canUseCookies()) {
|
|
396
|
-
Util.document.cookie = name + "=" + value + domainAttrib + ";path=/" + secureAttrib;
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
Util.stringToBoolOrDefault = function (str, defaultValue) {
|
|
400
|
-
if (defaultValue === void 0) { defaultValue = false; }
|
|
401
|
-
if (str === undefined || str === null) {
|
|
402
|
-
return defaultValue;
|
|
403
|
-
}
|
|
404
|
-
return str.toString().toLowerCase() === "true";
|
|
405
|
-
};
|
|
406
|
-
Util.getCookie = function (name) {
|
|
407
|
-
if (!Util.canUseCookies()) {
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
var value = "";
|
|
411
|
-
if (name && name.length) {
|
|
412
|
-
var cookieName = name + "=";
|
|
413
|
-
var cookies = Util.document.cookie.split(";");
|
|
414
|
-
for (var i = 0; i < cookies.length; i++) {
|
|
415
|
-
var cookie = cookies[i];
|
|
416
|
-
cookie = Util.trim(cookie);
|
|
417
|
-
if (cookie && cookie.indexOf(cookieName) === 0) {
|
|
418
|
-
value = cookie.substring(cookieName.length, cookies[i].length);
|
|
419
|
-
break;
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
return value;
|
|
424
|
-
};
|
|
425
|
-
Util.deleteCookie = function (name) {
|
|
426
|
-
if (Util.canUseCookies()) {
|
|
427
|
-
Util.document.cookie = name + "=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;";
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
Util.trim = function (str) {
|
|
431
|
-
if (typeof str !== "string")
|
|
432
|
-
return str;
|
|
433
|
-
return str.replace(/^\s+|\s+$/g, "");
|
|
434
|
-
};
|
|
435
|
-
Util.newId = function () {
|
|
436
|
-
var base64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
437
|
-
var result = "";
|
|
438
|
-
var random = Math.random() * 1073741824;
|
|
439
|
-
while (random > 0) {
|
|
440
|
-
var char = base64chars.charAt(random % 64);
|
|
441
|
-
result += char;
|
|
442
|
-
random = Math.floor(random / 64);
|
|
443
|
-
}
|
|
444
|
-
return result;
|
|
445
|
-
};
|
|
446
|
-
Util.isArray = function (obj) {
|
|
447
|
-
return Object.prototype.toString.call(obj) === "[object Array]";
|
|
448
|
-
};
|
|
449
|
-
Util.isError = function (obj) {
|
|
450
|
-
return Object.prototype.toString.call(obj) === "[object Error]";
|
|
451
|
-
};
|
|
452
|
-
Util.isDate = function (obj) {
|
|
453
|
-
return Object.prototype.toString.call(obj) === "[object Date]";
|
|
454
|
-
};
|
|
455
|
-
Util.toISOStringForIE8 = function (date) {
|
|
456
|
-
if (Util.isDate(date)) {
|
|
457
|
-
if (Date.prototype.toISOString) {
|
|
458
|
-
return date.toISOString();
|
|
459
|
-
}
|
|
460
|
-
else {
|
|
461
|
-
var pad = function (number) {
|
|
462
|
-
var r = String(number);
|
|
463
|
-
if (r.length === 1) {
|
|
464
|
-
r = "0" + r;
|
|
465
|
-
}
|
|
466
|
-
return r;
|
|
467
|
-
};
|
|
468
|
-
return date.getUTCFullYear()
|
|
469
|
-
+ "-" + pad(date.getUTCMonth() + 1)
|
|
470
|
-
+ "-" + pad(date.getUTCDate())
|
|
471
|
-
+ "T" + pad(date.getUTCHours())
|
|
472
|
-
+ ":" + pad(date.getUTCMinutes())
|
|
473
|
-
+ ":" + pad(date.getUTCSeconds())
|
|
474
|
-
+ "." + String((date.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5)
|
|
475
|
-
+ "Z";
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
};
|
|
479
|
-
Util.getIEVersion = function (userAgentStr) {
|
|
480
|
-
if (userAgentStr === void 0) { userAgentStr = null; }
|
|
481
|
-
var myNav = userAgentStr ? userAgentStr.toLowerCase() : navigator.userAgent.toLowerCase();
|
|
482
|
-
return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : null;
|
|
483
|
-
};
|
|
484
|
-
Util.msToTimeSpan = function (totalms) {
|
|
485
|
-
if (isNaN(totalms) || totalms < 0) {
|
|
486
|
-
totalms = 0;
|
|
487
|
-
}
|
|
488
|
-
totalms = Math.round(totalms);
|
|
489
|
-
var ms = "" + totalms % 1000;
|
|
490
|
-
var sec = "" + Math.floor(totalms / 1000) % 60;
|
|
491
|
-
var min = "" + Math.floor(totalms / (1000 * 60)) % 60;
|
|
492
|
-
var hour = "" + Math.floor(totalms / (1000 * 60 * 60)) % 24;
|
|
493
|
-
var days = Math.floor(totalms / (1000 * 60 * 60 * 24));
|
|
494
|
-
ms = ms.length === 1 ? "00" + ms : ms.length === 2 ? "0" + ms : ms;
|
|
495
|
-
sec = sec.length < 2 ? "0" + sec : sec;
|
|
496
|
-
min = min.length < 2 ? "0" + min : min;
|
|
497
|
-
hour = hour.length < 2 ? "0" + hour : hour;
|
|
498
|
-
return (days > 0 ? days + "." : "") + hour + ":" + min + ":" + sec + "." + ms;
|
|
499
|
-
};
|
|
500
|
-
Util.isCrossOriginError = function (message, url, lineNumber, columnNumber, error) {
|
|
501
|
-
return (message === "Script error." || message === "Script error") && !error;
|
|
502
|
-
};
|
|
503
|
-
Util.dump = function (object) {
|
|
504
|
-
var objectTypeDump = Object.prototype.toString.call(object);
|
|
505
|
-
var propertyValueDump = JSON.stringify(object);
|
|
506
|
-
if (objectTypeDump === "[object Error]") {
|
|
507
|
-
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
508
|
-
}
|
|
509
|
-
return objectTypeDump + propertyValueDump;
|
|
510
|
-
};
|
|
511
|
-
Util.getExceptionName = function (object) {
|
|
512
|
-
var objectTypeDump = Object.prototype.toString.call(object);
|
|
513
|
-
if (objectTypeDump === "[object Error]") {
|
|
514
|
-
return object.name;
|
|
515
|
-
}
|
|
516
|
-
return "";
|
|
517
|
-
};
|
|
518
|
-
Util.addEventHandler = function (eventName, callback) {
|
|
519
|
-
if (!window || typeof eventName !== 'string' || typeof callback !== 'function') {
|
|
520
|
-
return false;
|
|
521
|
-
}
|
|
522
|
-
var verbEventName = 'on' + eventName;
|
|
523
|
-
if (window.addEventListener) {
|
|
524
|
-
window.addEventListener(eventName, callback, false);
|
|
525
|
-
}
|
|
526
|
-
else if (window["attachEvent"]) {
|
|
527
|
-
window["attachEvent"].call(verbEventName, callback);
|
|
528
|
-
}
|
|
529
|
-
else {
|
|
530
|
-
return false;
|
|
531
|
-
}
|
|
532
|
-
return true;
|
|
533
|
-
};
|
|
534
|
-
Util.IsBeaconApiSupported = function () {
|
|
535
|
-
return ('sendBeacon' in navigator && navigator.sendBeacon);
|
|
536
|
-
};
|
|
537
|
-
Util.document = typeof document !== "undefined" ? document : {};
|
|
538
|
-
Util._canUseCookies = undefined;
|
|
539
|
-
Util._canUseLocalStorage = undefined;
|
|
540
|
-
Util._canUseSessionStorage = undefined;
|
|
541
|
-
Util.NotSpecified = "not_specified";
|
|
542
|
-
return Util;
|
|
543
|
-
}());
|
|
544
|
-
ApplicationInsights.Util = Util;
|
|
545
|
-
var UrlHelper = (function () {
|
|
546
|
-
function UrlHelper() {
|
|
547
|
-
}
|
|
548
|
-
UrlHelper.parseUrl = function (url) {
|
|
549
|
-
if (!UrlHelper.htmlAnchorElement) {
|
|
550
|
-
UrlHelper.htmlAnchorElement = !!UrlHelper.document.createElement ? UrlHelper.document.createElement('a') : {};
|
|
551
|
-
}
|
|
552
|
-
UrlHelper.htmlAnchorElement.href = url;
|
|
553
|
-
return UrlHelper.htmlAnchorElement;
|
|
554
|
-
};
|
|
555
|
-
UrlHelper.getAbsoluteUrl = function (url) {
|
|
556
|
-
var result;
|
|
557
|
-
var a = UrlHelper.parseUrl(url);
|
|
558
|
-
if (a) {
|
|
559
|
-
result = a.href;
|
|
560
|
-
}
|
|
561
|
-
return result;
|
|
562
|
-
};
|
|
563
|
-
UrlHelper.getPathName = function (url) {
|
|
564
|
-
var result;
|
|
565
|
-
var a = UrlHelper.parseUrl(url);
|
|
566
|
-
if (a) {
|
|
567
|
-
result = a.pathname;
|
|
568
|
-
}
|
|
569
|
-
return result;
|
|
570
|
-
};
|
|
571
|
-
UrlHelper.getCompleteUrl = function (method, absoluteUrl) {
|
|
572
|
-
if (method) {
|
|
573
|
-
return method.toUpperCase() + " " + absoluteUrl;
|
|
574
|
-
}
|
|
575
|
-
else {
|
|
576
|
-
return absoluteUrl;
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
UrlHelper.document = typeof document !== "undefined" ? document : {};
|
|
580
|
-
return UrlHelper;
|
|
581
|
-
}());
|
|
582
|
-
ApplicationInsights.UrlHelper = UrlHelper;
|
|
583
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
584
|
-
})(Microsoft || (Microsoft = {}));
|
|
585
|
-
var Microsoft;
|
|
586
|
-
(function (Microsoft) {
|
|
587
|
-
var ApplicationInsights;
|
|
588
|
-
(function (ApplicationInsights) {
|
|
589
|
-
"use strict";
|
|
590
|
-
var extensions = (function () {
|
|
591
|
-
function extensions() {
|
|
592
|
-
}
|
|
593
|
-
extensions.IsNullOrUndefined = function (obj) {
|
|
594
|
-
return typeof (obj) === "undefined" || obj === null;
|
|
595
|
-
};
|
|
596
|
-
return extensions;
|
|
597
|
-
}());
|
|
598
|
-
ApplicationInsights.extensions = extensions;
|
|
599
|
-
var stringUtils = (function () {
|
|
600
|
-
function stringUtils() {
|
|
601
|
-
}
|
|
602
|
-
stringUtils.GetLength = function (strObject) {
|
|
603
|
-
var res = 0;
|
|
604
|
-
if (!extensions.IsNullOrUndefined(strObject)) {
|
|
605
|
-
var stringified = "";
|
|
606
|
-
try {
|
|
607
|
-
stringified = strObject.toString();
|
|
608
|
-
}
|
|
609
|
-
catch (ex) {
|
|
610
|
-
}
|
|
611
|
-
res = stringified.length;
|
|
612
|
-
res = isNaN(res) ? 0 : res;
|
|
613
|
-
}
|
|
614
|
-
return res;
|
|
615
|
-
};
|
|
616
|
-
return stringUtils;
|
|
617
|
-
}());
|
|
618
|
-
ApplicationInsights.stringUtils = stringUtils;
|
|
619
|
-
var dateTime = (function () {
|
|
620
|
-
function dateTime() {
|
|
621
|
-
}
|
|
622
|
-
dateTime.Now = (window.performance && window.performance.now && window.performance.timing) ?
|
|
623
|
-
function () {
|
|
624
|
-
return window.performance.now() + window.performance.timing.navigationStart;
|
|
625
|
-
}
|
|
626
|
-
:
|
|
627
|
-
function () {
|
|
628
|
-
return new Date().getTime();
|
|
629
|
-
};
|
|
630
|
-
dateTime.GetDuration = function (start, end) {
|
|
631
|
-
var result = null;
|
|
632
|
-
if (start !== 0 && end !== 0 && !extensions.IsNullOrUndefined(start) && !extensions.IsNullOrUndefined(end)) {
|
|
633
|
-
result = end - start;
|
|
634
|
-
}
|
|
635
|
-
return result;
|
|
636
|
-
};
|
|
637
|
-
return dateTime;
|
|
638
|
-
}());
|
|
639
|
-
ApplicationInsights.dateTime = dateTime;
|
|
640
|
-
var EventHelper = (function () {
|
|
641
|
-
function EventHelper() {
|
|
642
|
-
}
|
|
643
|
-
EventHelper.AttachEvent = function (obj, eventNameWithoutOn, handlerRef) {
|
|
644
|
-
var result = false;
|
|
645
|
-
if (!extensions.IsNullOrUndefined(obj)) {
|
|
646
|
-
if (!extensions.IsNullOrUndefined(obj.attachEvent)) {
|
|
647
|
-
obj.attachEvent("on" + eventNameWithoutOn, handlerRef);
|
|
648
|
-
result = true;
|
|
649
|
-
}
|
|
650
|
-
else {
|
|
651
|
-
if (!extensions.IsNullOrUndefined(obj.addEventListener)) {
|
|
652
|
-
obj.addEventListener(eventNameWithoutOn, handlerRef, false);
|
|
653
|
-
result = true;
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
return result;
|
|
658
|
-
};
|
|
659
|
-
EventHelper.DetachEvent = function (obj, eventNameWithoutOn, handlerRef) {
|
|
660
|
-
if (!extensions.IsNullOrUndefined(obj)) {
|
|
661
|
-
if (!extensions.IsNullOrUndefined(obj.detachEvent)) {
|
|
662
|
-
obj.detachEvent("on" + eventNameWithoutOn, handlerRef);
|
|
663
|
-
}
|
|
664
|
-
else {
|
|
665
|
-
if (!extensions.IsNullOrUndefined(obj.removeEventListener)) {
|
|
666
|
-
obj.removeEventListener(eventNameWithoutOn, handlerRef, false);
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
};
|
|
671
|
-
return EventHelper;
|
|
672
|
-
}());
|
|
673
|
-
ApplicationInsights.EventHelper = EventHelper;
|
|
674
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
675
|
-
})(Microsoft || (Microsoft = {}));
|
|
676
|
-
var Microsoft;
|
|
677
|
-
(function (Microsoft) {
|
|
678
|
-
var ApplicationInsights;
|
|
679
|
-
(function (ApplicationInsights) {
|
|
680
|
-
"use strict";
|
|
681
|
-
var XHRMonitoringState = (function () {
|
|
682
|
-
function XHRMonitoringState() {
|
|
683
|
-
this.openDone = false;
|
|
684
|
-
this.setRequestHeaderDone = false;
|
|
685
|
-
this.sendDone = false;
|
|
686
|
-
this.abortDone = false;
|
|
687
|
-
this.onreadystatechangeCallbackAttached = false;
|
|
688
|
-
}
|
|
689
|
-
return XHRMonitoringState;
|
|
690
|
-
}());
|
|
691
|
-
ApplicationInsights.XHRMonitoringState = XHRMonitoringState;
|
|
692
|
-
var ajaxRecord = (function () {
|
|
693
|
-
function ajaxRecord(id) {
|
|
694
|
-
this.completed = false;
|
|
695
|
-
this.requestHeadersSize = null;
|
|
696
|
-
this.ttfb = null;
|
|
697
|
-
this.responseReceivingDuration = null;
|
|
698
|
-
this.callbackDuration = null;
|
|
699
|
-
this.ajaxTotalDuration = null;
|
|
700
|
-
this.aborted = null;
|
|
701
|
-
this.pageUrl = null;
|
|
702
|
-
this.requestUrl = null;
|
|
703
|
-
this.requestSize = 0;
|
|
704
|
-
this.method = null;
|
|
705
|
-
this.status = null;
|
|
706
|
-
this.requestSentTime = null;
|
|
707
|
-
this.responseStartedTime = null;
|
|
708
|
-
this.responseFinishedTime = null;
|
|
709
|
-
this.callbackFinishedTime = null;
|
|
710
|
-
this.endTime = null;
|
|
711
|
-
this.originalOnreadystatechage = null;
|
|
712
|
-
this.xhrMonitoringState = new XHRMonitoringState();
|
|
713
|
-
this.clientFailure = 0;
|
|
714
|
-
this.CalculateMetrics = function () {
|
|
715
|
-
var self = this;
|
|
716
|
-
self.ajaxTotalDuration = Math.round(ApplicationInsights.dateTime.GetDuration(self.requestSentTime, self.responseFinishedTime) * 1000) / 1000;
|
|
717
|
-
};
|
|
718
|
-
this.id = id;
|
|
719
|
-
}
|
|
720
|
-
ajaxRecord.prototype.getAbsoluteUrl = function () {
|
|
721
|
-
return this.requestUrl ? ApplicationInsights.UrlHelper.getAbsoluteUrl(this.requestUrl) : null;
|
|
722
|
-
};
|
|
723
|
-
ajaxRecord.prototype.getPathName = function () {
|
|
724
|
-
return this.requestUrl ? ApplicationInsights.Telemetry.Common.DataSanitizer.sanitizeUrl(ApplicationInsights.UrlHelper.getCompleteUrl(this.method, this.requestUrl)) : null;
|
|
725
|
-
};
|
|
726
|
-
return ajaxRecord;
|
|
727
|
-
}());
|
|
728
|
-
ApplicationInsights.ajaxRecord = ajaxRecord;
|
|
729
|
-
;
|
|
730
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
731
|
-
})(Microsoft || (Microsoft = {}));
|
|
732
|
-
;
|
|
733
|
-
var Microsoft;
|
|
734
|
-
(function (Microsoft) {
|
|
735
|
-
var ApplicationInsights;
|
|
736
|
-
(function (ApplicationInsights) {
|
|
737
|
-
"use strict";
|
|
738
|
-
var AjaxMonitor = (function () {
|
|
739
|
-
function AjaxMonitor(appInsights) {
|
|
740
|
-
this.currentWindowHost = window.location.host;
|
|
741
|
-
this.appInsights = appInsights;
|
|
742
|
-
this.initialized = false;
|
|
743
|
-
this.Init();
|
|
744
|
-
}
|
|
745
|
-
AjaxMonitor.prototype.Init = function () {
|
|
746
|
-
if (this.supportsMonitoring()) {
|
|
747
|
-
this.instrumentOpen();
|
|
748
|
-
this.instrumentSend();
|
|
749
|
-
this.instrumentAbort();
|
|
750
|
-
this.initialized = true;
|
|
751
|
-
}
|
|
752
|
-
};
|
|
753
|
-
AjaxMonitor.prototype.isMonitoredInstance = function (xhr, excludeAjaxDataValidation) {
|
|
754
|
-
return this.initialized
|
|
755
|
-
&& (excludeAjaxDataValidation === true || !ApplicationInsights.extensions.IsNullOrUndefined(xhr.ajaxData))
|
|
756
|
-
&& xhr[AjaxMonitor.DisabledPropertyName] !== true;
|
|
757
|
-
};
|
|
758
|
-
AjaxMonitor.prototype.supportsMonitoring = function () {
|
|
759
|
-
var result = false;
|
|
760
|
-
if (!ApplicationInsights.extensions.IsNullOrUndefined(XMLHttpRequest)) {
|
|
761
|
-
result = true;
|
|
762
|
-
}
|
|
763
|
-
return result;
|
|
764
|
-
};
|
|
765
|
-
AjaxMonitor.prototype.instrumentOpen = function () {
|
|
766
|
-
var originalOpen = XMLHttpRequest.prototype.open;
|
|
767
|
-
var ajaxMonitorInstance = this;
|
|
768
|
-
XMLHttpRequest.prototype.open = function (method, url, async) {
|
|
769
|
-
try {
|
|
770
|
-
if (ajaxMonitorInstance.isMonitoredInstance(this, true) &&
|
|
771
|
-
(!this.ajaxData ||
|
|
772
|
-
!this.ajaxData.xhrMonitoringState.openDone)) {
|
|
773
|
-
ajaxMonitorInstance.openHandler(this, method, url, async);
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
catch (e) {
|
|
777
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.FailedMonitorAjaxOpen, "Failed to monitor XMLHttpRequest.open, monitoring data for this ajax call may be incorrect.", {
|
|
778
|
-
ajaxDiagnosticsMessage: AjaxMonitor.getFailedAjaxDiagnosticsMessage(this),
|
|
779
|
-
exception: Microsoft.ApplicationInsights.Util.dump(e)
|
|
780
|
-
});
|
|
781
|
-
}
|
|
782
|
-
return originalOpen.apply(this, arguments);
|
|
783
|
-
};
|
|
784
|
-
};
|
|
785
|
-
AjaxMonitor.prototype.openHandler = function (xhr, method, url, async) {
|
|
786
|
-
var ajaxData = new ApplicationInsights.ajaxRecord(ApplicationInsights.Util.newId());
|
|
787
|
-
ajaxData.method = method;
|
|
788
|
-
ajaxData.requestUrl = url;
|
|
789
|
-
ajaxData.xhrMonitoringState.openDone = true;
|
|
790
|
-
xhr.ajaxData = ajaxData;
|
|
791
|
-
this.attachToOnReadyStateChange(xhr);
|
|
792
|
-
};
|
|
793
|
-
AjaxMonitor.getFailedAjaxDiagnosticsMessage = function (xhr) {
|
|
794
|
-
var result = "";
|
|
795
|
-
try {
|
|
796
|
-
if (!ApplicationInsights.extensions.IsNullOrUndefined(xhr) &&
|
|
797
|
-
!ApplicationInsights.extensions.IsNullOrUndefined(xhr.ajaxData) &&
|
|
798
|
-
!ApplicationInsights.extensions.IsNullOrUndefined(xhr.ajaxData.requestUrl)) {
|
|
799
|
-
result += "(url: '" + xhr.ajaxData.requestUrl + "')";
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
catch (e) { }
|
|
803
|
-
return result;
|
|
804
|
-
};
|
|
805
|
-
AjaxMonitor.prototype.instrumentSend = function () {
|
|
806
|
-
var originalSend = XMLHttpRequest.prototype.send;
|
|
807
|
-
var ajaxMonitorInstance = this;
|
|
808
|
-
XMLHttpRequest.prototype.send = function (content) {
|
|
809
|
-
try {
|
|
810
|
-
if (ajaxMonitorInstance.isMonitoredInstance(this) && !this.ajaxData.xhrMonitoringState.sendDone) {
|
|
811
|
-
ajaxMonitorInstance.sendHandler(this, content);
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
catch (e) {
|
|
815
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.FailedMonitorAjaxSend, "Failed to monitor XMLHttpRequest, monitoring data for this ajax call may be incorrect.", {
|
|
816
|
-
ajaxDiagnosticsMessage: AjaxMonitor.getFailedAjaxDiagnosticsMessage(this),
|
|
817
|
-
exception: Microsoft.ApplicationInsights.Util.dump(e)
|
|
818
|
-
});
|
|
819
|
-
}
|
|
820
|
-
return originalSend.apply(this, arguments);
|
|
821
|
-
};
|
|
822
|
-
};
|
|
823
|
-
AjaxMonitor.prototype.sendHandler = function (xhr, content) {
|
|
824
|
-
xhr.ajaxData.requestSentTime = ApplicationInsights.dateTime.Now();
|
|
825
|
-
if (!this.appInsights.config.disableCorrelationHeaders && (ApplicationInsights.UrlHelper.parseUrl(xhr.ajaxData.getAbsoluteUrl()).host == this.currentWindowHost)) {
|
|
826
|
-
var rootId = this.appInsights.context.operation.id;
|
|
827
|
-
xhr.setRequestHeader("x-ms-request-root-id", rootId);
|
|
828
|
-
xhr.setRequestHeader("x-ms-request-id", xhr.ajaxData.id);
|
|
829
|
-
}
|
|
830
|
-
xhr.ajaxData.xhrMonitoringState.sendDone = true;
|
|
831
|
-
};
|
|
832
|
-
AjaxMonitor.prototype.instrumentAbort = function () {
|
|
833
|
-
var originalAbort = XMLHttpRequest.prototype.abort;
|
|
834
|
-
var ajaxMonitorInstance = this;
|
|
835
|
-
XMLHttpRequest.prototype.abort = function () {
|
|
836
|
-
try {
|
|
837
|
-
if (ajaxMonitorInstance.isMonitoredInstance(this) && !this.ajaxData.xhrMonitoringState.abortDone) {
|
|
838
|
-
this.ajaxData.aborted = 1;
|
|
839
|
-
this.ajaxData.xhrMonitoringState.abortDone = true;
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
catch (e) {
|
|
843
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.FailedMonitorAjaxAbort, "Failed to monitor XMLHttpRequest.abort, monitoring data for this ajax call may be incorrect.", {
|
|
844
|
-
ajaxDiagnosticsMessage: AjaxMonitor.getFailedAjaxDiagnosticsMessage(this),
|
|
845
|
-
exception: Microsoft.ApplicationInsights.Util.dump(e)
|
|
846
|
-
});
|
|
847
|
-
}
|
|
848
|
-
return originalAbort.apply(this, arguments);
|
|
849
|
-
};
|
|
850
|
-
};
|
|
851
|
-
AjaxMonitor.prototype.attachToOnReadyStateChange = function (xhr) {
|
|
852
|
-
var ajaxMonitorInstance = this;
|
|
853
|
-
xhr.ajaxData.xhrMonitoringState.onreadystatechangeCallbackAttached = ApplicationInsights.EventHelper.AttachEvent(xhr, "readystatechange", function () {
|
|
854
|
-
try {
|
|
855
|
-
if (ajaxMonitorInstance.isMonitoredInstance(xhr)) {
|
|
856
|
-
if (xhr.readyState === 4) {
|
|
857
|
-
ajaxMonitorInstance.onAjaxComplete(xhr);
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
catch (e) {
|
|
862
|
-
var exceptionText = Microsoft.ApplicationInsights.Util.dump(e);
|
|
863
|
-
if (!exceptionText || exceptionText.toLowerCase().indexOf("c00c023f") == -1) {
|
|
864
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.FailedMonitorAjaxRSC, "Failed to monitor XMLHttpRequest 'readystatechange' event handler, monitoring data for this ajax call may be incorrect.", {
|
|
865
|
-
ajaxDiagnosticsMessage: AjaxMonitor.getFailedAjaxDiagnosticsMessage(xhr),
|
|
866
|
-
exception: Microsoft.ApplicationInsights.Util.dump(e)
|
|
867
|
-
});
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
});
|
|
871
|
-
};
|
|
872
|
-
AjaxMonitor.prototype.onAjaxComplete = function (xhr) {
|
|
873
|
-
xhr.ajaxData.responseFinishedTime = ApplicationInsights.dateTime.Now();
|
|
874
|
-
xhr.ajaxData.status = xhr.status;
|
|
875
|
-
xhr.ajaxData.CalculateMetrics();
|
|
876
|
-
if (xhr.ajaxData.ajaxTotalDuration < 0) {
|
|
877
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.FailedMonitorAjaxDur, "Failed to calculate the duration of the ajax call, monitoring data for this ajax call won't be sent.", {
|
|
878
|
-
ajaxDiagnosticsMessage: AjaxMonitor.getFailedAjaxDiagnosticsMessage(xhr),
|
|
879
|
-
requestSentTime: xhr.ajaxData.requestSentTime,
|
|
880
|
-
responseFinishedTime: xhr.ajaxData.responseFinishedTime
|
|
881
|
-
});
|
|
882
|
-
}
|
|
883
|
-
else {
|
|
884
|
-
this.appInsights.trackDependency(xhr.ajaxData.id, xhr.ajaxData.method, xhr.ajaxData.getAbsoluteUrl(), xhr.ajaxData.getPathName(), xhr.ajaxData.ajaxTotalDuration, (+(xhr.ajaxData.status)) >= 200 && (+(xhr.ajaxData.status)) < 400, +xhr.ajaxData.status);
|
|
885
|
-
xhr.ajaxData = null;
|
|
886
|
-
}
|
|
887
|
-
};
|
|
888
|
-
AjaxMonitor.instrumentedByAppInsightsName = "InstrumentedByAppInsights";
|
|
889
|
-
AjaxMonitor.DisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
|
|
890
|
-
return AjaxMonitor;
|
|
891
|
-
}());
|
|
892
|
-
ApplicationInsights.AjaxMonitor = AjaxMonitor;
|
|
893
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
894
|
-
})(Microsoft || (Microsoft = {}));
|
|
895
|
-
var Microsoft;
|
|
896
|
-
(function (Microsoft) {
|
|
897
|
-
var ApplicationInsights;
|
|
898
|
-
(function (ApplicationInsights) {
|
|
899
|
-
var HashCodeScoreGenerator = (function () {
|
|
900
|
-
function HashCodeScoreGenerator() {
|
|
901
|
-
}
|
|
902
|
-
HashCodeScoreGenerator.prototype.getHashCodeScore = function (key) {
|
|
903
|
-
var score = this.getHashCode(key) / HashCodeScoreGenerator.INT_MAX_VALUE;
|
|
904
|
-
return score * 100;
|
|
905
|
-
};
|
|
906
|
-
HashCodeScoreGenerator.prototype.getHashCode = function (input) {
|
|
907
|
-
if (input == "") {
|
|
908
|
-
return 0;
|
|
909
|
-
}
|
|
910
|
-
while (input.length < HashCodeScoreGenerator.MIN_INPUT_LENGTH) {
|
|
911
|
-
input = input.concat(input);
|
|
912
|
-
}
|
|
913
|
-
var hash = 5381;
|
|
914
|
-
for (var i = 0; i < input.length; ++i) {
|
|
915
|
-
hash = ((hash << 5) + hash) + input.charCodeAt(i);
|
|
916
|
-
hash = hash & hash;
|
|
917
|
-
}
|
|
918
|
-
return Math.abs(hash);
|
|
919
|
-
};
|
|
920
|
-
HashCodeScoreGenerator.INT_MAX_VALUE = 2147483647;
|
|
921
|
-
HashCodeScoreGenerator.MIN_INPUT_LENGTH = 8;
|
|
922
|
-
return HashCodeScoreGenerator;
|
|
923
|
-
}());
|
|
924
|
-
ApplicationInsights.HashCodeScoreGenerator = HashCodeScoreGenerator;
|
|
925
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
926
|
-
})(Microsoft || (Microsoft = {}));
|
|
927
|
-
var Microsoft;
|
|
928
|
-
(function (Microsoft) {
|
|
929
|
-
var ApplicationInsights;
|
|
930
|
-
(function (ApplicationInsights) {
|
|
931
|
-
"use strict";
|
|
932
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
933
|
-
})(Microsoft || (Microsoft = {}));
|
|
934
|
-
var Microsoft;
|
|
935
|
-
(function (Microsoft) {
|
|
936
|
-
var ApplicationInsights;
|
|
937
|
-
(function (ApplicationInsights) {
|
|
938
|
-
"use strict";
|
|
939
|
-
(function (FieldType) {
|
|
940
|
-
FieldType[FieldType["Default"] = 0] = "Default";
|
|
941
|
-
FieldType[FieldType["Required"] = 1] = "Required";
|
|
942
|
-
FieldType[FieldType["Array"] = 2] = "Array";
|
|
943
|
-
FieldType[FieldType["Hidden"] = 4] = "Hidden";
|
|
944
|
-
})(ApplicationInsights.FieldType || (ApplicationInsights.FieldType = {}));
|
|
945
|
-
var FieldType = ApplicationInsights.FieldType;
|
|
946
|
-
;
|
|
947
|
-
var Serializer = (function () {
|
|
948
|
-
function Serializer() {
|
|
949
|
-
}
|
|
950
|
-
Serializer.serialize = function (input) {
|
|
951
|
-
var output = Serializer._serializeObject(input, "root");
|
|
952
|
-
return JSON.stringify(output);
|
|
953
|
-
};
|
|
954
|
-
Serializer._serializeObject = function (source, name) {
|
|
955
|
-
var circularReferenceCheck = "__aiCircularRefCheck";
|
|
956
|
-
var output = {};
|
|
957
|
-
if (!source) {
|
|
958
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.CannotSerializeObject, "cannot serialize object because it is null or undefined", { name: name }, true);
|
|
959
|
-
return output;
|
|
960
|
-
}
|
|
961
|
-
if (source[circularReferenceCheck]) {
|
|
962
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.CircularReferenceDetected, "Circular reference detected while serializing object", { name: name }, true);
|
|
963
|
-
return output;
|
|
964
|
-
}
|
|
965
|
-
if (!source.aiDataContract) {
|
|
966
|
-
if (name === "measurements") {
|
|
967
|
-
output = Serializer._serializeStringMap(source, "number", name);
|
|
968
|
-
}
|
|
969
|
-
else if (name === "properties") {
|
|
970
|
-
output = Serializer._serializeStringMap(source, "string", name);
|
|
971
|
-
}
|
|
972
|
-
else if (name === "tags") {
|
|
973
|
-
output = Serializer._serializeStringMap(source, "string", name);
|
|
974
|
-
}
|
|
975
|
-
else if (ApplicationInsights.Util.isArray(source)) {
|
|
976
|
-
output = Serializer._serializeArray(source, name);
|
|
977
|
-
}
|
|
978
|
-
else {
|
|
979
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.CannotSerializeObjectNonSerializable, "Attempting to serialize an object which does not implement ISerializable", { name: name }, true);
|
|
980
|
-
try {
|
|
981
|
-
JSON.stringify(source);
|
|
982
|
-
output = source;
|
|
983
|
-
}
|
|
984
|
-
catch (e) {
|
|
985
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.CannotSerializeObject, (e && typeof e.toString === 'function') ? e.toString() : "Error serializing object", null, true);
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
return output;
|
|
989
|
-
}
|
|
990
|
-
source[circularReferenceCheck] = true;
|
|
991
|
-
for (var field in source.aiDataContract) {
|
|
992
|
-
var contract = source.aiDataContract[field];
|
|
993
|
-
var isRequired = (typeof contract === "function") ? (contract() & FieldType.Required) : (contract & FieldType.Required);
|
|
994
|
-
var isHidden = (typeof contract === "function") ? (contract() & FieldType.Hidden) : (contract & FieldType.Hidden);
|
|
995
|
-
var isArray = contract & FieldType.Array;
|
|
996
|
-
var isPresent = source[field] !== undefined;
|
|
997
|
-
var isObject = typeof source[field] === "object" && source[field] !== null;
|
|
998
|
-
if (isRequired && !isPresent && !isArray) {
|
|
999
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.MissingRequiredFieldSpecification, "Missing required field specification. The field is required but not present on source", { field: field, name: name });
|
|
1000
|
-
continue;
|
|
1001
|
-
}
|
|
1002
|
-
if (isHidden) {
|
|
1003
|
-
continue;
|
|
1004
|
-
}
|
|
1005
|
-
var value;
|
|
1006
|
-
if (isObject) {
|
|
1007
|
-
if (isArray) {
|
|
1008
|
-
value = Serializer._serializeArray(source[field], field);
|
|
1009
|
-
}
|
|
1010
|
-
else {
|
|
1011
|
-
value = Serializer._serializeObject(source[field], field);
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
else {
|
|
1015
|
-
value = source[field];
|
|
1016
|
-
}
|
|
1017
|
-
if (value !== undefined) {
|
|
1018
|
-
output[field] = value;
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
delete source[circularReferenceCheck];
|
|
1022
|
-
return output;
|
|
1023
|
-
};
|
|
1024
|
-
Serializer._serializeArray = function (sources, name) {
|
|
1025
|
-
var output = undefined;
|
|
1026
|
-
if (!!sources) {
|
|
1027
|
-
if (!ApplicationInsights.Util.isArray(sources)) {
|
|
1028
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.ItemNotInArray, "This field was specified as an array in the contract but the item is not an array.\r\n", { name: name }, true);
|
|
1029
|
-
}
|
|
1030
|
-
else {
|
|
1031
|
-
output = [];
|
|
1032
|
-
for (var i = 0; i < sources.length; i++) {
|
|
1033
|
-
var source = sources[i];
|
|
1034
|
-
var item = Serializer._serializeObject(source, name + "[" + i + "]");
|
|
1035
|
-
output.push(item);
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
return output;
|
|
1040
|
-
};
|
|
1041
|
-
Serializer._serializeStringMap = function (map, expectedType, name) {
|
|
1042
|
-
var output = undefined;
|
|
1043
|
-
if (map) {
|
|
1044
|
-
output = {};
|
|
1045
|
-
for (var field in map) {
|
|
1046
|
-
var value = map[field];
|
|
1047
|
-
if (expectedType === "string") {
|
|
1048
|
-
if (value === undefined) {
|
|
1049
|
-
output[field] = "undefined";
|
|
1050
|
-
}
|
|
1051
|
-
else if (value === null) {
|
|
1052
|
-
output[field] = "null";
|
|
1053
|
-
}
|
|
1054
|
-
else if (!value.toString) {
|
|
1055
|
-
output[field] = "invalid field: toString() is not defined.";
|
|
1056
|
-
}
|
|
1057
|
-
else {
|
|
1058
|
-
output[field] = value.toString();
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
else if (expectedType === "number") {
|
|
1062
|
-
if (value === undefined) {
|
|
1063
|
-
output[field] = "undefined";
|
|
1064
|
-
}
|
|
1065
|
-
else if (value === null) {
|
|
1066
|
-
output[field] = "null";
|
|
1067
|
-
}
|
|
1068
|
-
else {
|
|
1069
|
-
var num = parseFloat(value);
|
|
1070
|
-
if (isNaN(num)) {
|
|
1071
|
-
output[field] = "NaN";
|
|
1072
|
-
}
|
|
1073
|
-
else {
|
|
1074
|
-
output[field] = num;
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
else {
|
|
1079
|
-
output[field] = "invalid field: " + name + " is of unknown type.";
|
|
1080
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, output[field], null, true);
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
return output;
|
|
1085
|
-
};
|
|
1086
|
-
return Serializer;
|
|
1087
|
-
}());
|
|
1088
|
-
ApplicationInsights.Serializer = Serializer;
|
|
1089
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1090
|
-
})(Microsoft || (Microsoft = {}));
|
|
1091
|
-
var Microsoft;
|
|
1092
|
-
(function (Microsoft) {
|
|
1093
|
-
var Telemetry;
|
|
1094
|
-
(function (Telemetry) {
|
|
1095
|
-
"use strict";
|
|
1096
|
-
var Base = (function () {
|
|
1097
|
-
function Base() {
|
|
1098
|
-
}
|
|
1099
|
-
return Base;
|
|
1100
|
-
}());
|
|
1101
|
-
Telemetry.Base = Base;
|
|
1102
|
-
})(Telemetry = Microsoft.Telemetry || (Microsoft.Telemetry = {}));
|
|
1103
|
-
})(Microsoft || (Microsoft = {}));
|
|
1104
|
-
var Microsoft;
|
|
1105
|
-
(function (Microsoft) {
|
|
1106
|
-
var Telemetry;
|
|
1107
|
-
(function (Telemetry) {
|
|
1108
|
-
"use strict";
|
|
1109
|
-
var Envelope = (function () {
|
|
1110
|
-
function Envelope() {
|
|
1111
|
-
this.ver = 1;
|
|
1112
|
-
this.sampleRate = 100.0;
|
|
1113
|
-
this.tags = {};
|
|
1114
|
-
}
|
|
1115
|
-
return Envelope;
|
|
1116
|
-
}());
|
|
1117
|
-
Telemetry.Envelope = Envelope;
|
|
1118
|
-
})(Telemetry = Microsoft.Telemetry || (Microsoft.Telemetry = {}));
|
|
1119
|
-
})(Microsoft || (Microsoft = {}));
|
|
1120
|
-
var Microsoft;
|
|
1121
|
-
(function (Microsoft) {
|
|
1122
|
-
var ApplicationInsights;
|
|
1123
|
-
(function (ApplicationInsights) {
|
|
1124
|
-
var Telemetry;
|
|
1125
|
-
(function (Telemetry) {
|
|
1126
|
-
var Common;
|
|
1127
|
-
(function (Common) {
|
|
1128
|
-
"use strict";
|
|
1129
|
-
var Envelope = (function (_super) {
|
|
1130
|
-
__extends(Envelope, _super);
|
|
1131
|
-
function Envelope(data, name) {
|
|
1132
|
-
var _this = this;
|
|
1133
|
-
_super.call(this);
|
|
1134
|
-
this.name = Common.DataSanitizer.sanitizeString(name) || ApplicationInsights.Util.NotSpecified;
|
|
1135
|
-
this.data = data;
|
|
1136
|
-
this.time = ApplicationInsights.Util.toISOStringForIE8(new Date());
|
|
1137
|
-
this.aiDataContract = {
|
|
1138
|
-
time: ApplicationInsights.FieldType.Required,
|
|
1139
|
-
iKey: ApplicationInsights.FieldType.Required,
|
|
1140
|
-
name: ApplicationInsights.FieldType.Required,
|
|
1141
|
-
sampleRate: function () {
|
|
1142
|
-
return (_this.sampleRate == 100) ? ApplicationInsights.FieldType.Hidden : ApplicationInsights.FieldType.Required;
|
|
1143
|
-
},
|
|
1144
|
-
tags: ApplicationInsights.FieldType.Required,
|
|
1145
|
-
data: ApplicationInsights.FieldType.Required
|
|
1146
|
-
};
|
|
1147
|
-
}
|
|
1148
|
-
return Envelope;
|
|
1149
|
-
}(Microsoft.Telemetry.Envelope));
|
|
1150
|
-
Common.Envelope = Envelope;
|
|
1151
|
-
})(Common = Telemetry.Common || (Telemetry.Common = {}));
|
|
1152
|
-
})(Telemetry = ApplicationInsights.Telemetry || (ApplicationInsights.Telemetry = {}));
|
|
1153
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1154
|
-
})(Microsoft || (Microsoft = {}));
|
|
1155
|
-
var Microsoft;
|
|
1156
|
-
(function (Microsoft) {
|
|
1157
|
-
var ApplicationInsights;
|
|
1158
|
-
(function (ApplicationInsights) {
|
|
1159
|
-
var Telemetry;
|
|
1160
|
-
(function (Telemetry) {
|
|
1161
|
-
var Common;
|
|
1162
|
-
(function (Common) {
|
|
1163
|
-
"use strict";
|
|
1164
|
-
var Base = (function (_super) {
|
|
1165
|
-
__extends(Base, _super);
|
|
1166
|
-
function Base() {
|
|
1167
|
-
_super.apply(this, arguments);
|
|
1168
|
-
this.aiDataContract = {};
|
|
1169
|
-
}
|
|
1170
|
-
return Base;
|
|
1171
|
-
}(Microsoft.Telemetry.Base));
|
|
1172
|
-
Common.Base = Base;
|
|
1173
|
-
})(Common = Telemetry.Common || (Telemetry.Common = {}));
|
|
1174
|
-
})(Telemetry = ApplicationInsights.Telemetry || (ApplicationInsights.Telemetry = {}));
|
|
1175
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1176
|
-
})(Microsoft || (Microsoft = {}));
|
|
1177
|
-
var AI;
|
|
1178
|
-
(function (AI) {
|
|
1179
|
-
"use strict";
|
|
1180
|
-
var ContextTagKeys = (function () {
|
|
1181
|
-
function ContextTagKeys() {
|
|
1182
|
-
this.applicationVersion = "ai.application.ver";
|
|
1183
|
-
this.applicationBuild = "ai.application.build";
|
|
1184
|
-
this.applicationTypeId = "ai.application.typeId";
|
|
1185
|
-
this.applicationId = "ai.application.applicationId";
|
|
1186
|
-
this.deviceId = "ai.device.id";
|
|
1187
|
-
this.deviceIp = "ai.device.ip";
|
|
1188
|
-
this.deviceLanguage = "ai.device.language";
|
|
1189
|
-
this.deviceLocale = "ai.device.locale";
|
|
1190
|
-
this.deviceModel = "ai.device.model";
|
|
1191
|
-
this.deviceNetwork = "ai.device.network";
|
|
1192
|
-
this.deviceNetworkName = "ai.device.networkName";
|
|
1193
|
-
this.deviceOEMName = "ai.device.oemName";
|
|
1194
|
-
this.deviceOS = "ai.device.os";
|
|
1195
|
-
this.deviceOSVersion = "ai.device.osVersion";
|
|
1196
|
-
this.deviceRoleInstance = "ai.device.roleInstance";
|
|
1197
|
-
this.deviceRoleName = "ai.device.roleName";
|
|
1198
|
-
this.deviceScreenResolution = "ai.device.screenResolution";
|
|
1199
|
-
this.deviceType = "ai.device.type";
|
|
1200
|
-
this.deviceMachineName = "ai.device.machineName";
|
|
1201
|
-
this.deviceVMName = "ai.device.vmName";
|
|
1202
|
-
this.locationIp = "ai.location.ip";
|
|
1203
|
-
this.operationId = "ai.operation.id";
|
|
1204
|
-
this.operationName = "ai.operation.name";
|
|
1205
|
-
this.operationParentId = "ai.operation.parentId";
|
|
1206
|
-
this.operationRootId = "ai.operation.rootId";
|
|
1207
|
-
this.operationSyntheticSource = "ai.operation.syntheticSource";
|
|
1208
|
-
this.operationIsSynthetic = "ai.operation.isSynthetic";
|
|
1209
|
-
this.operationCorrelationVector = "ai.operation.correlationVector";
|
|
1210
|
-
this.sessionId = "ai.session.id";
|
|
1211
|
-
this.sessionIsFirst = "ai.session.isFirst";
|
|
1212
|
-
this.sessionIsNew = "ai.session.isNew";
|
|
1213
|
-
this.userAccountAcquisitionDate = "ai.user.accountAcquisitionDate";
|
|
1214
|
-
this.userAccountId = "ai.user.accountId";
|
|
1215
|
-
this.userAgent = "ai.user.userAgent";
|
|
1216
|
-
this.userId = "ai.user.id";
|
|
1217
|
-
this.userStoreRegion = "ai.user.storeRegion";
|
|
1218
|
-
this.userAuthUserId = "ai.user.authUserId";
|
|
1219
|
-
this.userAnonymousUserAcquisitionDate = "ai.user.anonUserAcquisitionDate";
|
|
1220
|
-
this.userAuthenticatedUserAcquisitionDate = "ai.user.authUserAcquisitionDate";
|
|
1221
|
-
this.sampleRate = "ai.sample.sampleRate";
|
|
1222
|
-
this.cloudName = "ai.cloud.name";
|
|
1223
|
-
this.cloudRoleVer = "ai.cloud.roleVer";
|
|
1224
|
-
this.cloudEnvironment = "ai.cloud.environment";
|
|
1225
|
-
this.cloudLocation = "ai.cloud.location";
|
|
1226
|
-
this.cloudDeploymentUnit = "ai.cloud.deploymentUnit";
|
|
1227
|
-
this.serverDeviceOS = "ai.serverDevice.os";
|
|
1228
|
-
this.serverDeviceOSVer = "ai.serverDevice.osVer";
|
|
1229
|
-
this.internalSdkVersion = "ai.internal.sdkVersion";
|
|
1230
|
-
this.internalAgentVersion = "ai.internal.agentVersion";
|
|
1231
|
-
this.internalDataCollectorReceivedTime = "ai.internal.dataCollectorReceivedTime";
|
|
1232
|
-
this.internalProfileId = "ai.internal.profileId";
|
|
1233
|
-
this.internalProfileClassId = "ai.internal.profileClassId";
|
|
1234
|
-
this.internalAccountId = "ai.internal.accountId";
|
|
1235
|
-
this.internalApplicationName = "ai.internal.applicationName";
|
|
1236
|
-
this.internalInstrumentationKey = "ai.internal.instrumentationKey";
|
|
1237
|
-
this.internalTelemetryItemId = "ai.internal.telemetryItemId";
|
|
1238
|
-
this.internalApplicationType = "ai.internal.applicationType";
|
|
1239
|
-
this.internalRequestSource = "ai.internal.requestSource";
|
|
1240
|
-
this.internalFlowType = "ai.internal.flowType";
|
|
1241
|
-
this.internalIsAudit = "ai.internal.isAudit";
|
|
1242
|
-
this.internalTrackingSourceId = "ai.internal.trackingSourceId";
|
|
1243
|
-
this.internalTrackingType = "ai.internal.trackingType";
|
|
1244
|
-
this.internalIsDiagnosticExample = "ai.internal.isDiagnosticExample";
|
|
1245
|
-
}
|
|
1246
|
-
return ContextTagKeys;
|
|
1247
|
-
}());
|
|
1248
|
-
AI.ContextTagKeys = ContextTagKeys;
|
|
1249
|
-
})(AI || (AI = {}));
|
|
1250
|
-
var Microsoft;
|
|
1251
|
-
(function (Microsoft) {
|
|
1252
|
-
var ApplicationInsights;
|
|
1253
|
-
(function (ApplicationInsights) {
|
|
1254
|
-
var Context;
|
|
1255
|
-
(function (Context) {
|
|
1256
|
-
"use strict";
|
|
1257
|
-
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
1258
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1259
|
-
})(Microsoft || (Microsoft = {}));
|
|
1260
|
-
var Microsoft;
|
|
1261
|
-
(function (Microsoft) {
|
|
1262
|
-
var ApplicationInsights;
|
|
1263
|
-
(function (ApplicationInsights) {
|
|
1264
|
-
var Context;
|
|
1265
|
-
(function (Context) {
|
|
1266
|
-
"use strict";
|
|
1267
|
-
var Application = (function () {
|
|
1268
|
-
function Application() {
|
|
1269
|
-
}
|
|
1270
|
-
return Application;
|
|
1271
|
-
}());
|
|
1272
|
-
Context.Application = Application;
|
|
1273
|
-
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
1274
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1275
|
-
})(Microsoft || (Microsoft = {}));
|
|
1276
|
-
var Microsoft;
|
|
1277
|
-
(function (Microsoft) {
|
|
1278
|
-
var ApplicationInsights;
|
|
1279
|
-
(function (ApplicationInsights) {
|
|
1280
|
-
var Context;
|
|
1281
|
-
(function (Context) {
|
|
1282
|
-
"use strict";
|
|
1283
|
-
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
1284
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1285
|
-
})(Microsoft || (Microsoft = {}));
|
|
1286
|
-
var Microsoft;
|
|
1287
|
-
(function (Microsoft) {
|
|
1288
|
-
var ApplicationInsights;
|
|
1289
|
-
(function (ApplicationInsights) {
|
|
1290
|
-
var Context;
|
|
1291
|
-
(function (Context) {
|
|
1292
|
-
"use strict";
|
|
1293
|
-
var Device = (function () {
|
|
1294
|
-
function Device() {
|
|
1295
|
-
this.id = "browser";
|
|
1296
|
-
this.type = "Browser";
|
|
1297
|
-
}
|
|
1298
|
-
return Device;
|
|
1299
|
-
}());
|
|
1300
|
-
Context.Device = Device;
|
|
1301
|
-
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
1302
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1303
|
-
})(Microsoft || (Microsoft = {}));
|
|
1304
|
-
var Microsoft;
|
|
1305
|
-
(function (Microsoft) {
|
|
1306
|
-
var ApplicationInsights;
|
|
1307
|
-
(function (ApplicationInsights) {
|
|
1308
|
-
var Context;
|
|
1309
|
-
(function (Context) {
|
|
1310
|
-
"use strict";
|
|
1311
|
-
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
1312
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1313
|
-
})(Microsoft || (Microsoft = {}));
|
|
1314
|
-
var Microsoft;
|
|
1315
|
-
(function (Microsoft) {
|
|
1316
|
-
var ApplicationInsights;
|
|
1317
|
-
(function (ApplicationInsights) {
|
|
1318
|
-
var Context;
|
|
1319
|
-
(function (Context) {
|
|
1320
|
-
"use strict";
|
|
1321
|
-
var Internal = (function () {
|
|
1322
|
-
function Internal(config) {
|
|
1323
|
-
this.sdkVersion = (config.sdkExtension() ? config.sdkExtension() + "_" : "") + "javascript:" + ApplicationInsights.Version;
|
|
1324
|
-
}
|
|
1325
|
-
return Internal;
|
|
1326
|
-
}());
|
|
1327
|
-
Context.Internal = Internal;
|
|
1328
|
-
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
1329
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1330
|
-
})(Microsoft || (Microsoft = {}));
|
|
1331
|
-
var Microsoft;
|
|
1332
|
-
(function (Microsoft) {
|
|
1333
|
-
var ApplicationInsights;
|
|
1334
|
-
(function (ApplicationInsights) {
|
|
1335
|
-
var Context;
|
|
1336
|
-
(function (Context) {
|
|
1337
|
-
"use strict";
|
|
1338
|
-
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
1339
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1340
|
-
})(Microsoft || (Microsoft = {}));
|
|
1341
|
-
var Microsoft;
|
|
1342
|
-
(function (Microsoft) {
|
|
1343
|
-
var ApplicationInsights;
|
|
1344
|
-
(function (ApplicationInsights) {
|
|
1345
|
-
var Context;
|
|
1346
|
-
(function (Context) {
|
|
1347
|
-
"use strict";
|
|
1348
|
-
var Location = (function () {
|
|
1349
|
-
function Location() {
|
|
1350
|
-
}
|
|
1351
|
-
return Location;
|
|
1352
|
-
}());
|
|
1353
|
-
Context.Location = Location;
|
|
1354
|
-
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
1355
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1356
|
-
})(Microsoft || (Microsoft = {}));
|
|
1357
|
-
var Microsoft;
|
|
1358
|
-
(function (Microsoft) {
|
|
1359
|
-
var ApplicationInsights;
|
|
1360
|
-
(function (ApplicationInsights) {
|
|
1361
|
-
var Context;
|
|
1362
|
-
(function (Context) {
|
|
1363
|
-
"use strict";
|
|
1364
|
-
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
1365
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1366
|
-
})(Microsoft || (Microsoft = {}));
|
|
1367
|
-
var Microsoft;
|
|
1368
|
-
(function (Microsoft) {
|
|
1369
|
-
var ApplicationInsights;
|
|
1370
|
-
(function (ApplicationInsights) {
|
|
1371
|
-
var Context;
|
|
1372
|
-
(function (Context) {
|
|
1373
|
-
"use strict";
|
|
1374
|
-
var Operation = (function () {
|
|
1375
|
-
function Operation() {
|
|
1376
|
-
this.id = ApplicationInsights.Util.newId();
|
|
1377
|
-
if (window && window.location && window.location.pathname) {
|
|
1378
|
-
this.name = window.location.pathname;
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
return Operation;
|
|
1382
|
-
}());
|
|
1383
|
-
Context.Operation = Operation;
|
|
1384
|
-
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
1385
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1386
|
-
})(Microsoft || (Microsoft = {}));
|
|
1387
|
-
var Microsoft;
|
|
1388
|
-
(function (Microsoft) {
|
|
1389
|
-
var ApplicationInsights;
|
|
1390
|
-
(function (ApplicationInsights) {
|
|
1391
|
-
var SamplingScoreGenerator = (function () {
|
|
1392
|
-
function SamplingScoreGenerator() {
|
|
1393
|
-
this.hashCodeGeneragor = new ApplicationInsights.HashCodeScoreGenerator();
|
|
1394
|
-
}
|
|
1395
|
-
SamplingScoreGenerator.prototype.getSamplingScore = function (envelope) {
|
|
1396
|
-
var tagKeys = new AI.ContextTagKeys();
|
|
1397
|
-
var score = 0;
|
|
1398
|
-
if (envelope.tags[tagKeys.userId]) {
|
|
1399
|
-
score = this.hashCodeGeneragor.getHashCodeScore(envelope.tags[tagKeys.userId]);
|
|
1400
|
-
}
|
|
1401
|
-
else if (envelope.tags[tagKeys.operationId]) {
|
|
1402
|
-
score = this.hashCodeGeneragor.getHashCodeScore(envelope.tags[tagKeys.operationId]);
|
|
1403
|
-
}
|
|
1404
|
-
else {
|
|
1405
|
-
score = Math.random();
|
|
1406
|
-
}
|
|
1407
|
-
return score;
|
|
1408
|
-
};
|
|
1409
|
-
return SamplingScoreGenerator;
|
|
1410
|
-
}());
|
|
1411
|
-
ApplicationInsights.SamplingScoreGenerator = SamplingScoreGenerator;
|
|
1412
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1413
|
-
})(Microsoft || (Microsoft = {}));
|
|
1414
|
-
var Microsoft;
|
|
1415
|
-
(function (Microsoft) {
|
|
1416
|
-
var ApplicationInsights;
|
|
1417
|
-
(function (ApplicationInsights) {
|
|
1418
|
-
var Context;
|
|
1419
|
-
(function (Context) {
|
|
1420
|
-
"use strict";
|
|
1421
|
-
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
1422
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1423
|
-
})(Microsoft || (Microsoft = {}));
|
|
1424
|
-
var Microsoft;
|
|
1425
|
-
(function (Microsoft) {
|
|
1426
|
-
var ApplicationInsights;
|
|
1427
|
-
(function (ApplicationInsights) {
|
|
1428
|
-
var Context;
|
|
1429
|
-
(function (Context) {
|
|
1430
|
-
"use strict";
|
|
1431
|
-
var Sample = (function () {
|
|
1432
|
-
function Sample(sampleRate) {
|
|
1433
|
-
this.INT_MAX_VALUE = 2147483647;
|
|
1434
|
-
if (sampleRate > 100 || sampleRate < 0) {
|
|
1435
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.SampleRateOutOfRange, "Sampling rate is out of range (0..100). Sampling will be disabled, you may be sending too much data which may affect your AI service level.", { samplingRate: sampleRate }, true);
|
|
1436
|
-
this.sampleRate = 100;
|
|
1437
|
-
}
|
|
1438
|
-
this.sampleRate = sampleRate;
|
|
1439
|
-
this.samplingScoreGenerator = new ApplicationInsights.SamplingScoreGenerator();
|
|
1440
|
-
}
|
|
1441
|
-
Sample.prototype.isSampledIn = function (envelope) {
|
|
1442
|
-
if (this.sampleRate == 100)
|
|
1443
|
-
return true;
|
|
1444
|
-
var score = this.samplingScoreGenerator.getSamplingScore(envelope);
|
|
1445
|
-
return score < this.sampleRate;
|
|
1446
|
-
};
|
|
1447
|
-
return Sample;
|
|
1448
|
-
}());
|
|
1449
|
-
Context.Sample = Sample;
|
|
1450
|
-
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
1451
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1452
|
-
})(Microsoft || (Microsoft = {}));
|
|
1453
|
-
var AI;
|
|
1454
|
-
(function (AI) {
|
|
1455
|
-
"use strict";
|
|
1456
|
-
(function (SessionState) {
|
|
1457
|
-
SessionState[SessionState["Start"] = 0] = "Start";
|
|
1458
|
-
SessionState[SessionState["End"] = 1] = "End";
|
|
1459
|
-
})(AI.SessionState || (AI.SessionState = {}));
|
|
1460
|
-
var SessionState = AI.SessionState;
|
|
1461
|
-
})(AI || (AI = {}));
|
|
1462
|
-
var Microsoft;
|
|
1463
|
-
(function (Microsoft) {
|
|
1464
|
-
var ApplicationInsights;
|
|
1465
|
-
(function (ApplicationInsights) {
|
|
1466
|
-
var Context;
|
|
1467
|
-
(function (Context) {
|
|
1468
|
-
"use strict";
|
|
1469
|
-
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
1470
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1471
|
-
})(Microsoft || (Microsoft = {}));
|
|
1472
|
-
var Microsoft;
|
|
1473
|
-
(function (Microsoft) {
|
|
1474
|
-
var ApplicationInsights;
|
|
1475
|
-
(function (ApplicationInsights) {
|
|
1476
|
-
var Context;
|
|
1477
|
-
(function (Context) {
|
|
1478
|
-
"use strict";
|
|
1479
|
-
var Session = (function () {
|
|
1480
|
-
function Session() {
|
|
1481
|
-
}
|
|
1482
|
-
return Session;
|
|
1483
|
-
}());
|
|
1484
|
-
Context.Session = Session;
|
|
1485
|
-
var _SessionManager = (function () {
|
|
1486
|
-
function _SessionManager(config) {
|
|
1487
|
-
if (!config) {
|
|
1488
|
-
config = {};
|
|
1489
|
-
}
|
|
1490
|
-
if (!(typeof config.sessionExpirationMs === "function")) {
|
|
1491
|
-
config.sessionExpirationMs = function () { return _SessionManager.acquisitionSpan; };
|
|
1492
|
-
}
|
|
1493
|
-
if (!(typeof config.sessionRenewalMs === "function")) {
|
|
1494
|
-
config.sessionRenewalMs = function () { return _SessionManager.renewalSpan; };
|
|
1495
|
-
}
|
|
1496
|
-
this.config = config;
|
|
1497
|
-
this.automaticSession = new Session();
|
|
1498
|
-
}
|
|
1499
|
-
_SessionManager.prototype.update = function () {
|
|
1500
|
-
if (!this.automaticSession.id) {
|
|
1501
|
-
this.initializeAutomaticSession();
|
|
1502
|
-
}
|
|
1503
|
-
var now = ApplicationInsights.dateTime.Now();
|
|
1504
|
-
var acquisitionExpired = now - this.automaticSession.acquisitionDate > this.config.sessionExpirationMs();
|
|
1505
|
-
var renewalExpired = now - this.automaticSession.renewalDate > this.config.sessionRenewalMs();
|
|
1506
|
-
if (acquisitionExpired || renewalExpired) {
|
|
1507
|
-
this.automaticSession.isFirst = undefined;
|
|
1508
|
-
this.renew();
|
|
1509
|
-
}
|
|
1510
|
-
else {
|
|
1511
|
-
if (!this.cookieUpdatedTimestamp || now - this.cookieUpdatedTimestamp > _SessionManager.cookieUpdateInterval) {
|
|
1512
|
-
this.automaticSession.renewalDate = now;
|
|
1513
|
-
this.setCookie(this.automaticSession.id, this.automaticSession.acquisitionDate, this.automaticSession.renewalDate);
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
|
-
};
|
|
1517
|
-
_SessionManager.prototype.backup = function () {
|
|
1518
|
-
this.setStorage(this.automaticSession.id, this.automaticSession.acquisitionDate, this.automaticSession.renewalDate);
|
|
1519
|
-
};
|
|
1520
|
-
_SessionManager.prototype.initializeAutomaticSession = function () {
|
|
1521
|
-
var cookie = ApplicationInsights.Util.getCookie('ai_session');
|
|
1522
|
-
if (cookie && typeof cookie.split === "function") {
|
|
1523
|
-
this.initializeAutomaticSessionWithData(cookie);
|
|
1524
|
-
}
|
|
1525
|
-
else {
|
|
1526
|
-
var storage = ApplicationInsights.Util.getStorage('ai_session');
|
|
1527
|
-
if (storage) {
|
|
1528
|
-
this.initializeAutomaticSessionWithData(storage);
|
|
1529
|
-
}
|
|
1530
|
-
}
|
|
1531
|
-
if (!this.automaticSession.id) {
|
|
1532
|
-
this.automaticSession.isFirst = true;
|
|
1533
|
-
this.renew();
|
|
1534
|
-
}
|
|
1535
|
-
};
|
|
1536
|
-
_SessionManager.prototype.initializeAutomaticSessionWithData = function (sessionData) {
|
|
1537
|
-
var params = sessionData.split("|");
|
|
1538
|
-
if (params.length > 0) {
|
|
1539
|
-
this.automaticSession.id = params[0];
|
|
1540
|
-
}
|
|
1541
|
-
try {
|
|
1542
|
-
if (params.length > 1) {
|
|
1543
|
-
var acq = +params[1];
|
|
1544
|
-
this.automaticSession.acquisitionDate = +new Date(acq);
|
|
1545
|
-
this.automaticSession.acquisitionDate = this.automaticSession.acquisitionDate > 0 ? this.automaticSession.acquisitionDate : 0;
|
|
1546
|
-
}
|
|
1547
|
-
if (params.length > 2) {
|
|
1548
|
-
var renewal = +params[2];
|
|
1549
|
-
this.automaticSession.renewalDate = +new Date(renewal);
|
|
1550
|
-
this.automaticSession.renewalDate = this.automaticSession.renewalDate > 0 ? this.automaticSession.renewalDate : 0;
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
catch (e) {
|
|
1554
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.ErrorParsingAISessionCookie, "Error parsing ai_session cookie, session will be reset: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
|
|
1555
|
-
}
|
|
1556
|
-
if (this.automaticSession.renewalDate == 0) {
|
|
1557
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.SessionRenewalDateIsZero, "AI session renewal date is 0, session will be reset.");
|
|
1558
|
-
}
|
|
1559
|
-
};
|
|
1560
|
-
_SessionManager.prototype.renew = function () {
|
|
1561
|
-
var now = ApplicationInsights.dateTime.Now();
|
|
1562
|
-
this.automaticSession.id = ApplicationInsights.Util.newId();
|
|
1563
|
-
this.automaticSession.acquisitionDate = now;
|
|
1564
|
-
this.automaticSession.renewalDate = now;
|
|
1565
|
-
this.setCookie(this.automaticSession.id, this.automaticSession.acquisitionDate, this.automaticSession.renewalDate);
|
|
1566
|
-
if (!ApplicationInsights.Util.canUseLocalStorage()) {
|
|
1567
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.BrowserDoesNotSupportLocalStorage, "Browser does not support local storage. Session durations will be inaccurate.");
|
|
1568
|
-
}
|
|
1569
|
-
};
|
|
1570
|
-
_SessionManager.prototype.setCookie = function (guid, acq, renewal) {
|
|
1571
|
-
var acquisitionExpiry = acq + this.config.sessionExpirationMs();
|
|
1572
|
-
var renewalExpiry = renewal + this.config.sessionRenewalMs();
|
|
1573
|
-
var cookieExpiry = new Date();
|
|
1574
|
-
var cookie = [guid, acq, renewal];
|
|
1575
|
-
if (acquisitionExpiry < renewalExpiry) {
|
|
1576
|
-
cookieExpiry.setTime(acquisitionExpiry);
|
|
1577
|
-
}
|
|
1578
|
-
else {
|
|
1579
|
-
cookieExpiry.setTime(renewalExpiry);
|
|
1580
|
-
}
|
|
1581
|
-
var cookieDomnain = this.config.cookieDomain ? this.config.cookieDomain() : null;
|
|
1582
|
-
ApplicationInsights.Util.setCookie('ai_session', cookie.join('|') + ';expires=' + cookieExpiry.toUTCString(), cookieDomnain);
|
|
1583
|
-
this.cookieUpdatedTimestamp = ApplicationInsights.dateTime.Now();
|
|
1584
|
-
};
|
|
1585
|
-
_SessionManager.prototype.setStorage = function (guid, acq, renewal) {
|
|
1586
|
-
ApplicationInsights.Util.setStorage('ai_session', [guid, acq, renewal].join('|'));
|
|
1587
|
-
};
|
|
1588
|
-
_SessionManager.acquisitionSpan = 86400000;
|
|
1589
|
-
_SessionManager.renewalSpan = 1800000;
|
|
1590
|
-
_SessionManager.cookieUpdateInterval = 60000;
|
|
1591
|
-
return _SessionManager;
|
|
1592
|
-
}());
|
|
1593
|
-
Context._SessionManager = _SessionManager;
|
|
1594
|
-
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
1595
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1596
|
-
})(Microsoft || (Microsoft = {}));
|
|
1597
|
-
var Microsoft;
|
|
1598
|
-
(function (Microsoft) {
|
|
1599
|
-
var ApplicationInsights;
|
|
1600
|
-
(function (ApplicationInsights) {
|
|
1601
|
-
var Context;
|
|
1602
|
-
(function (Context) {
|
|
1603
|
-
"use strict";
|
|
1604
|
-
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
1605
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1606
|
-
})(Microsoft || (Microsoft = {}));
|
|
1607
|
-
var Microsoft;
|
|
1608
|
-
(function (Microsoft) {
|
|
1609
|
-
var ApplicationInsights;
|
|
1610
|
-
(function (ApplicationInsights) {
|
|
1611
|
-
var Context;
|
|
1612
|
-
(function (Context) {
|
|
1613
|
-
"use strict";
|
|
1614
|
-
var User = (function () {
|
|
1615
|
-
function User(config) {
|
|
1616
|
-
var cookie = ApplicationInsights.Util.getCookie(User.userCookieName);
|
|
1617
|
-
if (cookie) {
|
|
1618
|
-
var params = cookie.split(User.cookieSeparator);
|
|
1619
|
-
if (params.length > 0) {
|
|
1620
|
-
this.id = params[0];
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
this.config = config;
|
|
1624
|
-
if (!this.id) {
|
|
1625
|
-
this.id = ApplicationInsights.Util.newId();
|
|
1626
|
-
var date = new Date();
|
|
1627
|
-
var acqStr = ApplicationInsights.Util.toISOStringForIE8(date);
|
|
1628
|
-
this.accountAcquisitionDate = acqStr;
|
|
1629
|
-
date.setTime(date.getTime() + 31536000000);
|
|
1630
|
-
var newCookie = [this.id, acqStr];
|
|
1631
|
-
var cookieDomain = this.config.cookieDomain ? this.config.cookieDomain() : undefined;
|
|
1632
|
-
ApplicationInsights.Util.setCookie(User.userCookieName, newCookie.join(User.cookieSeparator) + ';expires=' + date.toUTCString(), cookieDomain);
|
|
1633
|
-
ApplicationInsights.Util.removeStorage('ai_session');
|
|
1634
|
-
}
|
|
1635
|
-
this.accountId = config.accountId ? config.accountId() : undefined;
|
|
1636
|
-
var authCookie = ApplicationInsights.Util.getCookie(User.authUserCookieName);
|
|
1637
|
-
if (authCookie) {
|
|
1638
|
-
authCookie = decodeURI(authCookie);
|
|
1639
|
-
var authCookieString = authCookie.split(User.cookieSeparator);
|
|
1640
|
-
if (authCookieString[0]) {
|
|
1641
|
-
this.authenticatedId = authCookieString[0];
|
|
1642
|
-
}
|
|
1643
|
-
if (authCookieString.length > 1 && authCookieString[1]) {
|
|
1644
|
-
this.accountId = authCookieString[1];
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
User.prototype.setAuthenticatedUserContext = function (authenticatedUserId, accountId) {
|
|
1649
|
-
var isInvalidInput = !this.validateUserInput(authenticatedUserId) || (accountId && !this.validateUserInput(accountId));
|
|
1650
|
-
if (isInvalidInput) {
|
|
1651
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.SetAuthContextFailedAccountName, "Setting auth user context failed. " +
|
|
1652
|
-
"User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.", true);
|
|
1653
|
-
return;
|
|
1654
|
-
}
|
|
1655
|
-
this.authenticatedId = authenticatedUserId;
|
|
1656
|
-
var authCookie = this.authenticatedId;
|
|
1657
|
-
if (accountId) {
|
|
1658
|
-
this.accountId = accountId;
|
|
1659
|
-
authCookie = [this.authenticatedId, this.accountId].join(User.cookieSeparator);
|
|
1660
|
-
}
|
|
1661
|
-
ApplicationInsights.Util.setCookie(User.authUserCookieName, encodeURI(authCookie), this.config.cookieDomain());
|
|
1662
|
-
};
|
|
1663
|
-
User.prototype.clearAuthenticatedUserContext = function () {
|
|
1664
|
-
this.authenticatedId = null;
|
|
1665
|
-
this.accountId = null;
|
|
1666
|
-
ApplicationInsights.Util.deleteCookie(User.authUserCookieName);
|
|
1667
|
-
};
|
|
1668
|
-
User.prototype.validateUserInput = function (id) {
|
|
1669
|
-
if (typeof id !== 'string' ||
|
|
1670
|
-
!id ||
|
|
1671
|
-
id.match(/,|;|=| |\|/)) {
|
|
1672
|
-
return false;
|
|
1673
|
-
}
|
|
1674
|
-
return true;
|
|
1675
|
-
};
|
|
1676
|
-
User.cookieSeparator = '|';
|
|
1677
|
-
User.userCookieName = 'ai_user';
|
|
1678
|
-
User.authUserCookieName = 'ai_authUser';
|
|
1679
|
-
return User;
|
|
1680
|
-
}());
|
|
1681
|
-
Context.User = User;
|
|
1682
|
-
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
1683
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1684
|
-
})(Microsoft || (Microsoft = {}));
|
|
1685
|
-
var Microsoft;
|
|
1686
|
-
(function (Microsoft) {
|
|
1687
|
-
var ApplicationInsights;
|
|
1688
|
-
(function (ApplicationInsights) {
|
|
1689
|
-
"use strict";
|
|
1690
|
-
var ArraySendBuffer = (function () {
|
|
1691
|
-
function ArraySendBuffer(config) {
|
|
1692
|
-
this._config = config;
|
|
1693
|
-
this._buffer = [];
|
|
1694
|
-
}
|
|
1695
|
-
ArraySendBuffer.prototype.enqueue = function (payload) {
|
|
1696
|
-
this._buffer.push(payload);
|
|
1697
|
-
};
|
|
1698
|
-
ArraySendBuffer.prototype.count = function () {
|
|
1699
|
-
return this._buffer.length;
|
|
1700
|
-
};
|
|
1701
|
-
ArraySendBuffer.prototype.clear = function () {
|
|
1702
|
-
this._buffer.length = 0;
|
|
1703
|
-
};
|
|
1704
|
-
ArraySendBuffer.prototype.getItems = function () {
|
|
1705
|
-
return this._buffer.slice(0);
|
|
1706
|
-
};
|
|
1707
|
-
ArraySendBuffer.prototype.batchPayloads = function (payload) {
|
|
1708
|
-
if (payload && payload.length > 0) {
|
|
1709
|
-
var batch = this._config.emitLineDelimitedJson() ?
|
|
1710
|
-
payload.join("\n") :
|
|
1711
|
-
"[" + payload.join(",") + "]";
|
|
1712
|
-
return batch;
|
|
1713
|
-
}
|
|
1714
|
-
return null;
|
|
1715
|
-
};
|
|
1716
|
-
ArraySendBuffer.prototype.markAsSent = function (payload) {
|
|
1717
|
-
this.clear();
|
|
1718
|
-
};
|
|
1719
|
-
ArraySendBuffer.prototype.clearSent = function (payload) {
|
|
1720
|
-
};
|
|
1721
|
-
return ArraySendBuffer;
|
|
1722
|
-
}());
|
|
1723
|
-
ApplicationInsights.ArraySendBuffer = ArraySendBuffer;
|
|
1724
|
-
var SessionStorageSendBuffer = (function () {
|
|
1725
|
-
function SessionStorageSendBuffer(config) {
|
|
1726
|
-
this._bufferFullMessageSent = false;
|
|
1727
|
-
this._config = config;
|
|
1728
|
-
var bufferItems = this.getBuffer(SessionStorageSendBuffer.BUFFER_KEY);
|
|
1729
|
-
var notDeliveredItems = this.getBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY);
|
|
1730
|
-
this._buffer = bufferItems.concat(notDeliveredItems);
|
|
1731
|
-
if (this._buffer.length > SessionStorageSendBuffer.MAX_BUFFER_SIZE) {
|
|
1732
|
-
this._buffer.length = SessionStorageSendBuffer.MAX_BUFFER_SIZE;
|
|
1733
|
-
}
|
|
1734
|
-
this.setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, []);
|
|
1735
|
-
this.setBuffer(SessionStorageSendBuffer.BUFFER_KEY, this._buffer);
|
|
1736
|
-
}
|
|
1737
|
-
SessionStorageSendBuffer.prototype.enqueue = function (payload) {
|
|
1738
|
-
if (this._buffer.length >= SessionStorageSendBuffer.MAX_BUFFER_SIZE) {
|
|
1739
|
-
if (!this._bufferFullMessageSent) {
|
|
1740
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.SessionStorageBufferFull, "Maximum buffer size reached: " + this._buffer.length, true);
|
|
1741
|
-
this._bufferFullMessageSent = true;
|
|
1742
|
-
}
|
|
1743
|
-
return;
|
|
1744
|
-
}
|
|
1745
|
-
this._buffer.push(payload);
|
|
1746
|
-
this.setBuffer(SessionStorageSendBuffer.BUFFER_KEY, this._buffer);
|
|
1747
|
-
};
|
|
1748
|
-
SessionStorageSendBuffer.prototype.count = function () {
|
|
1749
|
-
return this._buffer.length;
|
|
1750
|
-
};
|
|
1751
|
-
SessionStorageSendBuffer.prototype.clear = function () {
|
|
1752
|
-
this._buffer.length = 0;
|
|
1753
|
-
this.setBuffer(SessionStorageSendBuffer.BUFFER_KEY, []);
|
|
1754
|
-
this.setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, []);
|
|
1755
|
-
this._bufferFullMessageSent = false;
|
|
1756
|
-
};
|
|
1757
|
-
SessionStorageSendBuffer.prototype.getItems = function () {
|
|
1758
|
-
return this._buffer.slice(0);
|
|
1759
|
-
};
|
|
1760
|
-
SessionStorageSendBuffer.prototype.batchPayloads = function (payload) {
|
|
1761
|
-
if (payload && payload.length > 0) {
|
|
1762
|
-
var batch = this._config.emitLineDelimitedJson() ?
|
|
1763
|
-
payload.join("\n") :
|
|
1764
|
-
"[" + payload.join(",") + "]";
|
|
1765
|
-
return batch;
|
|
1766
|
-
}
|
|
1767
|
-
return null;
|
|
1768
|
-
};
|
|
1769
|
-
SessionStorageSendBuffer.prototype.markAsSent = function (payload) {
|
|
1770
|
-
this._buffer = this.removePayloadsFromBuffer(payload, this._buffer);
|
|
1771
|
-
this.setBuffer(SessionStorageSendBuffer.BUFFER_KEY, this._buffer);
|
|
1772
|
-
var sentElements = this.getBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY);
|
|
1773
|
-
if (sentElements instanceof Array && payload instanceof Array) {
|
|
1774
|
-
sentElements = sentElements.concat(payload);
|
|
1775
|
-
if (sentElements.length > SessionStorageSendBuffer.MAX_BUFFER_SIZE) {
|
|
1776
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.SessionStorageBufferFull, "Sent buffer reached its maximum size: " + sentElements.length, true);
|
|
1777
|
-
sentElements.length = SessionStorageSendBuffer.MAX_BUFFER_SIZE;
|
|
1778
|
-
}
|
|
1779
|
-
this.setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, sentElements);
|
|
1780
|
-
}
|
|
1781
|
-
};
|
|
1782
|
-
SessionStorageSendBuffer.prototype.clearSent = function (payload) {
|
|
1783
|
-
var sentElements = this.getBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY);
|
|
1784
|
-
sentElements = this.removePayloadsFromBuffer(payload, sentElements);
|
|
1785
|
-
this.setBuffer(SessionStorageSendBuffer.SENT_BUFFER_KEY, sentElements);
|
|
1786
|
-
};
|
|
1787
|
-
SessionStorageSendBuffer.prototype.removePayloadsFromBuffer = function (payloads, buffer) {
|
|
1788
|
-
var remaining = [];
|
|
1789
|
-
for (var i in buffer) {
|
|
1790
|
-
var contains = false;
|
|
1791
|
-
for (var j in payloads) {
|
|
1792
|
-
if (payloads[j] === buffer[i]) {
|
|
1793
|
-
contains = true;
|
|
1794
|
-
break;
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
if (!contains) {
|
|
1798
|
-
remaining.push(buffer[i]);
|
|
1799
|
-
}
|
|
1800
|
-
}
|
|
1801
|
-
;
|
|
1802
|
-
return remaining;
|
|
1803
|
-
};
|
|
1804
|
-
SessionStorageSendBuffer.prototype.getBuffer = function (key) {
|
|
1805
|
-
try {
|
|
1806
|
-
var bufferJson = ApplicationInsights.Util.getSessionStorage(key);
|
|
1807
|
-
if (bufferJson) {
|
|
1808
|
-
var buffer = JSON.parse(bufferJson);
|
|
1809
|
-
if (buffer) {
|
|
1810
|
-
return buffer;
|
|
1811
|
-
}
|
|
1812
|
-
}
|
|
1813
|
-
}
|
|
1814
|
-
catch (e) {
|
|
1815
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.FailedToRestoreStorageBuffer, " storage key: " + key + ", " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
|
|
1816
|
-
}
|
|
1817
|
-
return [];
|
|
1818
|
-
};
|
|
1819
|
-
SessionStorageSendBuffer.prototype.setBuffer = function (key, buffer) {
|
|
1820
|
-
try {
|
|
1821
|
-
var bufferJson = JSON.stringify(buffer);
|
|
1822
|
-
ApplicationInsights.Util.setSessionStorage(key, bufferJson);
|
|
1823
|
-
}
|
|
1824
|
-
catch (e) {
|
|
1825
|
-
ApplicationInsights.Util.setSessionStorage(key, JSON.stringify([]));
|
|
1826
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.FailedToSetStorageBuffer, " storage key: " + key + ", " + ApplicationInsights.Util.getExceptionName(e) + ". Buffer cleared", { exception: ApplicationInsights.Util.dump(e) });
|
|
1827
|
-
}
|
|
1828
|
-
};
|
|
1829
|
-
SessionStorageSendBuffer.BUFFER_KEY = "AI_buffer";
|
|
1830
|
-
SessionStorageSendBuffer.SENT_BUFFER_KEY = "AI_sentBuffer";
|
|
1831
|
-
SessionStorageSendBuffer.MAX_BUFFER_SIZE = 2000;
|
|
1832
|
-
return SessionStorageSendBuffer;
|
|
1833
|
-
}());
|
|
1834
|
-
ApplicationInsights.SessionStorageSendBuffer = SessionStorageSendBuffer;
|
|
1835
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
1836
|
-
})(Microsoft || (Microsoft = {}));
|
|
1837
|
-
;
|
|
1838
|
-
var Microsoft;
|
|
1839
|
-
(function (Microsoft) {
|
|
1840
|
-
var ApplicationInsights;
|
|
1841
|
-
(function (ApplicationInsights) {
|
|
1842
|
-
"use strict";
|
|
1843
|
-
var Sender = (function () {
|
|
1844
|
-
function Sender(config) {
|
|
1845
|
-
this._XMLHttpRequestSupported = false;
|
|
1846
|
-
this._consecutiveErrors = 0;
|
|
1847
|
-
this._retryAt = null;
|
|
1848
|
-
this._lastSend = 0;
|
|
1849
|
-
this._config = config;
|
|
1850
|
-
this._sender = null;
|
|
1851
|
-
this._buffer = (ApplicationInsights.Util.canUseSessionStorage() && this._config.enableSessionStorageBuffer())
|
|
1852
|
-
? new ApplicationInsights.SessionStorageSendBuffer(config) : new ApplicationInsights.ArraySendBuffer(config);
|
|
1853
|
-
if (!this._config.isBeaconApiDisabled() && ApplicationInsights.Util.IsBeaconApiSupported()) {
|
|
1854
|
-
this._sender = this._beaconSender;
|
|
1855
|
-
}
|
|
1856
|
-
else {
|
|
1857
|
-
if (typeof XMLHttpRequest != "undefined") {
|
|
1858
|
-
var testXhr = new XMLHttpRequest();
|
|
1859
|
-
if ("withCredentials" in testXhr) {
|
|
1860
|
-
this._sender = this._xhrSender;
|
|
1861
|
-
this._XMLHttpRequestSupported = true;
|
|
1862
|
-
}
|
|
1863
|
-
else if (typeof XDomainRequest !== "undefined") {
|
|
1864
|
-
this._sender = this._xdrSender;
|
|
1865
|
-
}
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1868
|
-
}
|
|
1869
|
-
Sender.prototype.send = function (envelope) {
|
|
1870
|
-
try {
|
|
1871
|
-
if (this._config.disableTelemetry()) {
|
|
1872
|
-
return;
|
|
1873
|
-
}
|
|
1874
|
-
if (!envelope) {
|
|
1875
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.CannotSendEmptyTelemetry, "Cannot send empty telemetry");
|
|
1876
|
-
return;
|
|
1877
|
-
}
|
|
1878
|
-
if (!this._sender) {
|
|
1879
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.SenderNotInitialized, "Sender was not initialized");
|
|
1880
|
-
return;
|
|
1881
|
-
}
|
|
1882
|
-
var payload = ApplicationInsights.Serializer.serialize(envelope);
|
|
1883
|
-
var bufferPayload = this._buffer.getItems();
|
|
1884
|
-
var batch = this._buffer.batchPayloads(bufferPayload);
|
|
1885
|
-
if (batch && (batch.length + payload.length > this._config.maxBatchSizeInBytes())) {
|
|
1886
|
-
this.triggerSend();
|
|
1887
|
-
}
|
|
1888
|
-
this._buffer.enqueue(payload);
|
|
1889
|
-
this._setupTimer();
|
|
1890
|
-
}
|
|
1891
|
-
catch (e) {
|
|
1892
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.FailedAddingTelemetryToBuffer, "Failed adding telemetry to the sender's buffer, some telemetry will be lost: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
|
|
1893
|
-
}
|
|
1894
|
-
};
|
|
1895
|
-
Sender.prototype._setupTimer = function () {
|
|
1896
|
-
var _this = this;
|
|
1897
|
-
if (!this._timeoutHandle) {
|
|
1898
|
-
var retryInterval = this._retryAt ? Math.max(0, this._retryAt - Date.now()) : 0;
|
|
1899
|
-
var timerValue = Math.max(this._config.maxBatchInterval(), retryInterval);
|
|
1900
|
-
this._timeoutHandle = setTimeout(function () {
|
|
1901
|
-
_this.triggerSend();
|
|
1902
|
-
}, timerValue);
|
|
1903
|
-
}
|
|
1904
|
-
};
|
|
1905
|
-
Sender.prototype._getSizeInBytes = function (list) {
|
|
1906
|
-
var size = 0;
|
|
1907
|
-
if (list && list.length) {
|
|
1908
|
-
for (var i = 0; i < list.length; i++) {
|
|
1909
|
-
var item = list[i];
|
|
1910
|
-
if (item && item.length) {
|
|
1911
|
-
size += item.length;
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
|
-
}
|
|
1915
|
-
return size;
|
|
1916
|
-
};
|
|
1917
|
-
Sender.prototype.triggerSend = function (async) {
|
|
1918
|
-
if (async === void 0) { async = true; }
|
|
1919
|
-
try {
|
|
1920
|
-
if (!this._config.disableTelemetry()) {
|
|
1921
|
-
if (this._buffer.count() > 0) {
|
|
1922
|
-
var payload = this._buffer.getItems();
|
|
1923
|
-
this._sender(payload, async);
|
|
1924
|
-
}
|
|
1925
|
-
this._lastSend = +new Date;
|
|
1926
|
-
}
|
|
1927
|
-
else {
|
|
1928
|
-
this._buffer.clear();
|
|
1929
|
-
}
|
|
1930
|
-
clearTimeout(this._timeoutHandle);
|
|
1931
|
-
this._timeoutHandle = null;
|
|
1932
|
-
this._retryAt = null;
|
|
1933
|
-
}
|
|
1934
|
-
catch (e) {
|
|
1935
|
-
if (!ApplicationInsights.Util.getIEVersion() || ApplicationInsights.Util.getIEVersion() > 9) {
|
|
1936
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.TransmissionFailed, "Telemetry transmission failed, some telemetry will be lost: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
};
|
|
1940
|
-
Sender.prototype._setRetryTime = function () {
|
|
1941
|
-
var SlotDelayInSeconds = 10;
|
|
1942
|
-
var delayInSeconds;
|
|
1943
|
-
if (this._consecutiveErrors <= 1) {
|
|
1944
|
-
delayInSeconds = SlotDelayInSeconds;
|
|
1945
|
-
}
|
|
1946
|
-
else {
|
|
1947
|
-
var backOffSlot = (Math.pow(2, this._consecutiveErrors) - 1) / 2;
|
|
1948
|
-
var backOffDelay = Math.floor(Math.random() * backOffSlot * SlotDelayInSeconds) + 1;
|
|
1949
|
-
delayInSeconds = Math.max(Math.min(backOffDelay, 3600), SlotDelayInSeconds);
|
|
1950
|
-
}
|
|
1951
|
-
var retryAfterTimeSpan = Date.now() + (delayInSeconds * 1000);
|
|
1952
|
-
this._retryAt = retryAfterTimeSpan;
|
|
1953
|
-
};
|
|
1954
|
-
Sender.prototype._parseResponse = function (response) {
|
|
1955
|
-
try {
|
|
1956
|
-
var result = JSON.parse(response);
|
|
1957
|
-
if (result && result.itemsReceived && result.itemsReceived >= result.itemsAccepted &&
|
|
1958
|
-
result.itemsReceived - result.itemsAccepted == result.errors.length) {
|
|
1959
|
-
return result;
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
|
-
catch (e) {
|
|
1963
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.InvalidBackendResponse, "Cannot parse the response. " + ApplicationInsights.Util.getExceptionName(e));
|
|
1964
|
-
}
|
|
1965
|
-
return null;
|
|
1966
|
-
};
|
|
1967
|
-
Sender.prototype._isRetriable = function (statusCode) {
|
|
1968
|
-
return statusCode == 408
|
|
1969
|
-
|| statusCode == 429
|
|
1970
|
-
|| statusCode == 500
|
|
1971
|
-
|| statusCode == 503;
|
|
1972
|
-
};
|
|
1973
|
-
Sender.prototype._resendPayload = function (payload) {
|
|
1974
|
-
if (!payload || payload.length === 0) {
|
|
1975
|
-
return;
|
|
1976
|
-
}
|
|
1977
|
-
this._buffer.clearSent(payload);
|
|
1978
|
-
this._consecutiveErrors++;
|
|
1979
|
-
for (var _i = 0, payload_1 = payload; _i < payload_1.length; _i++) {
|
|
1980
|
-
var item = payload_1[_i];
|
|
1981
|
-
this._buffer.enqueue(item);
|
|
1982
|
-
}
|
|
1983
|
-
this._setRetryTime();
|
|
1984
|
-
this._setupTimer();
|
|
1985
|
-
};
|
|
1986
|
-
Sender.prototype._formatErrorMessageXhr = function (xhr, message) {
|
|
1987
|
-
if (xhr) {
|
|
1988
|
-
return "XMLHttpRequest,Status:" + xhr.status + ",Response:" + xhr.responseText || xhr.response || "";
|
|
1989
|
-
}
|
|
1990
|
-
return message;
|
|
1991
|
-
};
|
|
1992
|
-
Sender.prototype._formatErrorMessageXdr = function (xdr, message) {
|
|
1993
|
-
if (xdr) {
|
|
1994
|
-
return "XDomainRequest,Response:" + xdr.responseText || "";
|
|
1995
|
-
}
|
|
1996
|
-
return message;
|
|
1997
|
-
};
|
|
1998
|
-
Sender.prototype._xhrSender = function (payload, isAsync) {
|
|
1999
|
-
var _this = this;
|
|
2000
|
-
var xhr = new XMLHttpRequest();
|
|
2001
|
-
xhr[ApplicationInsights.AjaxMonitor.DisabledPropertyName] = true;
|
|
2002
|
-
xhr.open("POST", this._config.endpointUrl(), isAsync);
|
|
2003
|
-
xhr.setRequestHeader("Content-type", "application/json");
|
|
2004
|
-
xhr.onreadystatechange = function () { return _this._xhrReadyStateChange(xhr, payload, payload.length); };
|
|
2005
|
-
xhr.onerror = function (event) { return _this._onError(payload, _this._formatErrorMessageXhr(xhr), event); };
|
|
2006
|
-
var batch = this._buffer.batchPayloads(payload);
|
|
2007
|
-
xhr.send(batch);
|
|
2008
|
-
this._buffer.markAsSent(payload);
|
|
2009
|
-
};
|
|
2010
|
-
Sender.prototype._xdrSender = function (payload, isAsync) {
|
|
2011
|
-
var _this = this;
|
|
2012
|
-
var xdr = new XDomainRequest();
|
|
2013
|
-
xdr.onload = function () { return _this._xdrOnLoad(xdr, payload); };
|
|
2014
|
-
xdr.onerror = function (event) { return _this._onError(payload, _this._formatErrorMessageXdr(xdr), event); };
|
|
2015
|
-
var hostingProtocol = window.location.protocol;
|
|
2016
|
-
if (this._config.endpointUrl().lastIndexOf(hostingProtocol, 0) !== 0) {
|
|
2017
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.TransmissionFailed, ". " +
|
|
2018
|
-
"Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol.");
|
|
2019
|
-
this._buffer.clear();
|
|
2020
|
-
return;
|
|
2021
|
-
}
|
|
2022
|
-
var endpointUrl = this._config.endpointUrl().replace(/^(https?:)/, "");
|
|
2023
|
-
xdr.open('POST', endpointUrl);
|
|
2024
|
-
var batch = this._buffer.batchPayloads(payload);
|
|
2025
|
-
xdr.send(batch);
|
|
2026
|
-
this._buffer.markAsSent(payload);
|
|
2027
|
-
};
|
|
2028
|
-
Sender.prototype._beaconSender = function (payload, isAsync) {
|
|
2029
|
-
var url = this._config.endpointUrl();
|
|
2030
|
-
var batch = this._buffer.batchPayloads(payload);
|
|
2031
|
-
var queued = navigator.sendBeacon(url, batch);
|
|
2032
|
-
if (queued) {
|
|
2033
|
-
this._buffer.markAsSent(payload);
|
|
2034
|
-
}
|
|
2035
|
-
else {
|
|
2036
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.TransmissionFailed, ". " + "Failed to send telemetry with Beacon API.");
|
|
2037
|
-
}
|
|
2038
|
-
};
|
|
2039
|
-
Sender.prototype._xhrReadyStateChange = function (xhr, payload, countOfItemsInPayload) {
|
|
2040
|
-
if (xhr.readyState === 4) {
|
|
2041
|
-
if ((xhr.status < 200 || xhr.status >= 300) && xhr.status !== 0) {
|
|
2042
|
-
if (!this._config.isRetryDisabled() && this._isRetriable(xhr.status)) {
|
|
2043
|
-
this._resendPayload(payload);
|
|
2044
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.TransmissionFailed, ". " +
|
|
2045
|
-
"Response code " + xhr.status + ". Will retry to send " + payload.length + " items.");
|
|
2046
|
-
}
|
|
2047
|
-
else {
|
|
2048
|
-
this._onError(payload, this._formatErrorMessageXhr(xhr));
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
|
-
else {
|
|
2052
|
-
if (xhr.status === 206) {
|
|
2053
|
-
var response = this._parseResponse(xhr.responseText || xhr.response);
|
|
2054
|
-
if (response && !this._config.isRetryDisabled()) {
|
|
2055
|
-
this._onPartialSuccess(payload, response);
|
|
2056
|
-
}
|
|
2057
|
-
else {
|
|
2058
|
-
this._onError(payload, this._formatErrorMessageXhr(xhr));
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
else {
|
|
2062
|
-
this._consecutiveErrors = 0;
|
|
2063
|
-
this._onSuccess(payload, countOfItemsInPayload);
|
|
2064
|
-
}
|
|
2065
|
-
}
|
|
2066
|
-
}
|
|
2067
|
-
};
|
|
2068
|
-
Sender.prototype._xdrOnLoad = function (xdr, payload) {
|
|
2069
|
-
if (xdr && (xdr.responseText + "" === "200" || xdr.responseText === "")) {
|
|
2070
|
-
this._consecutiveErrors = 0;
|
|
2071
|
-
this._onSuccess(payload, 0);
|
|
2072
|
-
}
|
|
2073
|
-
else {
|
|
2074
|
-
var results = this._parseResponse(xdr.responseText);
|
|
2075
|
-
if (results && results.itemsReceived && results.itemsReceived > results.itemsAccepted
|
|
2076
|
-
&& !this._config.isRetryDisabled()) {
|
|
2077
|
-
this._onPartialSuccess(payload, results);
|
|
2078
|
-
}
|
|
2079
|
-
else {
|
|
2080
|
-
this._onError(payload, this._formatErrorMessageXdr(xdr));
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2083
|
-
};
|
|
2084
|
-
Sender.prototype._onPartialSuccess = function (payload, results) {
|
|
2085
|
-
var failed = [];
|
|
2086
|
-
var retry = [];
|
|
2087
|
-
var errors = results.errors.reverse();
|
|
2088
|
-
for (var _i = 0, errors_1 = errors; _i < errors_1.length; _i++) {
|
|
2089
|
-
var error = errors_1[_i];
|
|
2090
|
-
var extracted = payload.splice(error.index, 1)[0];
|
|
2091
|
-
if (this._isRetriable(error.statusCode)) {
|
|
2092
|
-
retry.push(extracted);
|
|
2093
|
-
}
|
|
2094
|
-
else {
|
|
2095
|
-
failed.push(extracted);
|
|
2096
|
-
}
|
|
2097
|
-
}
|
|
2098
|
-
if (payload.length > 0) {
|
|
2099
|
-
this._onSuccess(payload, results.itemsAccepted);
|
|
2100
|
-
}
|
|
2101
|
-
if (failed.length > 0) {
|
|
2102
|
-
this._onError(failed, this._formatErrorMessageXhr(null, ['partial success', results.itemsAccepted, 'of', results.itemsReceived].join(' ')));
|
|
2103
|
-
}
|
|
2104
|
-
if (retry.length > 0) {
|
|
2105
|
-
this._resendPayload(retry);
|
|
2106
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.TransmissionFailed, "Partial success. " +
|
|
2107
|
-
"Delivered: " + payload.length + ", Failed: " + failed.length +
|
|
2108
|
-
". Will retry to send " + retry.length + " our of " + results.itemsReceived + " items");
|
|
2109
|
-
}
|
|
2110
|
-
};
|
|
2111
|
-
Sender.prototype._onError = function (payload, message, event) {
|
|
2112
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.OnError, "Failed to send telemetry.", { message: message });
|
|
2113
|
-
this._buffer.clearSent(payload);
|
|
2114
|
-
};
|
|
2115
|
-
Sender.prototype._onSuccess = function (payload, countOfItemsInPayload) {
|
|
2116
|
-
this._buffer.clearSent(payload);
|
|
2117
|
-
};
|
|
2118
|
-
Sender.MaxBeaconPayloadSize = 65536;
|
|
2119
|
-
return Sender;
|
|
2120
|
-
}());
|
|
2121
|
-
ApplicationInsights.Sender = Sender;
|
|
2122
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
2123
|
-
})(Microsoft || (Microsoft = {}));
|
|
2124
|
-
var Microsoft;
|
|
2125
|
-
(function (Microsoft) {
|
|
2126
|
-
var ApplicationInsights;
|
|
2127
|
-
(function (ApplicationInsights) {
|
|
2128
|
-
"use strict";
|
|
2129
|
-
var SplitTest = (function () {
|
|
2130
|
-
function SplitTest() {
|
|
2131
|
-
this.hashCodeGeneragor = new ApplicationInsights.HashCodeScoreGenerator();
|
|
2132
|
-
}
|
|
2133
|
-
SplitTest.prototype.isEnabled = function (key, percentEnabled) {
|
|
2134
|
-
return this.hashCodeGeneragor.getHashCodeScore(key) < percentEnabled;
|
|
2135
|
-
};
|
|
2136
|
-
return SplitTest;
|
|
2137
|
-
}());
|
|
2138
|
-
ApplicationInsights.SplitTest = SplitTest;
|
|
2139
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
2140
|
-
})(Microsoft || (Microsoft = {}));
|
|
2141
|
-
var Microsoft;
|
|
2142
|
-
(function (Microsoft) {
|
|
2143
|
-
var Telemetry;
|
|
2144
|
-
(function (Telemetry) {
|
|
2145
|
-
"use strict";
|
|
2146
|
-
var Domain = (function () {
|
|
2147
|
-
function Domain() {
|
|
2148
|
-
}
|
|
2149
|
-
return Domain;
|
|
2150
|
-
}());
|
|
2151
|
-
Telemetry.Domain = Domain;
|
|
2152
|
-
})(Telemetry = Microsoft.Telemetry || (Microsoft.Telemetry = {}));
|
|
2153
|
-
})(Microsoft || (Microsoft = {}));
|
|
2154
|
-
var AI;
|
|
2155
|
-
(function (AI) {
|
|
2156
|
-
"use strict";
|
|
2157
|
-
(function (SeverityLevel) {
|
|
2158
|
-
SeverityLevel[SeverityLevel["Verbose"] = 0] = "Verbose";
|
|
2159
|
-
SeverityLevel[SeverityLevel["Information"] = 1] = "Information";
|
|
2160
|
-
SeverityLevel[SeverityLevel["Warning"] = 2] = "Warning";
|
|
2161
|
-
SeverityLevel[SeverityLevel["Error"] = 3] = "Error";
|
|
2162
|
-
SeverityLevel[SeverityLevel["Critical"] = 4] = "Critical";
|
|
2163
|
-
})(AI.SeverityLevel || (AI.SeverityLevel = {}));
|
|
2164
|
-
var SeverityLevel = AI.SeverityLevel;
|
|
2165
|
-
})(AI || (AI = {}));
|
|
2166
|
-
var AI;
|
|
2167
|
-
(function (AI) {
|
|
2168
|
-
"use strict";
|
|
2169
|
-
var MessageData = (function (_super) {
|
|
2170
|
-
__extends(MessageData, _super);
|
|
2171
|
-
function MessageData() {
|
|
2172
|
-
_super.call(this);
|
|
2173
|
-
this.ver = 2;
|
|
2174
|
-
this.properties = {};
|
|
2175
|
-
_super.call(this);
|
|
2176
|
-
}
|
|
2177
|
-
return MessageData;
|
|
2178
|
-
}(Microsoft.Telemetry.Domain));
|
|
2179
|
-
AI.MessageData = MessageData;
|
|
2180
|
-
})(AI || (AI = {}));
|
|
2181
|
-
var Microsoft;
|
|
2182
|
-
(function (Microsoft) {
|
|
2183
|
-
var ApplicationInsights;
|
|
2184
|
-
(function (ApplicationInsights) {
|
|
2185
|
-
var Telemetry;
|
|
2186
|
-
(function (Telemetry) {
|
|
2187
|
-
var Common;
|
|
2188
|
-
(function (Common) {
|
|
2189
|
-
"use strict";
|
|
2190
|
-
var DataSanitizer = (function () {
|
|
2191
|
-
function DataSanitizer() {
|
|
2192
|
-
}
|
|
2193
|
-
DataSanitizer.sanitizeKeyAndAddUniqueness = function (key, map) {
|
|
2194
|
-
var origLength = key.length;
|
|
2195
|
-
var field = DataSanitizer.sanitizeKey(key);
|
|
2196
|
-
if (field.length !== origLength) {
|
|
2197
|
-
var i = 0;
|
|
2198
|
-
var uniqueField = field;
|
|
2199
|
-
while (map[uniqueField] !== undefined) {
|
|
2200
|
-
i++;
|
|
2201
|
-
uniqueField = field.substring(0, DataSanitizer.MAX_NAME_LENGTH - 3) + DataSanitizer.padNumber(i);
|
|
2202
|
-
}
|
|
2203
|
-
field = uniqueField;
|
|
2204
|
-
}
|
|
2205
|
-
return field;
|
|
2206
|
-
};
|
|
2207
|
-
DataSanitizer.sanitizeKey = function (name) {
|
|
2208
|
-
if (name) {
|
|
2209
|
-
name = ApplicationInsights.Util.trim(name.toString());
|
|
2210
|
-
if (name.length > DataSanitizer.MAX_NAME_LENGTH) {
|
|
2211
|
-
name = name.substring(0, DataSanitizer.MAX_NAME_LENGTH);
|
|
2212
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + DataSanitizer.MAX_NAME_LENGTH + " characters.", { name: name }, true);
|
|
2213
|
-
}
|
|
2214
|
-
}
|
|
2215
|
-
return name;
|
|
2216
|
-
};
|
|
2217
|
-
DataSanitizer.sanitizeString = function (value) {
|
|
2218
|
-
if (value) {
|
|
2219
|
-
value = ApplicationInsights.Util.trim(value);
|
|
2220
|
-
if (value.toString().length > DataSanitizer.MAX_STRING_LENGTH) {
|
|
2221
|
-
value = value.toString().substring(0, DataSanitizer.MAX_STRING_LENGTH);
|
|
2222
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + DataSanitizer.MAX_STRING_LENGTH + " characters.", { value: value }, true);
|
|
2223
|
-
}
|
|
2224
|
-
}
|
|
2225
|
-
return value;
|
|
2226
|
-
};
|
|
2227
|
-
DataSanitizer.sanitizeUrl = function (url) {
|
|
2228
|
-
if (url) {
|
|
2229
|
-
url = ApplicationInsights.Util.trim(url);
|
|
2230
|
-
if (url.length > DataSanitizer.MAX_URL_LENGTH) {
|
|
2231
|
-
url = url.substring(0, DataSanitizer.MAX_URL_LENGTH);
|
|
2232
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.UrlTooLong, "url is too long, it has been truncated to " + DataSanitizer.MAX_URL_LENGTH + " characters.", { url: url }, true);
|
|
2233
|
-
}
|
|
2234
|
-
}
|
|
2235
|
-
return url;
|
|
2236
|
-
};
|
|
2237
|
-
DataSanitizer.sanitizeMessage = function (message) {
|
|
2238
|
-
if (message) {
|
|
2239
|
-
if (message.length > DataSanitizer.MAX_MESSAGE_LENGTH) {
|
|
2240
|
-
message = message.substring(0, DataSanitizer.MAX_MESSAGE_LENGTH);
|
|
2241
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + DataSanitizer.MAX_MESSAGE_LENGTH + " characters.", { message: message }, true);
|
|
2242
|
-
}
|
|
2243
|
-
}
|
|
2244
|
-
return message;
|
|
2245
|
-
};
|
|
2246
|
-
DataSanitizer.sanitizeException = function (exception) {
|
|
2247
|
-
if (exception) {
|
|
2248
|
-
if (exception.length > DataSanitizer.MAX_EXCEPTION_LENGTH) {
|
|
2249
|
-
exception = exception.substring(0, DataSanitizer.MAX_EXCEPTION_LENGTH);
|
|
2250
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + DataSanitizer.MAX_EXCEPTION_LENGTH + " characters.", { exception: exception }, true);
|
|
2251
|
-
}
|
|
2252
|
-
}
|
|
2253
|
-
return exception;
|
|
2254
|
-
};
|
|
2255
|
-
DataSanitizer.sanitizeProperties = function (properties) {
|
|
2256
|
-
if (properties) {
|
|
2257
|
-
var tempProps = {};
|
|
2258
|
-
for (var prop in properties) {
|
|
2259
|
-
var value = DataSanitizer.sanitizeString(properties[prop]);
|
|
2260
|
-
prop = DataSanitizer.sanitizeKeyAndAddUniqueness(prop, tempProps);
|
|
2261
|
-
tempProps[prop] = value;
|
|
2262
|
-
}
|
|
2263
|
-
properties = tempProps;
|
|
2264
|
-
}
|
|
2265
|
-
return properties;
|
|
2266
|
-
};
|
|
2267
|
-
DataSanitizer.sanitizeMeasurements = function (measurements) {
|
|
2268
|
-
if (measurements) {
|
|
2269
|
-
var tempMeasurements = {};
|
|
2270
|
-
for (var measure in measurements) {
|
|
2271
|
-
var value = measurements[measure];
|
|
2272
|
-
measure = DataSanitizer.sanitizeKeyAndAddUniqueness(measure, tempMeasurements);
|
|
2273
|
-
tempMeasurements[measure] = value;
|
|
2274
|
-
}
|
|
2275
|
-
measurements = tempMeasurements;
|
|
2276
|
-
}
|
|
2277
|
-
return measurements;
|
|
2278
|
-
};
|
|
2279
|
-
DataSanitizer.padNumber = function (num) {
|
|
2280
|
-
var s = "00" + num;
|
|
2281
|
-
return s.substr(s.length - 3);
|
|
2282
|
-
};
|
|
2283
|
-
DataSanitizer.MAX_NAME_LENGTH = 150;
|
|
2284
|
-
DataSanitizer.MAX_STRING_LENGTH = 1024;
|
|
2285
|
-
DataSanitizer.MAX_URL_LENGTH = 2048;
|
|
2286
|
-
DataSanitizer.MAX_MESSAGE_LENGTH = 32768;
|
|
2287
|
-
DataSanitizer.MAX_EXCEPTION_LENGTH = 32768;
|
|
2288
|
-
return DataSanitizer;
|
|
2289
|
-
}());
|
|
2290
|
-
Common.DataSanitizer = DataSanitizer;
|
|
2291
|
-
})(Common = Telemetry.Common || (Telemetry.Common = {}));
|
|
2292
|
-
})(Telemetry = ApplicationInsights.Telemetry || (ApplicationInsights.Telemetry = {}));
|
|
2293
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
2294
|
-
})(Microsoft || (Microsoft = {}));
|
|
2295
|
-
var Microsoft;
|
|
2296
|
-
(function (Microsoft) {
|
|
2297
|
-
var ApplicationInsights;
|
|
2298
|
-
(function (ApplicationInsights) {
|
|
2299
|
-
var Telemetry;
|
|
2300
|
-
(function (Telemetry) {
|
|
2301
|
-
"use strict";
|
|
2302
|
-
var Trace = (function (_super) {
|
|
2303
|
-
__extends(Trace, _super);
|
|
2304
|
-
function Trace(message, properties, severityLevel) {
|
|
2305
|
-
_super.call(this);
|
|
2306
|
-
this.aiDataContract = {
|
|
2307
|
-
ver: ApplicationInsights.FieldType.Required,
|
|
2308
|
-
message: ApplicationInsights.FieldType.Required,
|
|
2309
|
-
severityLevel: ApplicationInsights.FieldType.Default,
|
|
2310
|
-
properties: ApplicationInsights.FieldType.Default
|
|
2311
|
-
};
|
|
2312
|
-
message = message || ApplicationInsights.Util.NotSpecified;
|
|
2313
|
-
this.message = Telemetry.Common.DataSanitizer.sanitizeMessage(message);
|
|
2314
|
-
this.properties = Telemetry.Common.DataSanitizer.sanitizeProperties(properties);
|
|
2315
|
-
if (severityLevel) {
|
|
2316
|
-
this.severityLevel = severityLevel;
|
|
2317
|
-
}
|
|
2318
|
-
}
|
|
2319
|
-
Trace.envelopeType = "Microsoft.ApplicationInsights.{0}.Message";
|
|
2320
|
-
Trace.dataType = "MessageData";
|
|
2321
|
-
return Trace;
|
|
2322
|
-
}(AI.MessageData));
|
|
2323
|
-
Telemetry.Trace = Trace;
|
|
2324
|
-
})(Telemetry = ApplicationInsights.Telemetry || (ApplicationInsights.Telemetry = {}));
|
|
2325
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
2326
|
-
})(Microsoft || (Microsoft = {}));
|
|
2327
|
-
var AI;
|
|
2328
|
-
(function (AI) {
|
|
2329
|
-
"use strict";
|
|
2330
|
-
var EventData = (function (_super) {
|
|
2331
|
-
__extends(EventData, _super);
|
|
2332
|
-
function EventData() {
|
|
2333
|
-
_super.call(this);
|
|
2334
|
-
this.ver = 2;
|
|
2335
|
-
this.properties = {};
|
|
2336
|
-
this.measurements = {};
|
|
2337
|
-
_super.call(this);
|
|
2338
|
-
}
|
|
2339
|
-
return EventData;
|
|
2340
|
-
}(Microsoft.Telemetry.Domain));
|
|
2341
|
-
AI.EventData = EventData;
|
|
2342
|
-
})(AI || (AI = {}));
|
|
2343
|
-
var Microsoft;
|
|
2344
|
-
(function (Microsoft) {
|
|
2345
|
-
var ApplicationInsights;
|
|
2346
|
-
(function (ApplicationInsights) {
|
|
2347
|
-
var Telemetry;
|
|
2348
|
-
(function (Telemetry) {
|
|
2349
|
-
"use strict";
|
|
2350
|
-
var Event = (function (_super) {
|
|
2351
|
-
__extends(Event, _super);
|
|
2352
|
-
function Event(name, properties, measurements) {
|
|
2353
|
-
_super.call(this);
|
|
2354
|
-
this.aiDataContract = {
|
|
2355
|
-
ver: ApplicationInsights.FieldType.Required,
|
|
2356
|
-
name: ApplicationInsights.FieldType.Required,
|
|
2357
|
-
properties: ApplicationInsights.FieldType.Default,
|
|
2358
|
-
measurements: ApplicationInsights.FieldType.Default
|
|
2359
|
-
};
|
|
2360
|
-
this.name = ApplicationInsights.Telemetry.Common.DataSanitizer.sanitizeString(name) || ApplicationInsights.Util.NotSpecified;
|
|
2361
|
-
this.properties = ApplicationInsights.Telemetry.Common.DataSanitizer.sanitizeProperties(properties);
|
|
2362
|
-
this.measurements = ApplicationInsights.Telemetry.Common.DataSanitizer.sanitizeMeasurements(measurements);
|
|
2363
|
-
}
|
|
2364
|
-
Event.envelopeType = "Microsoft.ApplicationInsights.{0}.Event";
|
|
2365
|
-
Event.dataType = "EventData";
|
|
2366
|
-
return Event;
|
|
2367
|
-
}(AI.EventData));
|
|
2368
|
-
Telemetry.Event = Event;
|
|
2369
|
-
})(Telemetry = ApplicationInsights.Telemetry || (ApplicationInsights.Telemetry = {}));
|
|
2370
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
2371
|
-
})(Microsoft || (Microsoft = {}));
|
|
2372
|
-
var AI;
|
|
2373
|
-
(function (AI) {
|
|
2374
|
-
"use strict";
|
|
2375
|
-
var ExceptionDetails = (function () {
|
|
2376
|
-
function ExceptionDetails() {
|
|
2377
|
-
this.hasFullStack = true;
|
|
2378
|
-
this.parsedStack = [];
|
|
2379
|
-
}
|
|
2380
|
-
return ExceptionDetails;
|
|
2381
|
-
}());
|
|
2382
|
-
AI.ExceptionDetails = ExceptionDetails;
|
|
2383
|
-
})(AI || (AI = {}));
|
|
2384
|
-
var AI;
|
|
2385
|
-
(function (AI) {
|
|
2386
|
-
"use strict";
|
|
2387
|
-
var ExceptionData = (function (_super) {
|
|
2388
|
-
__extends(ExceptionData, _super);
|
|
2389
|
-
function ExceptionData() {
|
|
2390
|
-
_super.call(this);
|
|
2391
|
-
this.ver = 2;
|
|
2392
|
-
this.exceptions = [];
|
|
2393
|
-
this.properties = {};
|
|
2394
|
-
this.measurements = {};
|
|
2395
|
-
_super.call(this);
|
|
2396
|
-
}
|
|
2397
|
-
return ExceptionData;
|
|
2398
|
-
}(Microsoft.Telemetry.Domain));
|
|
2399
|
-
AI.ExceptionData = ExceptionData;
|
|
2400
|
-
})(AI || (AI = {}));
|
|
2401
|
-
var AI;
|
|
2402
|
-
(function (AI) {
|
|
2403
|
-
"use strict";
|
|
2404
|
-
var StackFrame = (function () {
|
|
2405
|
-
function StackFrame() {
|
|
2406
|
-
}
|
|
2407
|
-
return StackFrame;
|
|
2408
|
-
}());
|
|
2409
|
-
AI.StackFrame = StackFrame;
|
|
2410
|
-
})(AI || (AI = {}));
|
|
2411
|
-
var Microsoft;
|
|
2412
|
-
(function (Microsoft) {
|
|
2413
|
-
var ApplicationInsights;
|
|
2414
|
-
(function (ApplicationInsights) {
|
|
2415
|
-
var Telemetry;
|
|
2416
|
-
(function (Telemetry) {
|
|
2417
|
-
"use strict";
|
|
2418
|
-
var Exception = (function (_super) {
|
|
2419
|
-
__extends(Exception, _super);
|
|
2420
|
-
function Exception(exception, handledAt, properties, measurements, severityLevel) {
|
|
2421
|
-
_super.call(this);
|
|
2422
|
-
this.aiDataContract = {
|
|
2423
|
-
ver: ApplicationInsights.FieldType.Required,
|
|
2424
|
-
handledAt: ApplicationInsights.FieldType.Required,
|
|
2425
|
-
exceptions: ApplicationInsights.FieldType.Required,
|
|
2426
|
-
severityLevel: ApplicationInsights.FieldType.Default,
|
|
2427
|
-
properties: ApplicationInsights.FieldType.Default,
|
|
2428
|
-
measurements: ApplicationInsights.FieldType.Default
|
|
2429
|
-
};
|
|
2430
|
-
this.properties = ApplicationInsights.Telemetry.Common.DataSanitizer.sanitizeProperties(properties);
|
|
2431
|
-
this.measurements = ApplicationInsights.Telemetry.Common.DataSanitizer.sanitizeMeasurements(measurements);
|
|
2432
|
-
this.handledAt = handledAt || "unhandled";
|
|
2433
|
-
this.exceptions = [new _ExceptionDetails(exception)];
|
|
2434
|
-
if (severityLevel) {
|
|
2435
|
-
this.severityLevel = severityLevel;
|
|
2436
|
-
}
|
|
2437
|
-
}
|
|
2438
|
-
Exception.CreateSimpleException = function (message, typeName, assembly, fileName, details, line, handledAt) {
|
|
2439
|
-
return {
|
|
2440
|
-
handledAt: handledAt || "unhandled",
|
|
2441
|
-
exceptions: [
|
|
2442
|
-
{
|
|
2443
|
-
hasFullStack: true,
|
|
2444
|
-
message: message,
|
|
2445
|
-
stack: details,
|
|
2446
|
-
typeName: typeName
|
|
2447
|
-
}
|
|
2448
|
-
]
|
|
2449
|
-
};
|
|
2450
|
-
};
|
|
2451
|
-
Exception.envelopeType = "Microsoft.ApplicationInsights.{0}.Exception";
|
|
2452
|
-
Exception.dataType = "ExceptionData";
|
|
2453
|
-
return Exception;
|
|
2454
|
-
}(AI.ExceptionData));
|
|
2455
|
-
Telemetry.Exception = Exception;
|
|
2456
|
-
var _ExceptionDetails = (function (_super) {
|
|
2457
|
-
__extends(_ExceptionDetails, _super);
|
|
2458
|
-
function _ExceptionDetails(exception) {
|
|
2459
|
-
_super.call(this);
|
|
2460
|
-
this.aiDataContract = {
|
|
2461
|
-
id: ApplicationInsights.FieldType.Default,
|
|
2462
|
-
outerId: ApplicationInsights.FieldType.Default,
|
|
2463
|
-
typeName: ApplicationInsights.FieldType.Required,
|
|
2464
|
-
message: ApplicationInsights.FieldType.Required,
|
|
2465
|
-
hasFullStack: ApplicationInsights.FieldType.Default,
|
|
2466
|
-
stack: ApplicationInsights.FieldType.Default,
|
|
2467
|
-
parsedStack: ApplicationInsights.FieldType.Array
|
|
2468
|
-
};
|
|
2469
|
-
this.typeName = Telemetry.Common.DataSanitizer.sanitizeString(exception.name) || ApplicationInsights.Util.NotSpecified;
|
|
2470
|
-
this.message = Telemetry.Common.DataSanitizer.sanitizeMessage(exception.message) || ApplicationInsights.Util.NotSpecified;
|
|
2471
|
-
var stack = exception["stack"];
|
|
2472
|
-
this.parsedStack = this.parseStack(stack);
|
|
2473
|
-
this.stack = Telemetry.Common.DataSanitizer.sanitizeException(stack);
|
|
2474
|
-
this.hasFullStack = ApplicationInsights.Util.isArray(this.parsedStack) && this.parsedStack.length > 0;
|
|
2475
|
-
}
|
|
2476
|
-
_ExceptionDetails.prototype.parseStack = function (stack) {
|
|
2477
|
-
var parsedStack = undefined;
|
|
2478
|
-
if (typeof stack === "string") {
|
|
2479
|
-
var frames = stack.split('\n');
|
|
2480
|
-
parsedStack = [];
|
|
2481
|
-
var level = 0;
|
|
2482
|
-
var totalSizeInBytes = 0;
|
|
2483
|
-
for (var i = 0; i <= frames.length; i++) {
|
|
2484
|
-
var frame = frames[i];
|
|
2485
|
-
if (_StackFrame.regex.test(frame)) {
|
|
2486
|
-
var parsedFrame = new _StackFrame(frames[i], level++);
|
|
2487
|
-
totalSizeInBytes += parsedFrame.sizeInBytes;
|
|
2488
|
-
parsedStack.push(parsedFrame);
|
|
2489
|
-
}
|
|
2490
|
-
}
|
|
2491
|
-
var exceptionParsedStackThreshold = 32 * 1024;
|
|
2492
|
-
if (totalSizeInBytes > exceptionParsedStackThreshold) {
|
|
2493
|
-
var left = 0;
|
|
2494
|
-
var right = parsedStack.length - 1;
|
|
2495
|
-
var size = 0;
|
|
2496
|
-
var acceptedLeft = left;
|
|
2497
|
-
var acceptedRight = right;
|
|
2498
|
-
while (left < right) {
|
|
2499
|
-
var lSize = parsedStack[left].sizeInBytes;
|
|
2500
|
-
var rSize = parsedStack[right].sizeInBytes;
|
|
2501
|
-
size += lSize + rSize;
|
|
2502
|
-
if (size > exceptionParsedStackThreshold) {
|
|
2503
|
-
var howMany = acceptedRight - acceptedLeft + 1;
|
|
2504
|
-
parsedStack.splice(acceptedLeft, howMany);
|
|
2505
|
-
break;
|
|
2506
|
-
}
|
|
2507
|
-
acceptedLeft = left;
|
|
2508
|
-
acceptedRight = right;
|
|
2509
|
-
left++;
|
|
2510
|
-
right--;
|
|
2511
|
-
}
|
|
2512
|
-
}
|
|
2513
|
-
}
|
|
2514
|
-
return parsedStack;
|
|
2515
|
-
};
|
|
2516
|
-
return _ExceptionDetails;
|
|
2517
|
-
}(AI.ExceptionDetails));
|
|
2518
|
-
var _StackFrame = (function (_super) {
|
|
2519
|
-
__extends(_StackFrame, _super);
|
|
2520
|
-
function _StackFrame(frame, level) {
|
|
2521
|
-
_super.call(this);
|
|
2522
|
-
this.sizeInBytes = 0;
|
|
2523
|
-
this.aiDataContract = {
|
|
2524
|
-
level: ApplicationInsights.FieldType.Required,
|
|
2525
|
-
method: ApplicationInsights.FieldType.Required,
|
|
2526
|
-
assembly: ApplicationInsights.FieldType.Default,
|
|
2527
|
-
fileName: ApplicationInsights.FieldType.Default,
|
|
2528
|
-
line: ApplicationInsights.FieldType.Default
|
|
2529
|
-
};
|
|
2530
|
-
this.level = level;
|
|
2531
|
-
this.method = "<no_method>";
|
|
2532
|
-
this.assembly = ApplicationInsights.Util.trim(frame);
|
|
2533
|
-
var matches = frame.match(_StackFrame.regex);
|
|
2534
|
-
if (matches && matches.length >= 5) {
|
|
2535
|
-
this.method = ApplicationInsights.Util.trim(matches[2]) || this.method;
|
|
2536
|
-
this.fileName = ApplicationInsights.Util.trim(matches[4]);
|
|
2537
|
-
this.line = parseInt(matches[5]) || 0;
|
|
2538
|
-
}
|
|
2539
|
-
this.sizeInBytes += this.method.length;
|
|
2540
|
-
this.sizeInBytes += this.fileName.length;
|
|
2541
|
-
this.sizeInBytes += this.assembly.length;
|
|
2542
|
-
this.sizeInBytes += _StackFrame.baseSize;
|
|
2543
|
-
this.sizeInBytes += this.level.toString().length;
|
|
2544
|
-
this.sizeInBytes += this.line.toString().length;
|
|
2545
|
-
}
|
|
2546
|
-
_StackFrame.regex = /^([\s]+at)?(.*?)(\@|\s\(|\s)([^\(\@\n]+):([0-9]+):([0-9]+)(\)?)$/;
|
|
2547
|
-
_StackFrame.baseSize = 58;
|
|
2548
|
-
return _StackFrame;
|
|
2549
|
-
}(AI.StackFrame));
|
|
2550
|
-
Telemetry._StackFrame = _StackFrame;
|
|
2551
|
-
})(Telemetry = ApplicationInsights.Telemetry || (ApplicationInsights.Telemetry = {}));
|
|
2552
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
2553
|
-
})(Microsoft || (Microsoft = {}));
|
|
2554
|
-
var AI;
|
|
2555
|
-
(function (AI) {
|
|
2556
|
-
"use strict";
|
|
2557
|
-
var MetricData = (function (_super) {
|
|
2558
|
-
__extends(MetricData, _super);
|
|
2559
|
-
function MetricData() {
|
|
2560
|
-
_super.call(this);
|
|
2561
|
-
this.ver = 2;
|
|
2562
|
-
this.metrics = [];
|
|
2563
|
-
this.properties = {};
|
|
2564
|
-
_super.call(this);
|
|
2565
|
-
}
|
|
2566
|
-
return MetricData;
|
|
2567
|
-
}(Microsoft.Telemetry.Domain));
|
|
2568
|
-
AI.MetricData = MetricData;
|
|
2569
|
-
})(AI || (AI = {}));
|
|
2570
|
-
var AI;
|
|
2571
|
-
(function (AI) {
|
|
2572
|
-
"use strict";
|
|
2573
|
-
(function (DataPointType) {
|
|
2574
|
-
DataPointType[DataPointType["Measurement"] = 0] = "Measurement";
|
|
2575
|
-
DataPointType[DataPointType["Aggregation"] = 1] = "Aggregation";
|
|
2576
|
-
})(AI.DataPointType || (AI.DataPointType = {}));
|
|
2577
|
-
var DataPointType = AI.DataPointType;
|
|
2578
|
-
})(AI || (AI = {}));
|
|
2579
|
-
var AI;
|
|
2580
|
-
(function (AI) {
|
|
2581
|
-
"use strict";
|
|
2582
|
-
var DataPoint = (function () {
|
|
2583
|
-
function DataPoint() {
|
|
2584
|
-
this.kind = AI.DataPointType.Measurement;
|
|
2585
|
-
}
|
|
2586
|
-
return DataPoint;
|
|
2587
|
-
}());
|
|
2588
|
-
AI.DataPoint = DataPoint;
|
|
2589
|
-
})(AI || (AI = {}));
|
|
2590
|
-
var Microsoft;
|
|
2591
|
-
(function (Microsoft) {
|
|
2592
|
-
var ApplicationInsights;
|
|
2593
|
-
(function (ApplicationInsights) {
|
|
2594
|
-
var Telemetry;
|
|
2595
|
-
(function (Telemetry) {
|
|
2596
|
-
var Common;
|
|
2597
|
-
(function (Common) {
|
|
2598
|
-
"use strict";
|
|
2599
|
-
var DataPoint = (function (_super) {
|
|
2600
|
-
__extends(DataPoint, _super);
|
|
2601
|
-
function DataPoint() {
|
|
2602
|
-
_super.apply(this, arguments);
|
|
2603
|
-
this.aiDataContract = {
|
|
2604
|
-
name: ApplicationInsights.FieldType.Required,
|
|
2605
|
-
kind: ApplicationInsights.FieldType.Default,
|
|
2606
|
-
value: ApplicationInsights.FieldType.Required,
|
|
2607
|
-
count: ApplicationInsights.FieldType.Default,
|
|
2608
|
-
min: ApplicationInsights.FieldType.Default,
|
|
2609
|
-
max: ApplicationInsights.FieldType.Default,
|
|
2610
|
-
stdDev: ApplicationInsights.FieldType.Default
|
|
2611
|
-
};
|
|
2612
|
-
}
|
|
2613
|
-
return DataPoint;
|
|
2614
|
-
}(AI.DataPoint));
|
|
2615
|
-
Common.DataPoint = DataPoint;
|
|
2616
|
-
})(Common = Telemetry.Common || (Telemetry.Common = {}));
|
|
2617
|
-
})(Telemetry = ApplicationInsights.Telemetry || (ApplicationInsights.Telemetry = {}));
|
|
2618
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
2619
|
-
})(Microsoft || (Microsoft = {}));
|
|
2620
|
-
var Microsoft;
|
|
2621
|
-
(function (Microsoft) {
|
|
2622
|
-
var ApplicationInsights;
|
|
2623
|
-
(function (ApplicationInsights) {
|
|
2624
|
-
var Telemetry;
|
|
2625
|
-
(function (Telemetry) {
|
|
2626
|
-
"use strict";
|
|
2627
|
-
var Metric = (function (_super) {
|
|
2628
|
-
__extends(Metric, _super);
|
|
2629
|
-
function Metric(name, value, count, min, max, properties) {
|
|
2630
|
-
_super.call(this);
|
|
2631
|
-
this.aiDataContract = {
|
|
2632
|
-
ver: ApplicationInsights.FieldType.Required,
|
|
2633
|
-
metrics: ApplicationInsights.FieldType.Required,
|
|
2634
|
-
properties: ApplicationInsights.FieldType.Default
|
|
2635
|
-
};
|
|
2636
|
-
var dataPoint = new Microsoft.ApplicationInsights.Telemetry.Common.DataPoint();
|
|
2637
|
-
dataPoint.count = count > 0 ? count : undefined;
|
|
2638
|
-
dataPoint.max = isNaN(max) || max === null ? undefined : max;
|
|
2639
|
-
dataPoint.min = isNaN(min) || min === null ? undefined : min;
|
|
2640
|
-
dataPoint.name = Telemetry.Common.DataSanitizer.sanitizeString(name) || ApplicationInsights.Util.NotSpecified;
|
|
2641
|
-
dataPoint.value = value;
|
|
2642
|
-
this.metrics = [dataPoint];
|
|
2643
|
-
this.properties = ApplicationInsights.Telemetry.Common.DataSanitizer.sanitizeProperties(properties);
|
|
2644
|
-
}
|
|
2645
|
-
Metric.envelopeType = "Microsoft.ApplicationInsights.{0}.Metric";
|
|
2646
|
-
Metric.dataType = "MetricData";
|
|
2647
|
-
return Metric;
|
|
2648
|
-
}(AI.MetricData));
|
|
2649
|
-
Telemetry.Metric = Metric;
|
|
2650
|
-
})(Telemetry = ApplicationInsights.Telemetry || (ApplicationInsights.Telemetry = {}));
|
|
2651
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
2652
|
-
})(Microsoft || (Microsoft = {}));
|
|
2653
|
-
var AI;
|
|
2654
|
-
(function (AI) {
|
|
2655
|
-
"use strict";
|
|
2656
|
-
var PageViewData = (function (_super) {
|
|
2657
|
-
__extends(PageViewData, _super);
|
|
2658
|
-
function PageViewData() {
|
|
2659
|
-
_super.call(this);
|
|
2660
|
-
this.ver = 2;
|
|
2661
|
-
this.properties = {};
|
|
2662
|
-
this.measurements = {};
|
|
2663
|
-
_super.call(this);
|
|
2664
|
-
}
|
|
2665
|
-
return PageViewData;
|
|
2666
|
-
}(AI.EventData));
|
|
2667
|
-
AI.PageViewData = PageViewData;
|
|
2668
|
-
})(AI || (AI = {}));
|
|
2669
|
-
var Microsoft;
|
|
2670
|
-
(function (Microsoft) {
|
|
2671
|
-
var ApplicationInsights;
|
|
2672
|
-
(function (ApplicationInsights) {
|
|
2673
|
-
var Telemetry;
|
|
2674
|
-
(function (Telemetry) {
|
|
2675
|
-
"use strict";
|
|
2676
|
-
var PageView = (function (_super) {
|
|
2677
|
-
__extends(PageView, _super);
|
|
2678
|
-
function PageView(name, url, durationMs, properties, measurements) {
|
|
2679
|
-
_super.call(this);
|
|
2680
|
-
this.aiDataContract = {
|
|
2681
|
-
ver: ApplicationInsights.FieldType.Required,
|
|
2682
|
-
name: ApplicationInsights.FieldType.Default,
|
|
2683
|
-
url: ApplicationInsights.FieldType.Default,
|
|
2684
|
-
duration: ApplicationInsights.FieldType.Default,
|
|
2685
|
-
properties: ApplicationInsights.FieldType.Default,
|
|
2686
|
-
measurements: ApplicationInsights.FieldType.Default
|
|
2687
|
-
};
|
|
2688
|
-
this.url = Telemetry.Common.DataSanitizer.sanitizeUrl(url);
|
|
2689
|
-
this.name = Telemetry.Common.DataSanitizer.sanitizeString(name) || ApplicationInsights.Util.NotSpecified;
|
|
2690
|
-
if (!isNaN(durationMs)) {
|
|
2691
|
-
this.duration = ApplicationInsights.Util.msToTimeSpan(durationMs);
|
|
2692
|
-
}
|
|
2693
|
-
this.properties = ApplicationInsights.Telemetry.Common.DataSanitizer.sanitizeProperties(properties);
|
|
2694
|
-
this.measurements = ApplicationInsights.Telemetry.Common.DataSanitizer.sanitizeMeasurements(measurements);
|
|
2695
|
-
}
|
|
2696
|
-
PageView.envelopeType = "Microsoft.ApplicationInsights.{0}.Pageview";
|
|
2697
|
-
PageView.dataType = "PageviewData";
|
|
2698
|
-
return PageView;
|
|
2699
|
-
}(AI.PageViewData));
|
|
2700
|
-
Telemetry.PageView = PageView;
|
|
2701
|
-
})(Telemetry = ApplicationInsights.Telemetry || (ApplicationInsights.Telemetry = {}));
|
|
2702
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
2703
|
-
})(Microsoft || (Microsoft = {}));
|
|
2704
|
-
var AI;
|
|
2705
|
-
(function (AI) {
|
|
2706
|
-
"use strict";
|
|
2707
|
-
var PageViewPerfData = (function (_super) {
|
|
2708
|
-
__extends(PageViewPerfData, _super);
|
|
2709
|
-
function PageViewPerfData() {
|
|
2710
|
-
_super.call(this);
|
|
2711
|
-
this.ver = 2;
|
|
2712
|
-
this.properties = {};
|
|
2713
|
-
this.measurements = {};
|
|
2714
|
-
_super.call(this);
|
|
2715
|
-
}
|
|
2716
|
-
return PageViewPerfData;
|
|
2717
|
-
}(AI.PageViewData));
|
|
2718
|
-
AI.PageViewPerfData = PageViewPerfData;
|
|
2719
|
-
})(AI || (AI = {}));
|
|
2720
|
-
var Microsoft;
|
|
2721
|
-
(function (Microsoft) {
|
|
2722
|
-
var ApplicationInsights;
|
|
2723
|
-
(function (ApplicationInsights) {
|
|
2724
|
-
var Telemetry;
|
|
2725
|
-
(function (Telemetry) {
|
|
2726
|
-
"use strict";
|
|
2727
|
-
var PageViewPerformance = (function (_super) {
|
|
2728
|
-
__extends(PageViewPerformance, _super);
|
|
2729
|
-
function PageViewPerformance(name, url, unused, properties, measurements) {
|
|
2730
|
-
_super.call(this);
|
|
2731
|
-
this.aiDataContract = {
|
|
2732
|
-
ver: ApplicationInsights.FieldType.Required,
|
|
2733
|
-
name: ApplicationInsights.FieldType.Default,
|
|
2734
|
-
url: ApplicationInsights.FieldType.Default,
|
|
2735
|
-
duration: ApplicationInsights.FieldType.Default,
|
|
2736
|
-
perfTotal: ApplicationInsights.FieldType.Default,
|
|
2737
|
-
networkConnect: ApplicationInsights.FieldType.Default,
|
|
2738
|
-
sentRequest: ApplicationInsights.FieldType.Default,
|
|
2739
|
-
receivedResponse: ApplicationInsights.FieldType.Default,
|
|
2740
|
-
domProcessing: ApplicationInsights.FieldType.Default,
|
|
2741
|
-
properties: ApplicationInsights.FieldType.Default,
|
|
2742
|
-
measurements: ApplicationInsights.FieldType.Default
|
|
2743
|
-
};
|
|
2744
|
-
this.isValid = false;
|
|
2745
|
-
var timing = PageViewPerformance.getPerformanceTiming();
|
|
2746
|
-
if (timing) {
|
|
2747
|
-
var total = PageViewPerformance.getDuration(timing.navigationStart, timing.loadEventEnd);
|
|
2748
|
-
var network = PageViewPerformance.getDuration(timing.navigationStart, timing.connectEnd);
|
|
2749
|
-
var request = PageViewPerformance.getDuration(timing.requestStart, timing.responseStart);
|
|
2750
|
-
var response = PageViewPerformance.getDuration(timing.responseStart, timing.responseEnd);
|
|
2751
|
-
var dom = PageViewPerformance.getDuration(timing.responseEnd, timing.loadEventEnd);
|
|
2752
|
-
if (total == 0) {
|
|
2753
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.ErrorPVCalc, "error calculating page view performance.", { total: total, network: network, request: request, response: response, dom: dom });
|
|
2754
|
-
}
|
|
2755
|
-
else if (!PageViewPerformance.shouldCollectDuration(total, network, request, response, dom)) {
|
|
2756
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.InvalidDurationValue, "Invalid page load duration value. Browser perf data won't be sent.", { total: total, network: network, request: request, response: response, dom: dom });
|
|
2757
|
-
}
|
|
2758
|
-
else if (total < Math.floor(network) + Math.floor(request) + Math.floor(response) + Math.floor(dom)) {
|
|
2759
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.ClientPerformanceMathError, "client performance math error.", { total: total, network: network, request: request, response: response, dom: dom });
|
|
2760
|
-
}
|
|
2761
|
-
else {
|
|
2762
|
-
this.durationMs = total;
|
|
2763
|
-
this.perfTotal = this.duration = ApplicationInsights.Util.msToTimeSpan(total);
|
|
2764
|
-
this.networkConnect = ApplicationInsights.Util.msToTimeSpan(network);
|
|
2765
|
-
this.sentRequest = ApplicationInsights.Util.msToTimeSpan(request);
|
|
2766
|
-
this.receivedResponse = ApplicationInsights.Util.msToTimeSpan(response);
|
|
2767
|
-
this.domProcessing = ApplicationInsights.Util.msToTimeSpan(dom);
|
|
2768
|
-
this.isValid = true;
|
|
2769
|
-
}
|
|
2770
|
-
}
|
|
2771
|
-
this.url = Telemetry.Common.DataSanitizer.sanitizeUrl(url);
|
|
2772
|
-
this.name = Telemetry.Common.DataSanitizer.sanitizeString(name) || ApplicationInsights.Util.NotSpecified;
|
|
2773
|
-
this.properties = ApplicationInsights.Telemetry.Common.DataSanitizer.sanitizeProperties(properties);
|
|
2774
|
-
this.measurements = ApplicationInsights.Telemetry.Common.DataSanitizer.sanitizeMeasurements(measurements);
|
|
2775
|
-
}
|
|
2776
|
-
PageViewPerformance.prototype.getIsValid = function () {
|
|
2777
|
-
return this.isValid;
|
|
2778
|
-
};
|
|
2779
|
-
PageViewPerformance.prototype.getDurationMs = function () {
|
|
2780
|
-
return this.durationMs;
|
|
2781
|
-
};
|
|
2782
|
-
PageViewPerformance.getPerformanceTiming = function () {
|
|
2783
|
-
if (PageViewPerformance.isPerformanceTimingSupported()) {
|
|
2784
|
-
return window.performance.timing;
|
|
2785
|
-
}
|
|
2786
|
-
return null;
|
|
2787
|
-
};
|
|
2788
|
-
PageViewPerformance.isPerformanceTimingSupported = function () {
|
|
2789
|
-
return typeof window != "undefined" && window.performance && window.performance.timing;
|
|
2790
|
-
};
|
|
2791
|
-
PageViewPerformance.isPerformanceTimingDataReady = function () {
|
|
2792
|
-
var timing = window.performance.timing;
|
|
2793
|
-
return timing.domainLookupStart > 0
|
|
2794
|
-
&& timing.navigationStart > 0
|
|
2795
|
-
&& timing.responseStart > 0
|
|
2796
|
-
&& timing.requestStart > 0
|
|
2797
|
-
&& timing.loadEventEnd > 0
|
|
2798
|
-
&& timing.responseEnd > 0
|
|
2799
|
-
&& timing.connectEnd > 0
|
|
2800
|
-
&& timing.domLoading > 0;
|
|
2801
|
-
};
|
|
2802
|
-
PageViewPerformance.getDuration = function (start, end) {
|
|
2803
|
-
var duration = undefined;
|
|
2804
|
-
if (!(isNaN(start) || isNaN(end))) {
|
|
2805
|
-
duration = Math.max(end - start, 0);
|
|
2806
|
-
}
|
|
2807
|
-
return duration;
|
|
2808
|
-
};
|
|
2809
|
-
PageViewPerformance.shouldCollectDuration = function () {
|
|
2810
|
-
var durations = [];
|
|
2811
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2812
|
-
durations[_i - 0] = arguments[_i];
|
|
2813
|
-
}
|
|
2814
|
-
var userAgent = navigator.userAgent;
|
|
2815
|
-
var isGoogleBot = userAgent ? userAgent.toLowerCase().indexOf("googlebot") !== -1 : false;
|
|
2816
|
-
if (isGoogleBot) {
|
|
2817
|
-
return false;
|
|
2818
|
-
}
|
|
2819
|
-
else {
|
|
2820
|
-
for (var i = 0; i < durations.length; i++) {
|
|
2821
|
-
if (durations[i] >= PageViewPerformance.MAX_DURATION_ALLOWED) {
|
|
2822
|
-
return false;
|
|
2823
|
-
}
|
|
2824
|
-
}
|
|
2825
|
-
}
|
|
2826
|
-
return true;
|
|
2827
|
-
};
|
|
2828
|
-
PageViewPerformance.envelopeType = "Microsoft.ApplicationInsights.{0}.PageviewPerformance";
|
|
2829
|
-
PageViewPerformance.dataType = "PageviewPerformanceData";
|
|
2830
|
-
PageViewPerformance.MAX_DURATION_ALLOWED = 3600000;
|
|
2831
|
-
return PageViewPerformance;
|
|
2832
|
-
}(AI.PageViewPerfData));
|
|
2833
|
-
Telemetry.PageViewPerformance = PageViewPerformance;
|
|
2834
|
-
})(Telemetry = ApplicationInsights.Telemetry || (ApplicationInsights.Telemetry = {}));
|
|
2835
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
2836
|
-
})(Microsoft || (Microsoft = {}));
|
|
2837
|
-
var Microsoft;
|
|
2838
|
-
(function (Microsoft) {
|
|
2839
|
-
var ApplicationInsights;
|
|
2840
|
-
(function (ApplicationInsights) {
|
|
2841
|
-
"use strict";
|
|
2842
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
2843
|
-
})(Microsoft || (Microsoft = {}));
|
|
2844
|
-
var Microsoft;
|
|
2845
|
-
(function (Microsoft) {
|
|
2846
|
-
var ApplicationInsights;
|
|
2847
|
-
(function (ApplicationInsights) {
|
|
2848
|
-
"use strict";
|
|
2849
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
2850
|
-
})(Microsoft || (Microsoft = {}));
|
|
2851
|
-
var Microsoft;
|
|
2852
|
-
(function (Microsoft) {
|
|
2853
|
-
var ApplicationInsights;
|
|
2854
|
-
(function (ApplicationInsights) {
|
|
2855
|
-
"use strict";
|
|
2856
|
-
var TelemetryContext = (function () {
|
|
2857
|
-
function TelemetryContext(config) {
|
|
2858
|
-
this._config = config;
|
|
2859
|
-
this._sender = new ApplicationInsights.Sender(config);
|
|
2860
|
-
this.telemetryInitializers = [];
|
|
2861
|
-
if (typeof window !== 'undefined') {
|
|
2862
|
-
this._sessionManager = new ApplicationInsights.Context._SessionManager(config);
|
|
2863
|
-
this.application = new ApplicationInsights.Context.Application();
|
|
2864
|
-
this.device = new ApplicationInsights.Context.Device();
|
|
2865
|
-
this.internal = new ApplicationInsights.Context.Internal(config);
|
|
2866
|
-
this.location = new ApplicationInsights.Context.Location();
|
|
2867
|
-
this.user = new ApplicationInsights.Context.User(config);
|
|
2868
|
-
this.operation = new ApplicationInsights.Context.Operation();
|
|
2869
|
-
this.session = new ApplicationInsights.Context.Session();
|
|
2870
|
-
this.sample = new ApplicationInsights.Context.Sample(config.sampleRate());
|
|
2871
|
-
}
|
|
2872
|
-
this._addDefaultTelemetryInitializers();
|
|
2873
|
-
}
|
|
2874
|
-
TelemetryContext.prototype.addTelemetryInitializer = function (telemetryInitializer) {
|
|
2875
|
-
this.telemetryInitializers.push(telemetryInitializer);
|
|
2876
|
-
};
|
|
2877
|
-
TelemetryContext.prototype.track = function (envelope) {
|
|
2878
|
-
if (!envelope) {
|
|
2879
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.TrackArgumentsNotSpecified, "cannot call .track() with a null or undefined argument", null, true);
|
|
2880
|
-
}
|
|
2881
|
-
else {
|
|
2882
|
-
if (envelope.name === ApplicationInsights.Telemetry.PageView.envelopeType) {
|
|
2883
|
-
ApplicationInsights._InternalLogging.resetInternalMessageCount();
|
|
2884
|
-
}
|
|
2885
|
-
if (this.session) {
|
|
2886
|
-
if (typeof this.session.id !== "string") {
|
|
2887
|
-
this._sessionManager.update();
|
|
2888
|
-
}
|
|
2889
|
-
}
|
|
2890
|
-
this._track(envelope);
|
|
2891
|
-
}
|
|
2892
|
-
return envelope;
|
|
2893
|
-
};
|
|
2894
|
-
TelemetryContext.prototype._addDefaultTelemetryInitializers = function () {
|
|
2895
|
-
if (!this._config.isBrowserLinkTrackingEnabled()) {
|
|
2896
|
-
var browserLinkPaths_1 = ['/browserLinkSignalR/', '/__browserLink/'];
|
|
2897
|
-
var dropBrowserLinkRequests = function (envelope) {
|
|
2898
|
-
if (envelope.name === Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.envelopeType) {
|
|
2899
|
-
var remoteData = envelope.data;
|
|
2900
|
-
if (remoteData && remoteData.baseData) {
|
|
2901
|
-
for (var i = 0; i < browserLinkPaths_1.length; i++) {
|
|
2902
|
-
if (remoteData.baseData.name.indexOf(browserLinkPaths_1[i]) >= 0) {
|
|
2903
|
-
return false;
|
|
2904
|
-
}
|
|
2905
|
-
}
|
|
2906
|
-
}
|
|
2907
|
-
}
|
|
2908
|
-
return true;
|
|
2909
|
-
};
|
|
2910
|
-
this.addTelemetryInitializer(dropBrowserLinkRequests);
|
|
2911
|
-
}
|
|
2912
|
-
};
|
|
2913
|
-
TelemetryContext.prototype._track = function (envelope) {
|
|
2914
|
-
if (this.session) {
|
|
2915
|
-
if (typeof this.session.id === "string") {
|
|
2916
|
-
this._applySessionContext(envelope, this.session);
|
|
2917
|
-
}
|
|
2918
|
-
else {
|
|
2919
|
-
this._applySessionContext(envelope, this._sessionManager.automaticSession);
|
|
2920
|
-
}
|
|
2921
|
-
}
|
|
2922
|
-
this._applyApplicationContext(envelope, this.application);
|
|
2923
|
-
this._applyDeviceContext(envelope, this.device);
|
|
2924
|
-
this._applyInternalContext(envelope, this.internal);
|
|
2925
|
-
this._applyLocationContext(envelope, this.location);
|
|
2926
|
-
this._applySampleContext(envelope, this.sample);
|
|
2927
|
-
this._applyUserContext(envelope, this.user);
|
|
2928
|
-
this._applyOperationContext(envelope, this.operation);
|
|
2929
|
-
envelope.iKey = this._config.instrumentationKey();
|
|
2930
|
-
var doNotSendItem = false;
|
|
2931
|
-
try {
|
|
2932
|
-
var telemetryInitializersCount = this.telemetryInitializers.length;
|
|
2933
|
-
for (var i = 0; i < telemetryInitializersCount; ++i) {
|
|
2934
|
-
var telemetryInitializer = this.telemetryInitializers[i];
|
|
2935
|
-
if (telemetryInitializer) {
|
|
2936
|
-
if (telemetryInitializer.apply(null, [envelope]) === false) {
|
|
2937
|
-
doNotSendItem = true;
|
|
2938
|
-
break;
|
|
2939
|
-
}
|
|
2940
|
-
}
|
|
2941
|
-
}
|
|
2942
|
-
}
|
|
2943
|
-
catch (e) {
|
|
2944
|
-
doNotSendItem = true;
|
|
2945
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.TelemetryInitializerFailed, "One of telemetry initializers failed, telemetry item will not be sent: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) }, true);
|
|
2946
|
-
}
|
|
2947
|
-
if (!doNotSendItem) {
|
|
2948
|
-
this._fixDepricatedValues(envelope);
|
|
2949
|
-
if (envelope.name === ApplicationInsights.Telemetry.Metric.envelopeType ||
|
|
2950
|
-
this.sample.isSampledIn(envelope)) {
|
|
2951
|
-
var iKeyNoDashes = this._config.instrumentationKey().replace(/-/g, "");
|
|
2952
|
-
envelope.name = envelope.name.replace("{0}", iKeyNoDashes);
|
|
2953
|
-
this._sender.send(envelope);
|
|
2954
|
-
}
|
|
2955
|
-
else {
|
|
2956
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.TelemetrySampledAndNotSent, "Telemetry is sampled and not sent to the AI service.", { SampleRate: this.sample.sampleRate }, true);
|
|
2957
|
-
}
|
|
2958
|
-
}
|
|
2959
|
-
return envelope;
|
|
2960
|
-
};
|
|
2961
|
-
TelemetryContext.prototype._applyApplicationContext = function (envelope, appContext) {
|
|
2962
|
-
if (appContext) {
|
|
2963
|
-
var tagKeys = new AI.ContextTagKeys();
|
|
2964
|
-
if (typeof appContext.ver === "string") {
|
|
2965
|
-
envelope.tags[tagKeys.applicationVersion] = appContext.ver;
|
|
2966
|
-
}
|
|
2967
|
-
if (typeof appContext.build === "string") {
|
|
2968
|
-
envelope.tags[tagKeys.applicationBuild] = appContext.build;
|
|
2969
|
-
}
|
|
2970
|
-
}
|
|
2971
|
-
};
|
|
2972
|
-
TelemetryContext.prototype._applyDeviceContext = function (envelope, deviceContext) {
|
|
2973
|
-
var tagKeys = new AI.ContextTagKeys();
|
|
2974
|
-
if (deviceContext) {
|
|
2975
|
-
if (typeof deviceContext.id === "string") {
|
|
2976
|
-
envelope.tags[tagKeys.deviceId] = deviceContext.id;
|
|
2977
|
-
}
|
|
2978
|
-
if (typeof deviceContext.ip === "string") {
|
|
2979
|
-
envelope.tags[tagKeys.deviceIp] = deviceContext.ip;
|
|
2980
|
-
}
|
|
2981
|
-
if (typeof deviceContext.language === "string") {
|
|
2982
|
-
envelope.tags[tagKeys.deviceLanguage] = deviceContext.language;
|
|
2983
|
-
}
|
|
2984
|
-
if (typeof deviceContext.locale === "string") {
|
|
2985
|
-
envelope.tags[tagKeys.deviceLocale] = deviceContext.locale;
|
|
2986
|
-
}
|
|
2987
|
-
if (typeof deviceContext.model === "string") {
|
|
2988
|
-
envelope.tags[tagKeys.deviceModel] = deviceContext.model;
|
|
2989
|
-
}
|
|
2990
|
-
if (typeof deviceContext.network !== "undefined") {
|
|
2991
|
-
envelope.tags[tagKeys.deviceNetwork] = deviceContext.network;
|
|
2992
|
-
}
|
|
2993
|
-
if (typeof deviceContext.oemName === "string") {
|
|
2994
|
-
envelope.tags[tagKeys.deviceOEMName] = deviceContext.oemName;
|
|
2995
|
-
}
|
|
2996
|
-
if (typeof deviceContext.os === "string") {
|
|
2997
|
-
envelope.tags[tagKeys.deviceOS] = deviceContext.os;
|
|
2998
|
-
}
|
|
2999
|
-
if (typeof deviceContext.osversion === "string") {
|
|
3000
|
-
envelope.tags[tagKeys.deviceOSVersion] = deviceContext.osversion;
|
|
3001
|
-
}
|
|
3002
|
-
if (typeof deviceContext.resolution === "string") {
|
|
3003
|
-
envelope.tags[tagKeys.deviceScreenResolution] = deviceContext.resolution;
|
|
3004
|
-
}
|
|
3005
|
-
if (typeof deviceContext.type === "string") {
|
|
3006
|
-
envelope.tags[tagKeys.deviceType] = deviceContext.type;
|
|
3007
|
-
}
|
|
3008
|
-
}
|
|
3009
|
-
};
|
|
3010
|
-
TelemetryContext.prototype._applyInternalContext = function (envelope, internalContext) {
|
|
3011
|
-
if (internalContext) {
|
|
3012
|
-
var tagKeys = new AI.ContextTagKeys();
|
|
3013
|
-
if (typeof internalContext.agentVersion === "string") {
|
|
3014
|
-
envelope.tags[tagKeys.internalAgentVersion] = internalContext.agentVersion;
|
|
3015
|
-
}
|
|
3016
|
-
if (typeof internalContext.sdkVersion === "string") {
|
|
3017
|
-
envelope.tags[tagKeys.internalSdkVersion] = internalContext.sdkVersion;
|
|
3018
|
-
}
|
|
3019
|
-
}
|
|
3020
|
-
};
|
|
3021
|
-
TelemetryContext.prototype._applyLocationContext = function (envelope, locationContext) {
|
|
3022
|
-
if (locationContext) {
|
|
3023
|
-
var tagKeys = new AI.ContextTagKeys();
|
|
3024
|
-
if (typeof locationContext.ip === "string") {
|
|
3025
|
-
envelope.tags[tagKeys.locationIp] = locationContext.ip;
|
|
3026
|
-
}
|
|
3027
|
-
}
|
|
3028
|
-
};
|
|
3029
|
-
TelemetryContext.prototype._applyOperationContext = function (envelope, operationContext) {
|
|
3030
|
-
if (operationContext) {
|
|
3031
|
-
var tagKeys = new AI.ContextTagKeys();
|
|
3032
|
-
if (typeof operationContext.id === "string") {
|
|
3033
|
-
envelope.tags[tagKeys.operationId] = operationContext.id;
|
|
3034
|
-
}
|
|
3035
|
-
if (typeof operationContext.name === "string") {
|
|
3036
|
-
envelope.tags[tagKeys.operationName] = operationContext.name;
|
|
3037
|
-
}
|
|
3038
|
-
if (typeof operationContext.parentId === "string") {
|
|
3039
|
-
envelope.tags[tagKeys.operationParentId] = operationContext.parentId;
|
|
3040
|
-
}
|
|
3041
|
-
if (typeof operationContext.rootId === "string") {
|
|
3042
|
-
envelope.tags[tagKeys.operationRootId] = operationContext.rootId;
|
|
3043
|
-
}
|
|
3044
|
-
if (typeof operationContext.syntheticSource === "string") {
|
|
3045
|
-
envelope.tags[tagKeys.operationSyntheticSource] = operationContext.syntheticSource;
|
|
3046
|
-
}
|
|
3047
|
-
}
|
|
3048
|
-
};
|
|
3049
|
-
TelemetryContext.prototype._applySampleContext = function (envelope, sampleContext) {
|
|
3050
|
-
if (sampleContext) {
|
|
3051
|
-
envelope.sampleRate = sampleContext.sampleRate;
|
|
3052
|
-
}
|
|
3053
|
-
};
|
|
3054
|
-
TelemetryContext.prototype._applySessionContext = function (envelope, sessionContext) {
|
|
3055
|
-
if (sessionContext) {
|
|
3056
|
-
var tagKeys = new AI.ContextTagKeys();
|
|
3057
|
-
if (typeof sessionContext.id === "string") {
|
|
3058
|
-
envelope.tags[tagKeys.sessionId] = sessionContext.id;
|
|
3059
|
-
}
|
|
3060
|
-
if (typeof sessionContext.isFirst !== "undefined") {
|
|
3061
|
-
envelope.tags[tagKeys.sessionIsFirst] = sessionContext.isFirst;
|
|
3062
|
-
}
|
|
3063
|
-
}
|
|
3064
|
-
};
|
|
3065
|
-
TelemetryContext.prototype._applyUserContext = function (envelope, userContext) {
|
|
3066
|
-
if (userContext) {
|
|
3067
|
-
var tagKeys = new AI.ContextTagKeys();
|
|
3068
|
-
if (typeof userContext.accountId === "string") {
|
|
3069
|
-
envelope.tags[tagKeys.userAccountId] = userContext.accountId;
|
|
3070
|
-
}
|
|
3071
|
-
if (typeof userContext.agent === "string") {
|
|
3072
|
-
envelope.tags[tagKeys.userAgent] = userContext.agent;
|
|
3073
|
-
}
|
|
3074
|
-
if (typeof userContext.id === "string") {
|
|
3075
|
-
envelope.tags[tagKeys.userId] = userContext.id;
|
|
3076
|
-
}
|
|
3077
|
-
if (typeof userContext.authenticatedId === "string") {
|
|
3078
|
-
envelope.tags[tagKeys.userAuthUserId] = userContext.authenticatedId;
|
|
3079
|
-
}
|
|
3080
|
-
if (typeof userContext.storeRegion === "string") {
|
|
3081
|
-
envelope.tags[tagKeys.userStoreRegion] = userContext.storeRegion;
|
|
3082
|
-
}
|
|
3083
|
-
}
|
|
3084
|
-
};
|
|
3085
|
-
TelemetryContext.prototype._fixDepricatedValues = function (envelope) {
|
|
3086
|
-
try {
|
|
3087
|
-
var data = envelope.data;
|
|
3088
|
-
if (data && data.baseType === Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.dataType) {
|
|
3089
|
-
var rddData = data.baseData;
|
|
3090
|
-
if (rddData) {
|
|
3091
|
-
this._fixRDDDepricatedValues(rddData);
|
|
3092
|
-
}
|
|
3093
|
-
}
|
|
3094
|
-
}
|
|
3095
|
-
catch (e) {
|
|
3096
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.FailedToFixDepricatedValues, "Failed to parse the base data object, to fix the depricated values " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
|
|
3097
|
-
}
|
|
3098
|
-
};
|
|
3099
|
-
TelemetryContext.prototype._fixRDDDepricatedValues = function (rddData) {
|
|
3100
|
-
if (rddData.commandName) {
|
|
3101
|
-
rddData.data = rddData.commandName;
|
|
3102
|
-
rddData.commandName = undefined;
|
|
3103
|
-
}
|
|
3104
|
-
if (rddData.dependencyTypeName) {
|
|
3105
|
-
rddData.type = rddData.dependencyTypeName;
|
|
3106
|
-
rddData.dependencyTypeName = undefined;
|
|
3107
|
-
}
|
|
3108
|
-
if (rddData.value && rddData.value !== 0) {
|
|
3109
|
-
rddData.duration = ApplicationInsights.Util.msToTimeSpan(rddData.value);
|
|
3110
|
-
rddData.value = undefined;
|
|
3111
|
-
}
|
|
3112
|
-
if (rddData.kind) {
|
|
3113
|
-
rddData.kind = undefined;
|
|
3114
|
-
}
|
|
3115
|
-
if (rddData.dependencySource) {
|
|
3116
|
-
rddData.dependencySource = undefined;
|
|
3117
|
-
}
|
|
3118
|
-
if (rddData.async) {
|
|
3119
|
-
rddData.async = undefined;
|
|
3120
|
-
}
|
|
3121
|
-
if (rddData.count) {
|
|
3122
|
-
rddData.count = undefined;
|
|
3123
|
-
}
|
|
3124
|
-
if (rddData.min) {
|
|
3125
|
-
rddData.min = undefined;
|
|
3126
|
-
}
|
|
3127
|
-
if (rddData.max) {
|
|
3128
|
-
rddData.max = undefined;
|
|
3129
|
-
}
|
|
3130
|
-
if (rddData.stdDev) {
|
|
3131
|
-
rddData.stdDev = undefined;
|
|
3132
|
-
}
|
|
3133
|
-
if (rddData.dependencyKind) {
|
|
3134
|
-
rddData.dependencyKind = undefined;
|
|
3135
|
-
}
|
|
3136
|
-
};
|
|
3137
|
-
return TelemetryContext;
|
|
3138
|
-
}());
|
|
3139
|
-
ApplicationInsights.TelemetryContext = TelemetryContext;
|
|
3140
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
3141
|
-
})(Microsoft || (Microsoft = {}));
|
|
3142
|
-
var Microsoft;
|
|
3143
|
-
(function (Microsoft) {
|
|
3144
|
-
var Telemetry;
|
|
3145
|
-
(function (Telemetry) {
|
|
3146
|
-
"use strict";
|
|
3147
|
-
var Data = (function (_super) {
|
|
3148
|
-
__extends(Data, _super);
|
|
3149
|
-
function Data() {
|
|
3150
|
-
_super.call(this);
|
|
3151
|
-
}
|
|
3152
|
-
return Data;
|
|
3153
|
-
}(Microsoft.Telemetry.Base));
|
|
3154
|
-
Telemetry.Data = Data;
|
|
3155
|
-
})(Telemetry = Microsoft.Telemetry || (Microsoft.Telemetry = {}));
|
|
3156
|
-
})(Microsoft || (Microsoft = {}));
|
|
3157
|
-
var Microsoft;
|
|
3158
|
-
(function (Microsoft) {
|
|
3159
|
-
var ApplicationInsights;
|
|
3160
|
-
(function (ApplicationInsights) {
|
|
3161
|
-
var Telemetry;
|
|
3162
|
-
(function (Telemetry) {
|
|
3163
|
-
var Common;
|
|
3164
|
-
(function (Common) {
|
|
3165
|
-
"use strict";
|
|
3166
|
-
var Data = (function (_super) {
|
|
3167
|
-
__extends(Data, _super);
|
|
3168
|
-
function Data(type, data) {
|
|
3169
|
-
_super.call(this);
|
|
3170
|
-
this.aiDataContract = {
|
|
3171
|
-
baseType: ApplicationInsights.FieldType.Required,
|
|
3172
|
-
baseData: ApplicationInsights.FieldType.Required
|
|
3173
|
-
};
|
|
3174
|
-
this.baseType = type;
|
|
3175
|
-
this.baseData = data;
|
|
3176
|
-
}
|
|
3177
|
-
return Data;
|
|
3178
|
-
}(Microsoft.Telemetry.Data));
|
|
3179
|
-
Common.Data = Data;
|
|
3180
|
-
})(Common = Telemetry.Common || (Telemetry.Common = {}));
|
|
3181
|
-
})(Telemetry = ApplicationInsights.Telemetry || (ApplicationInsights.Telemetry = {}));
|
|
3182
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
3183
|
-
})(Microsoft || (Microsoft = {}));
|
|
3184
|
-
var Microsoft;
|
|
3185
|
-
(function (Microsoft) {
|
|
3186
|
-
var ApplicationInsights;
|
|
3187
|
-
(function (ApplicationInsights) {
|
|
3188
|
-
var Telemetry;
|
|
3189
|
-
(function (Telemetry) {
|
|
3190
|
-
"use strict";
|
|
3191
|
-
var PageViewManager = (function () {
|
|
3192
|
-
function PageViewManager(appInsights, overridePageViewDuration) {
|
|
3193
|
-
this.pageViewPerformanceSent = false;
|
|
3194
|
-
this.overridePageViewDuration = false;
|
|
3195
|
-
this.overridePageViewDuration = overridePageViewDuration;
|
|
3196
|
-
this.appInsights = appInsights;
|
|
3197
|
-
}
|
|
3198
|
-
PageViewManager.prototype.trackPageView = function (name, url, properties, measurements, duration) {
|
|
3199
|
-
var _this = this;
|
|
3200
|
-
if (typeof name !== "string") {
|
|
3201
|
-
name = window.document && window.document.title || "";
|
|
3202
|
-
}
|
|
3203
|
-
if (typeof url !== "string") {
|
|
3204
|
-
url = window.location && window.location.href || "";
|
|
3205
|
-
}
|
|
3206
|
-
var pageViewSent = false;
|
|
3207
|
-
var customDuration = undefined;
|
|
3208
|
-
if (Telemetry.PageViewPerformance.isPerformanceTimingSupported()) {
|
|
3209
|
-
var start = Telemetry.PageViewPerformance.getPerformanceTiming().navigationStart;
|
|
3210
|
-
customDuration = Telemetry.PageViewPerformance.getDuration(start, +new Date);
|
|
3211
|
-
if (!Telemetry.PageViewPerformance.shouldCollectDuration(customDuration)) {
|
|
3212
|
-
customDuration = undefined;
|
|
3213
|
-
}
|
|
3214
|
-
}
|
|
3215
|
-
else {
|
|
3216
|
-
this.appInsights.sendPageViewInternal(name, url, !isNaN(duration) ? duration : undefined, properties, measurements);
|
|
3217
|
-
this.appInsights.flush();
|
|
3218
|
-
pageViewSent = true;
|
|
3219
|
-
}
|
|
3220
|
-
if (!pageViewSent && (this.overridePageViewDuration || !isNaN(duration))) {
|
|
3221
|
-
this.appInsights.sendPageViewInternal(name, url, !isNaN(duration) ? duration : customDuration, properties, measurements);
|
|
3222
|
-
this.appInsights.flush();
|
|
3223
|
-
pageViewSent = true;
|
|
3224
|
-
}
|
|
3225
|
-
var maxDurationLimit = 60000;
|
|
3226
|
-
if (!Telemetry.PageViewPerformance.isPerformanceTimingSupported()) {
|
|
3227
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.NavigationTimingNotSupported, "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.");
|
|
3228
|
-
return;
|
|
3229
|
-
}
|
|
3230
|
-
var handle = setInterval(function () {
|
|
3231
|
-
try {
|
|
3232
|
-
if (Telemetry.PageViewPerformance.isPerformanceTimingDataReady()) {
|
|
3233
|
-
clearInterval(handle);
|
|
3234
|
-
var pageViewPerformance = new Telemetry.PageViewPerformance(name, url, null, properties, measurements);
|
|
3235
|
-
if (!pageViewPerformance.getIsValid() && !pageViewSent) {
|
|
3236
|
-
_this.appInsights.sendPageViewInternal(name, url, customDuration, properties, measurements);
|
|
3237
|
-
_this.appInsights.flush();
|
|
3238
|
-
}
|
|
3239
|
-
else {
|
|
3240
|
-
if (!pageViewSent) {
|
|
3241
|
-
_this.appInsights.sendPageViewInternal(name, url, pageViewPerformance.getDurationMs(), properties, measurements);
|
|
3242
|
-
}
|
|
3243
|
-
if (!_this.pageViewPerformanceSent) {
|
|
3244
|
-
_this.appInsights.sendPageViewPerformanceInternal(pageViewPerformance);
|
|
3245
|
-
_this.pageViewPerformanceSent = true;
|
|
3246
|
-
}
|
|
3247
|
-
_this.appInsights.flush();
|
|
3248
|
-
}
|
|
3249
|
-
}
|
|
3250
|
-
else if (Telemetry.PageViewPerformance.getDuration(start, +new Date) > maxDurationLimit) {
|
|
3251
|
-
clearInterval(handle);
|
|
3252
|
-
if (!pageViewSent) {
|
|
3253
|
-
_this.appInsights.sendPageViewInternal(name, url, maxDurationLimit, properties, measurements);
|
|
3254
|
-
_this.appInsights.flush();
|
|
3255
|
-
}
|
|
3256
|
-
}
|
|
3257
|
-
}
|
|
3258
|
-
catch (e) {
|
|
3259
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.TrackPVFailedCalc, "trackPageView failed on page load calculation: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
|
|
3260
|
-
}
|
|
3261
|
-
}, 100);
|
|
3262
|
-
};
|
|
3263
|
-
return PageViewManager;
|
|
3264
|
-
}());
|
|
3265
|
-
Telemetry.PageViewManager = PageViewManager;
|
|
3266
|
-
})(Telemetry = ApplicationInsights.Telemetry || (ApplicationInsights.Telemetry = {}));
|
|
3267
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
3268
|
-
})(Microsoft || (Microsoft = {}));
|
|
3269
|
-
var Microsoft;
|
|
3270
|
-
(function (Microsoft) {
|
|
3271
|
-
var ApplicationInsights;
|
|
3272
|
-
(function (ApplicationInsights) {
|
|
3273
|
-
var Telemetry;
|
|
3274
|
-
(function (Telemetry) {
|
|
3275
|
-
"use strict";
|
|
3276
|
-
var PageVisitTimeManager = (function () {
|
|
3277
|
-
function PageVisitTimeManager(pageVisitTimeTrackingHandler) {
|
|
3278
|
-
this.prevPageVisitDataKeyName = "prevPageVisitData";
|
|
3279
|
-
this.pageVisitTimeTrackingHandler = pageVisitTimeTrackingHandler;
|
|
3280
|
-
}
|
|
3281
|
-
PageVisitTimeManager.prototype.trackPreviousPageVisit = function (currentPageName, currentPageUrl) {
|
|
3282
|
-
try {
|
|
3283
|
-
var prevPageVisitTimeData = this.restartPageVisitTimer(currentPageName, currentPageUrl);
|
|
3284
|
-
if (prevPageVisitTimeData) {
|
|
3285
|
-
this.pageVisitTimeTrackingHandler(prevPageVisitTimeData.pageName, prevPageVisitTimeData.pageUrl, prevPageVisitTimeData.pageVisitTime);
|
|
3286
|
-
}
|
|
3287
|
-
}
|
|
3288
|
-
catch (e) {
|
|
3289
|
-
ApplicationInsights._InternalLogging.warnToConsole("Auto track page visit time failed, metric will not be collected: " + ApplicationInsights.Util.dump(e));
|
|
3290
|
-
}
|
|
3291
|
-
};
|
|
3292
|
-
PageVisitTimeManager.prototype.restartPageVisitTimer = function (pageName, pageUrl) {
|
|
3293
|
-
try {
|
|
3294
|
-
var prevPageVisitData = this.stopPageVisitTimer();
|
|
3295
|
-
this.startPageVisitTimer(pageName, pageUrl);
|
|
3296
|
-
return prevPageVisitData;
|
|
3297
|
-
}
|
|
3298
|
-
catch (e) {
|
|
3299
|
-
ApplicationInsights._InternalLogging.warnToConsole("Call to restart failed: " + ApplicationInsights.Util.dump(e));
|
|
3300
|
-
return null;
|
|
3301
|
-
}
|
|
3302
|
-
};
|
|
3303
|
-
PageVisitTimeManager.prototype.startPageVisitTimer = function (pageName, pageUrl) {
|
|
3304
|
-
try {
|
|
3305
|
-
if (ApplicationInsights.Util.canUseSessionStorage()) {
|
|
3306
|
-
if (ApplicationInsights.Util.getSessionStorage(this.prevPageVisitDataKeyName) != null) {
|
|
3307
|
-
throw new Error("Cannot call startPageVisit consecutively without first calling stopPageVisit");
|
|
3308
|
-
}
|
|
3309
|
-
var currPageVisitData = new PageVisitData(pageName, pageUrl);
|
|
3310
|
-
var currPageVisitDataStr = JSON.stringify(currPageVisitData);
|
|
3311
|
-
ApplicationInsights.Util.setSessionStorage(this.prevPageVisitDataKeyName, currPageVisitDataStr);
|
|
3312
|
-
}
|
|
3313
|
-
}
|
|
3314
|
-
catch (e) {
|
|
3315
|
-
ApplicationInsights._InternalLogging.warnToConsole("Call to start failed: " + ApplicationInsights.Util.dump(e));
|
|
3316
|
-
}
|
|
3317
|
-
};
|
|
3318
|
-
PageVisitTimeManager.prototype.stopPageVisitTimer = function () {
|
|
3319
|
-
try {
|
|
3320
|
-
if (ApplicationInsights.Util.canUseSessionStorage()) {
|
|
3321
|
-
var pageVisitEndTime = Date.now();
|
|
3322
|
-
var pageVisitDataJsonStr = ApplicationInsights.Util.getSessionStorage(this.prevPageVisitDataKeyName);
|
|
3323
|
-
if (pageVisitDataJsonStr) {
|
|
3324
|
-
var prevPageVisitData = JSON.parse(pageVisitDataJsonStr);
|
|
3325
|
-
prevPageVisitData.pageVisitTime = pageVisitEndTime - prevPageVisitData.pageVisitStartTime;
|
|
3326
|
-
ApplicationInsights.Util.removeSessionStorage(this.prevPageVisitDataKeyName);
|
|
3327
|
-
return prevPageVisitData;
|
|
3328
|
-
}
|
|
3329
|
-
else {
|
|
3330
|
-
return null;
|
|
3331
|
-
}
|
|
3332
|
-
}
|
|
3333
|
-
return null;
|
|
3334
|
-
}
|
|
3335
|
-
catch (e) {
|
|
3336
|
-
ApplicationInsights._InternalLogging.warnToConsole("Stop page visit timer failed: " + ApplicationInsights.Util.dump(e));
|
|
3337
|
-
return null;
|
|
3338
|
-
}
|
|
3339
|
-
};
|
|
3340
|
-
return PageVisitTimeManager;
|
|
3341
|
-
}());
|
|
3342
|
-
Telemetry.PageVisitTimeManager = PageVisitTimeManager;
|
|
3343
|
-
var PageVisitData = (function () {
|
|
3344
|
-
function PageVisitData(pageName, pageUrl) {
|
|
3345
|
-
this.pageVisitStartTime = Date.now();
|
|
3346
|
-
this.pageName = pageName;
|
|
3347
|
-
this.pageUrl = pageUrl;
|
|
3348
|
-
}
|
|
3349
|
-
return PageVisitData;
|
|
3350
|
-
}());
|
|
3351
|
-
Telemetry.PageVisitData = PageVisitData;
|
|
3352
|
-
})(Telemetry = ApplicationInsights.Telemetry || (ApplicationInsights.Telemetry = {}));
|
|
3353
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
3354
|
-
})(Microsoft || (Microsoft = {}));
|
|
3355
|
-
var AI;
|
|
3356
|
-
(function (AI) {
|
|
3357
|
-
"use strict";
|
|
3358
|
-
(function (DependencyKind) {
|
|
3359
|
-
DependencyKind[DependencyKind["SQL"] = 0] = "SQL";
|
|
3360
|
-
DependencyKind[DependencyKind["Http"] = 1] = "Http";
|
|
3361
|
-
DependencyKind[DependencyKind["Other"] = 2] = "Other";
|
|
3362
|
-
})(AI.DependencyKind || (AI.DependencyKind = {}));
|
|
3363
|
-
var DependencyKind = AI.DependencyKind;
|
|
3364
|
-
})(AI || (AI = {}));
|
|
3365
|
-
var AI;
|
|
3366
|
-
(function (AI) {
|
|
3367
|
-
"use strict";
|
|
3368
|
-
(function (DependencySourceType) {
|
|
3369
|
-
DependencySourceType[DependencySourceType["Undefined"] = 0] = "Undefined";
|
|
3370
|
-
DependencySourceType[DependencySourceType["Aic"] = 1] = "Aic";
|
|
3371
|
-
DependencySourceType[DependencySourceType["Apmc"] = 2] = "Apmc";
|
|
3372
|
-
})(AI.DependencySourceType || (AI.DependencySourceType = {}));
|
|
3373
|
-
var DependencySourceType = AI.DependencySourceType;
|
|
3374
|
-
})(AI || (AI = {}));
|
|
3375
|
-
var AI;
|
|
3376
|
-
(function (AI) {
|
|
3377
|
-
"use strict";
|
|
3378
|
-
var RemoteDependencyData = (function (_super) {
|
|
3379
|
-
__extends(RemoteDependencyData, _super);
|
|
3380
|
-
function RemoteDependencyData() {
|
|
3381
|
-
_super.call(this);
|
|
3382
|
-
this.ver = 2;
|
|
3383
|
-
this.kind = AI.DataPointType.Aggregation;
|
|
3384
|
-
this.dependencyKind = AI.DependencyKind.Other;
|
|
3385
|
-
this.success = true;
|
|
3386
|
-
this.dependencySource = AI.DependencySourceType.Apmc;
|
|
3387
|
-
this.properties = {};
|
|
3388
|
-
this.measurements = {};
|
|
3389
|
-
_super.call(this);
|
|
3390
|
-
}
|
|
3391
|
-
return RemoteDependencyData;
|
|
3392
|
-
}(Microsoft.Telemetry.Domain));
|
|
3393
|
-
AI.RemoteDependencyData = RemoteDependencyData;
|
|
3394
|
-
})(AI || (AI = {}));
|
|
3395
|
-
var Microsoft;
|
|
3396
|
-
(function (Microsoft) {
|
|
3397
|
-
var ApplicationInsights;
|
|
3398
|
-
(function (ApplicationInsights) {
|
|
3399
|
-
var Telemetry;
|
|
3400
|
-
(function (Telemetry) {
|
|
3401
|
-
"use strict";
|
|
3402
|
-
var RemoteDependencyData = (function (_super) {
|
|
3403
|
-
__extends(RemoteDependencyData, _super);
|
|
3404
|
-
function RemoteDependencyData(id, absoluteUrl, commandName, value, success, resultCode, method, properties, measurements) {
|
|
3405
|
-
_super.call(this);
|
|
3406
|
-
this.aiDataContract = {
|
|
3407
|
-
id: ApplicationInsights.FieldType.Required,
|
|
3408
|
-
ver: ApplicationInsights.FieldType.Required,
|
|
3409
|
-
name: ApplicationInsights.FieldType.Default,
|
|
3410
|
-
resultCode: ApplicationInsights.FieldType.Default,
|
|
3411
|
-
duration: ApplicationInsights.FieldType.Default,
|
|
3412
|
-
success: ApplicationInsights.FieldType.Default,
|
|
3413
|
-
data: ApplicationInsights.FieldType.Default,
|
|
3414
|
-
target: ApplicationInsights.FieldType.Default,
|
|
3415
|
-
type: ApplicationInsights.FieldType.Default,
|
|
3416
|
-
properties: ApplicationInsights.FieldType.Default,
|
|
3417
|
-
measurements: ApplicationInsights.FieldType.Default,
|
|
3418
|
-
kind: ApplicationInsights.FieldType.Default,
|
|
3419
|
-
value: ApplicationInsights.FieldType.Default,
|
|
3420
|
-
count: ApplicationInsights.FieldType.Default,
|
|
3421
|
-
min: ApplicationInsights.FieldType.Default,
|
|
3422
|
-
max: ApplicationInsights.FieldType.Default,
|
|
3423
|
-
stdDev: ApplicationInsights.FieldType.Default,
|
|
3424
|
-
dependencyKind: ApplicationInsights.FieldType.Default,
|
|
3425
|
-
async: ApplicationInsights.FieldType.Default,
|
|
3426
|
-
dependencySource: ApplicationInsights.FieldType.Default,
|
|
3427
|
-
commandName: ApplicationInsights.FieldType.Default,
|
|
3428
|
-
dependencyTypeName: ApplicationInsights.FieldType.Default,
|
|
3429
|
-
};
|
|
3430
|
-
this.id = id;
|
|
3431
|
-
this.duration = ApplicationInsights.Util.msToTimeSpan(value);
|
|
3432
|
-
this.success = success;
|
|
3433
|
-
this.resultCode = resultCode + "";
|
|
3434
|
-
this.dependencyKind = AI.DependencyKind.Http;
|
|
3435
|
-
this.type = "Ajax";
|
|
3436
|
-
this.data = Telemetry.Common.DataSanitizer.sanitizeUrl(commandName);
|
|
3437
|
-
if (absoluteUrl && absoluteUrl.length > 0) {
|
|
3438
|
-
var parsedUrl = ApplicationInsights.UrlHelper.parseUrl(absoluteUrl);
|
|
3439
|
-
this.target = parsedUrl.host;
|
|
3440
|
-
if (parsedUrl.pathname != null) {
|
|
3441
|
-
var pathName = (parsedUrl.pathname.length === 0) ? "/" : parsedUrl.pathname;
|
|
3442
|
-
if (pathName.charAt(0) !== '/') {
|
|
3443
|
-
pathName = "/" + pathName;
|
|
3444
|
-
}
|
|
3445
|
-
this.name = Telemetry.Common.DataSanitizer.sanitizeString(method ? method + " " + pathName : pathName);
|
|
3446
|
-
}
|
|
3447
|
-
else {
|
|
3448
|
-
this.name = Telemetry.Common.DataSanitizer.sanitizeString(absoluteUrl);
|
|
3449
|
-
}
|
|
3450
|
-
}
|
|
3451
|
-
else {
|
|
3452
|
-
this.target = commandName;
|
|
3453
|
-
this.name = commandName;
|
|
3454
|
-
}
|
|
3455
|
-
this.properties = ApplicationInsights.Telemetry.Common.DataSanitizer.sanitizeProperties(properties);
|
|
3456
|
-
this.measurements = ApplicationInsights.Telemetry.Common.DataSanitizer.sanitizeMeasurements(measurements);
|
|
3457
|
-
}
|
|
3458
|
-
RemoteDependencyData.envelopeType = "Microsoft.ApplicationInsights.{0}.RemoteDependency";
|
|
3459
|
-
RemoteDependencyData.dataType = "RemoteDependencyData";
|
|
3460
|
-
return RemoteDependencyData;
|
|
3461
|
-
}(AI.RemoteDependencyData));
|
|
3462
|
-
Telemetry.RemoteDependencyData = RemoteDependencyData;
|
|
3463
|
-
})(Telemetry = ApplicationInsights.Telemetry || (ApplicationInsights.Telemetry = {}));
|
|
3464
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
3465
|
-
})(Microsoft || (Microsoft = {}));
|
|
3466
|
-
var Microsoft;
|
|
3467
|
-
(function (Microsoft) {
|
|
3468
|
-
var ApplicationInsights;
|
|
3469
|
-
(function (ApplicationInsights) {
|
|
3470
|
-
"use strict";
|
|
3471
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
3472
|
-
})(Microsoft || (Microsoft = {}));
|
|
3473
|
-
var Microsoft;
|
|
3474
|
-
(function (Microsoft) {
|
|
3475
|
-
var ApplicationInsights;
|
|
3476
|
-
(function (ApplicationInsights) {
|
|
3477
|
-
"use strict";
|
|
3478
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
3479
|
-
})(Microsoft || (Microsoft = {}));
|
|
3480
|
-
var Microsoft;
|
|
3481
|
-
(function (Microsoft) {
|
|
3482
|
-
var ApplicationInsights;
|
|
3483
|
-
(function (ApplicationInsights) {
|
|
3484
|
-
"use strict";
|
|
3485
|
-
ApplicationInsights.Version = "1.0.11";
|
|
3486
|
-
var AppInsights = (function () {
|
|
3487
|
-
function AppInsights(config) {
|
|
3488
|
-
var _this = this;
|
|
3489
|
-
this._trackAjaxAttempts = 0;
|
|
3490
|
-
this.config = config || {};
|
|
3491
|
-
var defaults = AppInsights.defaultConfig;
|
|
3492
|
-
if (defaults !== undefined) {
|
|
3493
|
-
for (var field in defaults) {
|
|
3494
|
-
if (this.config[field] === undefined) {
|
|
3495
|
-
this.config[field] = defaults[field];
|
|
3496
|
-
}
|
|
3497
|
-
}
|
|
3498
|
-
}
|
|
3499
|
-
ApplicationInsights._InternalLogging.verboseLogging = function () { return _this.config.verboseLogging; };
|
|
3500
|
-
ApplicationInsights._InternalLogging.enableDebugExceptions = function () { return _this.config.enableDebug; };
|
|
3501
|
-
var configGetters = {
|
|
3502
|
-
instrumentationKey: function () { return _this.config.instrumentationKey; },
|
|
3503
|
-
accountId: function () { return _this.config.accountId; },
|
|
3504
|
-
sessionRenewalMs: function () { return _this.config.sessionRenewalMs; },
|
|
3505
|
-
sessionExpirationMs: function () { return _this.config.sessionExpirationMs; },
|
|
3506
|
-
endpointUrl: function () { return _this.config.endpointUrl; },
|
|
3507
|
-
emitLineDelimitedJson: function () { return _this.config.emitLineDelimitedJson; },
|
|
3508
|
-
maxBatchSizeInBytes: function () {
|
|
3509
|
-
return (!_this.config.isBeaconApiDisabled && ApplicationInsights.Util.IsBeaconApiSupported()) ?
|
|
3510
|
-
Math.min(_this.config.maxBatchSizeInBytes, ApplicationInsights.Sender.MaxBeaconPayloadSize) :
|
|
3511
|
-
_this.config.maxBatchSizeInBytes;
|
|
3512
|
-
},
|
|
3513
|
-
maxBatchInterval: function () { return _this.config.maxBatchInterval; },
|
|
3514
|
-
disableTelemetry: function () { return _this.config.disableTelemetry; },
|
|
3515
|
-
sampleRate: function () { return _this.config.samplingPercentage; },
|
|
3516
|
-
cookieDomain: function () { return _this.config.cookieDomain; },
|
|
3517
|
-
enableSessionStorageBuffer: function () {
|
|
3518
|
-
return ((_this.config.isBeaconApiDisabled || !ApplicationInsights.Util.IsBeaconApiSupported()) && _this.config.enableSessionStorageBuffer);
|
|
3519
|
-
},
|
|
3520
|
-
isRetryDisabled: function () { return _this.config.isRetryDisabled; },
|
|
3521
|
-
isBeaconApiDisabled: function () { return _this.config.isBeaconApiDisabled; },
|
|
3522
|
-
sdkExtension: function () { return _this.config.sdkExtension; },
|
|
3523
|
-
isBrowserLinkTrackingEnabled: function () { return _this.config.isBrowserLinkTrackingEnabled; }
|
|
3524
|
-
};
|
|
3525
|
-
if (this.config.isCookieUseDisabled) {
|
|
3526
|
-
ApplicationInsights.Util.disableCookies();
|
|
3527
|
-
}
|
|
3528
|
-
if (this.config.isStorageUseDisabled) {
|
|
3529
|
-
ApplicationInsights.Util.disableStorage();
|
|
3530
|
-
}
|
|
3531
|
-
this.context = new ApplicationInsights.TelemetryContext(configGetters);
|
|
3532
|
-
this._pageViewManager = new Microsoft.ApplicationInsights.Telemetry.PageViewManager(this, this.config.overridePageViewDuration);
|
|
3533
|
-
this._eventTracking = new Timing("trackEvent");
|
|
3534
|
-
this._eventTracking.action = function (name, url, duration, properties, measurements) {
|
|
3535
|
-
if (!measurements) {
|
|
3536
|
-
measurements = { duration: duration };
|
|
3537
|
-
}
|
|
3538
|
-
else {
|
|
3539
|
-
if (isNaN(measurements["duration"])) {
|
|
3540
|
-
measurements["duration"] = duration;
|
|
3541
|
-
}
|
|
3542
|
-
}
|
|
3543
|
-
var event = new ApplicationInsights.Telemetry.Event(name, properties, measurements);
|
|
3544
|
-
var data = new ApplicationInsights.Telemetry.Common.Data(ApplicationInsights.Telemetry.Event.dataType, event);
|
|
3545
|
-
var envelope = new ApplicationInsights.Telemetry.Common.Envelope(data, ApplicationInsights.Telemetry.Event.envelopeType);
|
|
3546
|
-
_this.context.track(envelope);
|
|
3547
|
-
};
|
|
3548
|
-
this._pageTracking = new Timing("trackPageView");
|
|
3549
|
-
this._pageTracking.action = function (name, url, duration, properties, measurements) {
|
|
3550
|
-
_this.sendPageViewInternal(name, url, duration, properties, measurements);
|
|
3551
|
-
};
|
|
3552
|
-
this._pageVisitTimeManager = new ApplicationInsights.Telemetry.PageVisitTimeManager(function (pageName, pageUrl, pageVisitTime) { return _this.trackPageVisitTime(pageName, pageUrl, pageVisitTime); });
|
|
3553
|
-
if (!this.config.disableAjaxTracking) {
|
|
3554
|
-
this._ajaxMonitor = new Microsoft.ApplicationInsights.AjaxMonitor(this);
|
|
3555
|
-
}
|
|
3556
|
-
}
|
|
3557
|
-
AppInsights.prototype.sendPageViewInternal = function (name, url, duration, properties, measurements) {
|
|
3558
|
-
var pageView = new ApplicationInsights.Telemetry.PageView(name, url, duration, properties, measurements);
|
|
3559
|
-
var data = new ApplicationInsights.Telemetry.Common.Data(ApplicationInsights.Telemetry.PageView.dataType, pageView);
|
|
3560
|
-
var envelope = new ApplicationInsights.Telemetry.Common.Envelope(data, ApplicationInsights.Telemetry.PageView.envelopeType);
|
|
3561
|
-
this.context.track(envelope);
|
|
3562
|
-
this._trackAjaxAttempts = 0;
|
|
3563
|
-
};
|
|
3564
|
-
AppInsights.prototype.sendPageViewPerformanceInternal = function (pageViewPerformance) {
|
|
3565
|
-
var pageViewPerformanceData = new ApplicationInsights.Telemetry.Common.Data(ApplicationInsights.Telemetry.PageViewPerformance.dataType, pageViewPerformance);
|
|
3566
|
-
var pageViewPerformanceEnvelope = new ApplicationInsights.Telemetry.Common.Envelope(pageViewPerformanceData, ApplicationInsights.Telemetry.PageViewPerformance.envelopeType);
|
|
3567
|
-
this.context.track(pageViewPerformanceEnvelope);
|
|
3568
|
-
};
|
|
3569
|
-
AppInsights.prototype.startTrackPage = function (name) {
|
|
3570
|
-
try {
|
|
3571
|
-
if (typeof name !== "string") {
|
|
3572
|
-
name = window.document && window.document.title || "";
|
|
3573
|
-
}
|
|
3574
|
-
this._pageTracking.start(name);
|
|
3575
|
-
}
|
|
3576
|
-
catch (e) {
|
|
3577
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.StartTrackFailed, "startTrackPage failed, page view may not be collected: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
|
|
3578
|
-
}
|
|
3579
|
-
};
|
|
3580
|
-
AppInsights.prototype.stopTrackPage = function (name, url, properties, measurements) {
|
|
3581
|
-
try {
|
|
3582
|
-
if (typeof name !== "string") {
|
|
3583
|
-
name = window.document && window.document.title || "";
|
|
3584
|
-
}
|
|
3585
|
-
if (typeof url !== "string") {
|
|
3586
|
-
url = window.location && window.location.href || "";
|
|
3587
|
-
}
|
|
3588
|
-
this._pageTracking.stop(name, url, properties, measurements);
|
|
3589
|
-
if (this.config.autoTrackPageVisitTime) {
|
|
3590
|
-
this._pageVisitTimeManager.trackPreviousPageVisit(name, url);
|
|
3591
|
-
}
|
|
3592
|
-
}
|
|
3593
|
-
catch (e) {
|
|
3594
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.StopTrackFailed, "stopTrackPage failed, page view will not be collected: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
|
|
3595
|
-
}
|
|
3596
|
-
};
|
|
3597
|
-
AppInsights.prototype.trackPageView = function (name, url, properties, measurements, duration) {
|
|
3598
|
-
try {
|
|
3599
|
-
this._pageViewManager.trackPageView(name, url, properties, measurements, duration);
|
|
3600
|
-
if (this.config.autoTrackPageVisitTime) {
|
|
3601
|
-
this._pageVisitTimeManager.trackPreviousPageVisit(name, url);
|
|
3602
|
-
}
|
|
3603
|
-
}
|
|
3604
|
-
catch (e) {
|
|
3605
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.TrackPVFailed, "trackPageView failed, page view will not be collected: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
|
|
3606
|
-
}
|
|
3607
|
-
};
|
|
3608
|
-
AppInsights.prototype.startTrackEvent = function (name) {
|
|
3609
|
-
try {
|
|
3610
|
-
this._eventTracking.start(name);
|
|
3611
|
-
}
|
|
3612
|
-
catch (e) {
|
|
3613
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.StartTrackEventFailed, "startTrackEvent failed, event will not be collected: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
|
|
3614
|
-
}
|
|
3615
|
-
};
|
|
3616
|
-
AppInsights.prototype.stopTrackEvent = function (name, properties, measurements) {
|
|
3617
|
-
try {
|
|
3618
|
-
this._eventTracking.stop(name, undefined, properties, measurements);
|
|
3619
|
-
}
|
|
3620
|
-
catch (e) {
|
|
3621
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.StopTrackEventFailed, "stopTrackEvent failed, event will not be collected: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
|
|
3622
|
-
}
|
|
3623
|
-
};
|
|
3624
|
-
AppInsights.prototype.trackEvent = function (name, properties, measurements) {
|
|
3625
|
-
try {
|
|
3626
|
-
var eventTelemetry = new ApplicationInsights.Telemetry.Event(name, properties, measurements);
|
|
3627
|
-
var data = new ApplicationInsights.Telemetry.Common.Data(ApplicationInsights.Telemetry.Event.dataType, eventTelemetry);
|
|
3628
|
-
var envelope = new ApplicationInsights.Telemetry.Common.Envelope(data, ApplicationInsights.Telemetry.Event.envelopeType);
|
|
3629
|
-
this.context.track(envelope);
|
|
3630
|
-
}
|
|
3631
|
-
catch (e) {
|
|
3632
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.TrackEventFailed, "trackEvent failed, event will not be collected: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
|
|
3633
|
-
}
|
|
3634
|
-
};
|
|
3635
|
-
AppInsights.prototype.trackDependency = function (id, method, absoluteUrl, pathName, totalTime, success, resultCode, properties, measurements) {
|
|
3636
|
-
if (this.config.maxAjaxCallsPerView === -1 ||
|
|
3637
|
-
this._trackAjaxAttempts < this.config.maxAjaxCallsPerView) {
|
|
3638
|
-
var dependency = new ApplicationInsights.Telemetry.RemoteDependencyData(id, absoluteUrl, pathName, totalTime, success, resultCode, method, properties, measurements);
|
|
3639
|
-
var dependencyData = new ApplicationInsights.Telemetry.Common.Data(ApplicationInsights.Telemetry.RemoteDependencyData.dataType, dependency);
|
|
3640
|
-
var envelope = new ApplicationInsights.Telemetry.Common.Envelope(dependencyData, ApplicationInsights.Telemetry.RemoteDependencyData.envelopeType);
|
|
3641
|
-
this.context.track(envelope);
|
|
3642
|
-
}
|
|
3643
|
-
else if (this._trackAjaxAttempts === this.config.maxAjaxCallsPerView) {
|
|
3644
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.MaxAjaxPerPVExceeded, "Maximum ajax per page view limit reached, ajax monitoring is paused until the next trackPageView(). In order to increase the limit set the maxAjaxCallsPerView configuration parameter.", true);
|
|
3645
|
-
}
|
|
3646
|
-
++this._trackAjaxAttempts;
|
|
3647
|
-
};
|
|
3648
|
-
AppInsights.prototype.trackAjax = function (id, absoluteUrl, pathName, totalTime, success, resultCode, method) {
|
|
3649
|
-
this.trackDependency(id, null, absoluteUrl, pathName, totalTime, success, resultCode);
|
|
3650
|
-
};
|
|
3651
|
-
AppInsights.prototype.trackException = function (exception, handledAt, properties, measurements, severityLevel) {
|
|
3652
|
-
try {
|
|
3653
|
-
if (!ApplicationInsights.Util.isError(exception)) {
|
|
3654
|
-
try {
|
|
3655
|
-
throw new Error(exception);
|
|
3656
|
-
}
|
|
3657
|
-
catch (error) {
|
|
3658
|
-
exception = error;
|
|
3659
|
-
}
|
|
3660
|
-
}
|
|
3661
|
-
var exceptionTelemetry = new ApplicationInsights.Telemetry.Exception(exception, handledAt, properties, measurements, severityLevel);
|
|
3662
|
-
var data = new ApplicationInsights.Telemetry.Common.Data(ApplicationInsights.Telemetry.Exception.dataType, exceptionTelemetry);
|
|
3663
|
-
var envelope = new ApplicationInsights.Telemetry.Common.Envelope(data, ApplicationInsights.Telemetry.Exception.envelopeType);
|
|
3664
|
-
this.context.track(envelope);
|
|
3665
|
-
}
|
|
3666
|
-
catch (e) {
|
|
3667
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.TrackExceptionFailed, "trackException failed, exception will not be collected: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
|
|
3668
|
-
}
|
|
3669
|
-
};
|
|
3670
|
-
AppInsights.prototype.trackMetric = function (name, average, sampleCount, min, max, properties) {
|
|
3671
|
-
try {
|
|
3672
|
-
var telemetry = new ApplicationInsights.Telemetry.Metric(name, average, sampleCount, min, max, properties);
|
|
3673
|
-
var data = new ApplicationInsights.Telemetry.Common.Data(ApplicationInsights.Telemetry.Metric.dataType, telemetry);
|
|
3674
|
-
var envelope = new ApplicationInsights.Telemetry.Common.Envelope(data, ApplicationInsights.Telemetry.Metric.envelopeType);
|
|
3675
|
-
this.context.track(envelope);
|
|
3676
|
-
}
|
|
3677
|
-
catch (e) {
|
|
3678
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.TrackMetricFailed, "trackMetric failed, metric will not be collected: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
|
|
3679
|
-
}
|
|
3680
|
-
};
|
|
3681
|
-
AppInsights.prototype.trackTrace = function (message, properties, severityLevel) {
|
|
3682
|
-
try {
|
|
3683
|
-
var telemetry = new ApplicationInsights.Telemetry.Trace(message, properties, severityLevel);
|
|
3684
|
-
var data = new ApplicationInsights.Telemetry.Common.Data(ApplicationInsights.Telemetry.Trace.dataType, telemetry);
|
|
3685
|
-
var envelope = new ApplicationInsights.Telemetry.Common.Envelope(data, ApplicationInsights.Telemetry.Trace.envelopeType);
|
|
3686
|
-
this.context.track(envelope);
|
|
3687
|
-
}
|
|
3688
|
-
catch (e) {
|
|
3689
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.TrackTraceFailed, "trackTrace failed, trace will not be collected: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
|
|
3690
|
-
}
|
|
3691
|
-
};
|
|
3692
|
-
AppInsights.prototype.trackPageVisitTime = function (pageName, pageUrl, pageVisitTime) {
|
|
3693
|
-
var properties = { PageName: pageName, PageUrl: pageUrl };
|
|
3694
|
-
this.trackMetric("PageVisitTime", pageVisitTime, 1, pageVisitTime, pageVisitTime, properties);
|
|
3695
|
-
};
|
|
3696
|
-
AppInsights.prototype.flush = function (async) {
|
|
3697
|
-
if (async === void 0) { async = true; }
|
|
3698
|
-
try {
|
|
3699
|
-
this.context._sender.triggerSend(async);
|
|
3700
|
-
}
|
|
3701
|
-
catch (e) {
|
|
3702
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.FlushFailed, "flush failed, telemetry will not be collected: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
|
|
3703
|
-
}
|
|
3704
|
-
};
|
|
3705
|
-
AppInsights.prototype.setAuthenticatedUserContext = function (authenticatedUserId, accountId) {
|
|
3706
|
-
try {
|
|
3707
|
-
this.context.user.setAuthenticatedUserContext(authenticatedUserId, accountId);
|
|
3708
|
-
}
|
|
3709
|
-
catch (e) {
|
|
3710
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.SetAuthContextFailed, "Setting auth user context failed. " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) }, true);
|
|
3711
|
-
}
|
|
3712
|
-
};
|
|
3713
|
-
AppInsights.prototype.clearAuthenticatedUserContext = function () {
|
|
3714
|
-
try {
|
|
3715
|
-
this.context.user.clearAuthenticatedUserContext();
|
|
3716
|
-
}
|
|
3717
|
-
catch (e) {
|
|
3718
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.SetAuthContextFailed, "Clearing auth user context failed. " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) }, true);
|
|
3719
|
-
}
|
|
3720
|
-
};
|
|
3721
|
-
AppInsights.prototype.SendCORSException = function (properties) {
|
|
3722
|
-
var exceptionData = Microsoft.ApplicationInsights.Telemetry.Exception.CreateSimpleException("Script error.", "Error", "unknown", "unknown", "The browser's same-origin policy prevents us from getting the details of this exception. Consider using 'crossorigin' attribute.", 0, null);
|
|
3723
|
-
exceptionData.properties = properties;
|
|
3724
|
-
var data = new ApplicationInsights.Telemetry.Common.Data(ApplicationInsights.Telemetry.Exception.dataType, exceptionData);
|
|
3725
|
-
var envelope = new ApplicationInsights.Telemetry.Common.Envelope(data, ApplicationInsights.Telemetry.Exception.envelopeType);
|
|
3726
|
-
this.context.track(envelope);
|
|
3727
|
-
};
|
|
3728
|
-
AppInsights.prototype._onerror = function (message, url, lineNumber, columnNumber, error) {
|
|
3729
|
-
try {
|
|
3730
|
-
var properties = { url: url ? url : document.URL };
|
|
3731
|
-
if (ApplicationInsights.Util.isCrossOriginError(message, url, lineNumber, columnNumber, error)) {
|
|
3732
|
-
this.SendCORSException(properties);
|
|
3733
|
-
}
|
|
3734
|
-
else {
|
|
3735
|
-
if (!ApplicationInsights.Util.isError(error)) {
|
|
3736
|
-
var stack = "window.onerror@" + properties.url + ":" + lineNumber + ":" + (columnNumber || 0);
|
|
3737
|
-
error = new Error(message);
|
|
3738
|
-
error["stack"] = stack;
|
|
3739
|
-
}
|
|
3740
|
-
this.trackException(error, null, properties);
|
|
3741
|
-
}
|
|
3742
|
-
}
|
|
3743
|
-
catch (exception) {
|
|
3744
|
-
var errorString = error ? (error.name + ", " + error.message) : "null";
|
|
3745
|
-
var exceptionDump = ApplicationInsights.Util.dump(exception);
|
|
3746
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.ExceptionWhileLoggingError, "_onerror threw exception while logging error, error will not be collected: " + ApplicationInsights.Util.getExceptionName(exception), { exception: exceptionDump, errorString: errorString });
|
|
3747
|
-
}
|
|
3748
|
-
};
|
|
3749
|
-
return AppInsights;
|
|
3750
|
-
}());
|
|
3751
|
-
ApplicationInsights.AppInsights = AppInsights;
|
|
3752
|
-
var Timing = (function () {
|
|
3753
|
-
function Timing(name) {
|
|
3754
|
-
this._name = name;
|
|
3755
|
-
this._events = {};
|
|
3756
|
-
}
|
|
3757
|
-
Timing.prototype.start = function (name) {
|
|
3758
|
-
if (typeof this._events[name] !== "undefined") {
|
|
3759
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.StartCalledMoreThanOnce, "start was called more than once for this event without calling stop.", { name: this._name, key: name }, true);
|
|
3760
|
-
}
|
|
3761
|
-
this._events[name] = +new Date;
|
|
3762
|
-
};
|
|
3763
|
-
Timing.prototype.stop = function (name, url, properties, measurements) {
|
|
3764
|
-
var start = this._events[name];
|
|
3765
|
-
if (isNaN(start)) {
|
|
3766
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.StopCalledWithoutStart, "stop was called without a corresponding start.", { name: this._name, key: name }, true);
|
|
3767
|
-
}
|
|
3768
|
-
else {
|
|
3769
|
-
var end = +new Date;
|
|
3770
|
-
var duration = ApplicationInsights.Telemetry.PageViewPerformance.getDuration(start, end);
|
|
3771
|
-
this.action(name, url, duration, properties, measurements);
|
|
3772
|
-
}
|
|
3773
|
-
delete this._events[name];
|
|
3774
|
-
this._events[name] = undefined;
|
|
3775
|
-
};
|
|
3776
|
-
return Timing;
|
|
3777
|
-
}());
|
|
3778
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
3779
|
-
})(Microsoft || (Microsoft = {}));
|
|
3780
|
-
var Microsoft;
|
|
3781
|
-
(function (Microsoft) {
|
|
3782
|
-
var ApplicationInsights;
|
|
3783
|
-
(function (ApplicationInsights) {
|
|
3784
|
-
"use strict";
|
|
3785
|
-
var Initialization = (function () {
|
|
3786
|
-
function Initialization(snippet) {
|
|
3787
|
-
snippet.queue = snippet.queue || [];
|
|
3788
|
-
var config = snippet.config || {};
|
|
3789
|
-
if (config && !config.instrumentationKey) {
|
|
3790
|
-
config = snippet;
|
|
3791
|
-
if (config["iKey"]) {
|
|
3792
|
-
Microsoft.ApplicationInsights.Version = "0.10.0.0";
|
|
3793
|
-
config.instrumentationKey = config["iKey"];
|
|
3794
|
-
}
|
|
3795
|
-
else if (config["applicationInsightsId"]) {
|
|
3796
|
-
Microsoft.ApplicationInsights.Version = "0.7.2.0";
|
|
3797
|
-
config.instrumentationKey = config["applicationInsightsId"];
|
|
3798
|
-
}
|
|
3799
|
-
else {
|
|
3800
|
-
throw new Error("Cannot load Application Insights SDK, no instrumentationKey was provided.");
|
|
3801
|
-
}
|
|
3802
|
-
}
|
|
3803
|
-
config = Initialization.getDefaultConfig(config);
|
|
3804
|
-
this.snippet = snippet;
|
|
3805
|
-
this.config = config;
|
|
3806
|
-
}
|
|
3807
|
-
Initialization.prototype.loadAppInsights = function () {
|
|
3808
|
-
var appInsights = new Microsoft.ApplicationInsights.AppInsights(this.config);
|
|
3809
|
-
if (this.config["iKey"]) {
|
|
3810
|
-
var originalTrackPageView = appInsights.trackPageView;
|
|
3811
|
-
appInsights.trackPageView = function (pagePath, properties, measurements) {
|
|
3812
|
-
originalTrackPageView.apply(appInsights, [null, pagePath, properties, measurements]);
|
|
3813
|
-
};
|
|
3814
|
-
}
|
|
3815
|
-
var legacyPageView = "logPageView";
|
|
3816
|
-
if (typeof this.snippet[legacyPageView] === "function") {
|
|
3817
|
-
appInsights[legacyPageView] = function (pagePath, properties, measurements) {
|
|
3818
|
-
appInsights.trackPageView(null, pagePath, properties, measurements);
|
|
3819
|
-
};
|
|
3820
|
-
}
|
|
3821
|
-
var legacyEvent = "logEvent";
|
|
3822
|
-
if (typeof this.snippet[legacyEvent] === "function") {
|
|
3823
|
-
appInsights[legacyEvent] = function (name, properties, measurements) {
|
|
3824
|
-
appInsights.trackEvent(name, properties, measurements);
|
|
3825
|
-
};
|
|
3826
|
-
}
|
|
3827
|
-
return appInsights;
|
|
3828
|
-
};
|
|
3829
|
-
Initialization.prototype.emptyQueue = function () {
|
|
3830
|
-
try {
|
|
3831
|
-
if (Microsoft.ApplicationInsights.Util.isArray(this.snippet.queue)) {
|
|
3832
|
-
var length = this.snippet.queue.length;
|
|
3833
|
-
for (var i = 0; i < length; i++) {
|
|
3834
|
-
var call = this.snippet.queue[i];
|
|
3835
|
-
call();
|
|
3836
|
-
}
|
|
3837
|
-
this.snippet.queue = undefined;
|
|
3838
|
-
delete this.snippet.queue;
|
|
3839
|
-
}
|
|
3840
|
-
}
|
|
3841
|
-
catch (exception) {
|
|
3842
|
-
var properties = {};
|
|
3843
|
-
if (exception && typeof exception.toString === "function") {
|
|
3844
|
-
properties.exception = exception.toString();
|
|
3845
|
-
}
|
|
3846
|
-
Microsoft.ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.WARNING, ApplicationInsights._InternalMessageId.FailedToSendQueuedTelemetry, "Failed to send queued telemetry", properties);
|
|
3847
|
-
}
|
|
3848
|
-
};
|
|
3849
|
-
Initialization.prototype.pollInteralLogs = function (appInsightsInstance) {
|
|
3850
|
-
return setInterval(function () {
|
|
3851
|
-
var queue = Microsoft.ApplicationInsights._InternalLogging.queue;
|
|
3852
|
-
var length = queue.length;
|
|
3853
|
-
for (var i = 0; i < length; i++) {
|
|
3854
|
-
appInsightsInstance.trackTrace(queue[i].message);
|
|
3855
|
-
}
|
|
3856
|
-
queue.length = 0;
|
|
3857
|
-
}, this.config.diagnosticLogInterval);
|
|
3858
|
-
};
|
|
3859
|
-
Initialization.prototype.addHousekeepingBeforeUnload = function (appInsightsInstance) {
|
|
3860
|
-
if (!appInsightsInstance.config.disableFlushOnBeforeUnload && ('onbeforeunload' in window)) {
|
|
3861
|
-
var performHousekeeping = function () {
|
|
3862
|
-
appInsightsInstance.context._sender.triggerSend();
|
|
3863
|
-
appInsightsInstance.context._sessionManager.backup();
|
|
3864
|
-
};
|
|
3865
|
-
if (!Microsoft.ApplicationInsights.Util.addEventHandler('beforeunload', performHousekeeping)) {
|
|
3866
|
-
Microsoft.ApplicationInsights._InternalLogging.throwInternal(Microsoft.ApplicationInsights.LoggingSeverity.CRITICAL, Microsoft.ApplicationInsights._InternalMessageId.FailedToAddHandlerForOnBeforeUnload, 'Could not add handler for beforeunload');
|
|
3867
|
-
}
|
|
3868
|
-
}
|
|
3869
|
-
};
|
|
3870
|
-
Initialization.getDefaultConfig = function (config) {
|
|
3871
|
-
if (!config) {
|
|
3872
|
-
config = {};
|
|
3873
|
-
}
|
|
3874
|
-
config.endpointUrl = config.endpointUrl || "https://dc.services.visualstudio.com/v2/track";
|
|
3875
|
-
config.sessionRenewalMs = 30 * 60 * 1000;
|
|
3876
|
-
config.sessionExpirationMs = 24 * 60 * 60 * 1000;
|
|
3877
|
-
config.maxBatchSizeInBytes = config.maxBatchSizeInBytes > 0 ? config.maxBatchSizeInBytes : 102400;
|
|
3878
|
-
config.maxBatchInterval = !isNaN(config.maxBatchInterval) ? config.maxBatchInterval : 15000;
|
|
3879
|
-
config.enableDebug = ApplicationInsights.Util.stringToBoolOrDefault(config.enableDebug);
|
|
3880
|
-
config.disableExceptionTracking = ApplicationInsights.Util.stringToBoolOrDefault(config.disableExceptionTracking);
|
|
3881
|
-
config.disableTelemetry = ApplicationInsights.Util.stringToBoolOrDefault(config.disableTelemetry);
|
|
3882
|
-
config.verboseLogging = ApplicationInsights.Util.stringToBoolOrDefault(config.verboseLogging);
|
|
3883
|
-
config.emitLineDelimitedJson = ApplicationInsights.Util.stringToBoolOrDefault(config.emitLineDelimitedJson);
|
|
3884
|
-
config.diagnosticLogInterval = config.diagnosticLogInterval || 10000;
|
|
3885
|
-
config.autoTrackPageVisitTime = ApplicationInsights.Util.stringToBoolOrDefault(config.autoTrackPageVisitTime);
|
|
3886
|
-
if (isNaN(config.samplingPercentage) || config.samplingPercentage <= 0 || config.samplingPercentage >= 100) {
|
|
3887
|
-
config.samplingPercentage = 100;
|
|
3888
|
-
}
|
|
3889
|
-
config.disableAjaxTracking = ApplicationInsights.Util.stringToBoolOrDefault(config.disableAjaxTracking);
|
|
3890
|
-
config.maxAjaxCallsPerView = !isNaN(config.maxAjaxCallsPerView) ? config.maxAjaxCallsPerView : 500;
|
|
3891
|
-
config.isBeaconApiDisabled = ApplicationInsights.Util.stringToBoolOrDefault(config.isBeaconApiDisabled, true);
|
|
3892
|
-
config.disableCorrelationHeaders = ApplicationInsights.Util.stringToBoolOrDefault(config.disableCorrelationHeaders);
|
|
3893
|
-
config.disableFlushOnBeforeUnload = ApplicationInsights.Util.stringToBoolOrDefault(config.disableFlushOnBeforeUnload);
|
|
3894
|
-
config.enableSessionStorageBuffer = ApplicationInsights.Util.stringToBoolOrDefault(config.enableSessionStorageBuffer, true);
|
|
3895
|
-
config.isRetryDisabled = ApplicationInsights.Util.stringToBoolOrDefault(config.isRetryDisabled);
|
|
3896
|
-
config.isCookieUseDisabled = ApplicationInsights.Util.stringToBoolOrDefault(config.isCookieUseDisabled);
|
|
3897
|
-
config.isStorageUseDisabled = ApplicationInsights.Util.stringToBoolOrDefault(config.isStorageUseDisabled);
|
|
3898
|
-
config.isBrowserLinkTrackingEnabled = ApplicationInsights.Util.stringToBoolOrDefault(config.isBrowserLinkTrackingEnabled);
|
|
3899
|
-
return config;
|
|
3900
|
-
};
|
|
3901
|
-
return Initialization;
|
|
3902
|
-
}());
|
|
3903
|
-
ApplicationInsights.Initialization = Initialization;
|
|
3904
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
3905
|
-
})(Microsoft || (Microsoft = {}));
|
|
3906
|
-
var Microsoft;
|
|
3907
|
-
(function (Microsoft) {
|
|
3908
|
-
var ApplicationInsights;
|
|
3909
|
-
(function (ApplicationInsights) {
|
|
3910
|
-
"use strict";
|
|
3911
|
-
//textback start
|
|
3912
|
-
try {
|
|
3913
|
-
if (typeof context !== "undefined" && typeof JSON !== "undefined") {
|
|
3914
|
-
var aiName = "appInsights";
|
|
3915
|
-
if (context[aiName] === undefined) {
|
|
3916
|
-
Microsoft.ApplicationInsights.AppInsights.defaultConfig = Microsoft.ApplicationInsights.Initialization.getDefaultConfig();
|
|
3917
|
-
}
|
|
3918
|
-
else {
|
|
3919
|
-
var snippet = context[aiName] || {};
|
|
3920
|
-
var init = new Microsoft.ApplicationInsights.Initialization(snippet);
|
|
3921
|
-
var appInsightsLocal = init.loadAppInsights();
|
|
3922
|
-
for (var field in appInsightsLocal) {
|
|
3923
|
-
snippet[field] = appInsightsLocal[field];
|
|
3924
|
-
}
|
|
3925
|
-
init.emptyQueue();
|
|
3926
|
-
init.pollInteralLogs(appInsightsLocal);
|
|
3927
|
-
init.addHousekeepingBeforeUnload(appInsightsLocal);
|
|
3928
|
-
}
|
|
3929
|
-
}
|
|
3930
|
-
}
|
|
3931
|
-
//textback end
|
|
3932
|
-
catch (e) {
|
|
3933
|
-
Microsoft.ApplicationInsights._InternalLogging.warnToConsole('Failed to initialize AppInsights JS SDK: ' + e.message);
|
|
3934
|
-
}
|
|
3935
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
3936
|
-
})(Microsoft || (Microsoft = {}));
|
|
3937
|
-
var Microsoft;
|
|
3938
|
-
(function (Microsoft) {
|
|
3939
|
-
var ApplicationInsights;
|
|
3940
|
-
(function (ApplicationInsights) {
|
|
3941
|
-
"use strict";
|
|
3942
|
-
var DataLossAnalyzer = (function () {
|
|
3943
|
-
function DataLossAnalyzer() {
|
|
3944
|
-
}
|
|
3945
|
-
DataLossAnalyzer.reset = function () {
|
|
3946
|
-
if (DataLossAnalyzer.isEnabled()) {
|
|
3947
|
-
ApplicationInsights.Util.setSessionStorage(DataLossAnalyzer.ITEMS_QUEUED_KEY, "0");
|
|
3948
|
-
ApplicationInsights.Util.setSessionStorage(DataLossAnalyzer.ISSUES_REPORTED_KEY, "0");
|
|
3949
|
-
DataLossAnalyzer.itemsRestoredFromSessionBuffer = 0;
|
|
3950
|
-
}
|
|
3951
|
-
};
|
|
3952
|
-
DataLossAnalyzer.isEnabled = function () {
|
|
3953
|
-
return DataLossAnalyzer.enabled &&
|
|
3954
|
-
DataLossAnalyzer.appInsights != null &&
|
|
3955
|
-
DataLossAnalyzer.appInsights.context._sender._XMLHttpRequestSupported &&
|
|
3956
|
-
ApplicationInsights.Util.canUseSessionStorage();
|
|
3957
|
-
};
|
|
3958
|
-
DataLossAnalyzer.getIssuesReported = function () {
|
|
3959
|
-
var result = (!DataLossAnalyzer.isEnabled() || isNaN(+ApplicationInsights.Util.getSessionStorage(DataLossAnalyzer.ISSUES_REPORTED_KEY))) ?
|
|
3960
|
-
0 :
|
|
3961
|
-
+ApplicationInsights.Util.getSessionStorage(DataLossAnalyzer.ISSUES_REPORTED_KEY);
|
|
3962
|
-
return result;
|
|
3963
|
-
};
|
|
3964
|
-
DataLossAnalyzer.incrementItemsQueued = function () {
|
|
3965
|
-
try {
|
|
3966
|
-
if (DataLossAnalyzer.isEnabled()) {
|
|
3967
|
-
var itemsQueued = DataLossAnalyzer.getNumberOfLostItems();
|
|
3968
|
-
++itemsQueued;
|
|
3969
|
-
ApplicationInsights.Util.setSessionStorage(DataLossAnalyzer.ITEMS_QUEUED_KEY, itemsQueued.toString());
|
|
3970
|
-
}
|
|
3971
|
-
}
|
|
3972
|
-
catch (e) { }
|
|
3973
|
-
};
|
|
3974
|
-
DataLossAnalyzer.decrementItemsQueued = function (countOfItemsSentSuccessfully) {
|
|
3975
|
-
try {
|
|
3976
|
-
if (DataLossAnalyzer.isEnabled()) {
|
|
3977
|
-
var itemsQueued = DataLossAnalyzer.getNumberOfLostItems();
|
|
3978
|
-
itemsQueued -= countOfItemsSentSuccessfully;
|
|
3979
|
-
if (itemsQueued < 0)
|
|
3980
|
-
itemsQueued = 0;
|
|
3981
|
-
ApplicationInsights.Util.setSessionStorage(DataLossAnalyzer.ITEMS_QUEUED_KEY, itemsQueued.toString());
|
|
3982
|
-
}
|
|
3983
|
-
}
|
|
3984
|
-
catch (e) { }
|
|
3985
|
-
};
|
|
3986
|
-
DataLossAnalyzer.getNumberOfLostItems = function () {
|
|
3987
|
-
var result = 0;
|
|
3988
|
-
try {
|
|
3989
|
-
if (DataLossAnalyzer.isEnabled()) {
|
|
3990
|
-
result = isNaN(+ApplicationInsights.Util.getSessionStorage(DataLossAnalyzer.ITEMS_QUEUED_KEY)) ?
|
|
3991
|
-
0 :
|
|
3992
|
-
+ApplicationInsights.Util.getSessionStorage(DataLossAnalyzer.ITEMS_QUEUED_KEY);
|
|
3993
|
-
}
|
|
3994
|
-
}
|
|
3995
|
-
catch (e) {
|
|
3996
|
-
result = 0;
|
|
3997
|
-
}
|
|
3998
|
-
return result;
|
|
3999
|
-
};
|
|
4000
|
-
DataLossAnalyzer.reportLostItems = function () {
|
|
4001
|
-
try {
|
|
4002
|
-
if (DataLossAnalyzer.isEnabled() &&
|
|
4003
|
-
DataLossAnalyzer.getIssuesReported() < DataLossAnalyzer.LIMIT_PER_SESSION &&
|
|
4004
|
-
DataLossAnalyzer.getNumberOfLostItems() > 0) {
|
|
4005
|
-
var lostItems = DataLossAnalyzer.getNumberOfLostItems() - DataLossAnalyzer.itemsRestoredFromSessionBuffer;
|
|
4006
|
-
DataLossAnalyzer.appInsights.trackTrace("AI (Internal): Internal report DATALOSS:\"" + lostItems + "\"", null);
|
|
4007
|
-
DataLossAnalyzer.appInsights.flush();
|
|
4008
|
-
var issuesReported = DataLossAnalyzer.getIssuesReported();
|
|
4009
|
-
++issuesReported;
|
|
4010
|
-
ApplicationInsights.Util.setSessionStorage(DataLossAnalyzer.ISSUES_REPORTED_KEY, issuesReported.toString());
|
|
4011
|
-
}
|
|
4012
|
-
}
|
|
4013
|
-
catch (e) {
|
|
4014
|
-
ApplicationInsights._InternalLogging.throwInternal(ApplicationInsights.LoggingSeverity.CRITICAL, ApplicationInsights._InternalMessageId.FailedToReportDataLoss, "Failed to report data loss: " + ApplicationInsights.Util.getExceptionName(e), { exception: ApplicationInsights.Util.dump(e) });
|
|
4015
|
-
}
|
|
4016
|
-
finally {
|
|
4017
|
-
try {
|
|
4018
|
-
DataLossAnalyzer.reset();
|
|
4019
|
-
}
|
|
4020
|
-
catch (e) { }
|
|
4021
|
-
}
|
|
4022
|
-
};
|
|
4023
|
-
DataLossAnalyzer.enabled = false;
|
|
4024
|
-
DataLossAnalyzer.itemsRestoredFromSessionBuffer = 0;
|
|
4025
|
-
DataLossAnalyzer.LIMIT_PER_SESSION = 10;
|
|
4026
|
-
DataLossAnalyzer.ITEMS_QUEUED_KEY = "AI_itemsQueued";
|
|
4027
|
-
DataLossAnalyzer.ISSUES_REPORTED_KEY = "AI_lossIssuesReported";
|
|
4028
|
-
return DataLossAnalyzer;
|
|
4029
|
-
}());
|
|
4030
|
-
ApplicationInsights.DataLossAnalyzer = DataLossAnalyzer;
|
|
4031
|
-
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
4032
|
-
})(Microsoft || (Microsoft = {}));
|
|
4033
|
-
var AI;
|
|
4034
|
-
(function (AI) {
|
|
4035
|
-
"use strict";
|
|
4036
|
-
var AjaxCallData = (function (_super) {
|
|
4037
|
-
__extends(AjaxCallData, _super);
|
|
4038
|
-
function AjaxCallData() {
|
|
4039
|
-
_super.call(this);
|
|
4040
|
-
this.ver = 2;
|
|
4041
|
-
this.properties = {};
|
|
4042
|
-
this.measurements = {};
|
|
4043
|
-
_super.call(this);
|
|
4044
|
-
}
|
|
4045
|
-
return AjaxCallData;
|
|
4046
|
-
}(AI.PageViewData));
|
|
4047
|
-
AI.AjaxCallData = AjaxCallData;
|
|
4048
|
-
})(AI || (AI = {}));
|
|
4049
|
-
var AI;
|
|
4050
|
-
(function (AI) {
|
|
4051
|
-
"use strict";
|
|
4052
|
-
var RequestData = (function (_super) {
|
|
4053
|
-
__extends(RequestData, _super);
|
|
4054
|
-
function RequestData() {
|
|
4055
|
-
_super.call(this);
|
|
4056
|
-
this.ver = 2;
|
|
4057
|
-
this.properties = {};
|
|
4058
|
-
this.measurements = {};
|
|
4059
|
-
_super.call(this);
|
|
4060
|
-
}
|
|
4061
|
-
return RequestData;
|
|
4062
|
-
}(Microsoft.Telemetry.Domain));
|
|
4063
|
-
AI.RequestData = RequestData;
|
|
4064
|
-
})(AI || (AI = {}));
|
|
4065
|
-
var AI;
|
|
4066
|
-
(function (AI) {
|
|
4067
|
-
"use strict";
|
|
4068
|
-
var SessionStateData = (function (_super) {
|
|
4069
|
-
__extends(SessionStateData, _super);
|
|
4070
|
-
function SessionStateData() {
|
|
4071
|
-
_super.call(this);
|
|
4072
|
-
this.ver = 2;
|
|
4073
|
-
this.state = AI.SessionState.Start;
|
|
4074
|
-
_super.call(this);
|
|
4075
|
-
}
|
|
4076
|
-
return SessionStateData;
|
|
4077
|
-
}(Microsoft.Telemetry.Domain));
|
|
4078
|
-
AI.SessionStateData = SessionStateData;
|
|
4079
|
-
})(AI || (AI = {}));
|
|
4080
|
-
var AI;
|
|
4081
|
-
(function (AI) {
|
|
4082
|
-
"use strict";
|
|
4083
|
-
(function (TestResult) {
|
|
4084
|
-
TestResult[TestResult["Pass"] = 0] = "Pass";
|
|
4085
|
-
TestResult[TestResult["Fail"] = 1] = "Fail";
|
|
4086
|
-
})(AI.TestResult || (AI.TestResult = {}));
|
|
4087
|
-
var TestResult = AI.TestResult;
|
|
4088
|
-
})(AI || (AI = {}));
|
|
4089
|
-
//# sourceMappingURL=ai.js.map
|