@microsoft/applicationinsights-dependencies-js 3.0.0-beta.2208-03 → 3.0.0-beta.2208-16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/applicationinsights-dependencies-js.integrity.json +9 -9
- package/browser/applicationinsights-dependencies-js.js +826 -681
- package/browser/applicationinsights-dependencies-js.js.map +1 -1
- package/browser/applicationinsights-dependencies-js.min.js +2 -2
- package/browser/applicationinsights-dependencies-js.min.js.map +1 -1
- package/dist/applicationinsights-dependencies-js.api.json +92 -19
- package/dist/applicationinsights-dependencies-js.api.md +10 -6
- package/dist/applicationinsights-dependencies-js.d.ts +27 -4
- package/dist/applicationinsights-dependencies-js.js +826 -681
- package/dist/applicationinsights-dependencies-js.js.map +1 -1
- package/dist/applicationinsights-dependencies-js.min.js +2 -2
- package/dist/applicationinsights-dependencies-js.min.js.map +1 -1
- package/dist/applicationinsights-dependencies-js.rollup.d.ts +27 -4
- package/dist-esm/DependencyListener.js +1 -1
- package/dist-esm/InternalConstants.js +4 -4
- package/dist-esm/InternalConstants.js.map +1 -1
- package/dist-esm/__DynamicConstants.js +28 -23
- package/dist-esm/__DynamicConstants.js.map +1 -1
- package/dist-esm/ajax.js +56 -54
- package/dist-esm/ajax.js.map +1 -1
- package/dist-esm/ajaxRecord.js +38 -9
- package/dist-esm/ajaxRecord.js.map +1 -1
- package/dist-esm/ajaxUtils.js +1 -1
- package/dist-esm/applicationinsights-dependencies-js.js +1 -1
- package/package.json +5 -4
- package/src/InternalConstants.ts +3 -3
- package/src/__DynamicConstants.ts +27 -22
- package/src/ajax.ts +14 -14
- package/src/ajaxRecord.ts +62 -5
- package/tsconfig.json +1 -1
- package/types/__DynamicConstants.d.ts +22 -17
- package/types/ajax.d.ts +2 -2
- package/types/ajaxRecord.d.ts +24 -2
- package/types/tsdoc-metadata.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Microsoft Application Insights XHR dependencies plugin, 3.0.0-beta.2208-
|
|
2
|
+
* Microsoft Application Insights XHR dependencies plugin, 3.0.0-beta.2208-16
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* Microsoft Application Insights Team
|
|
@@ -20,6 +20,7 @@ import { IConfiguration } from '@microsoft/applicationinsights-core-js';
|
|
|
20
20
|
import { ICorrelationConfig } from '@microsoft/applicationinsights-common';
|
|
21
21
|
import { IDependencyTelemetry } from '@microsoft/applicationinsights-common';
|
|
22
22
|
import { IDiagnosticLogger } from '@microsoft/applicationinsights-core-js';
|
|
23
|
+
import { IDistributedTraceContext } from '@microsoft/applicationinsights-core-js';
|
|
23
24
|
import { IPlugin } from '@microsoft/applicationinsights-core-js';
|
|
24
25
|
import { IProcessTelemetryContext } from '@microsoft/applicationinsights-core-js';
|
|
25
26
|
import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
|
|
@@ -87,13 +88,29 @@ export declare class ajaxRecord {
|
|
|
87
88
|
endTime: number;
|
|
88
89
|
xhrMonitoringState: XHRMonitoringState;
|
|
89
90
|
clientFailure: number;
|
|
91
|
+
/**
|
|
92
|
+
* The traceId to use for the dependency call
|
|
93
|
+
*/
|
|
90
94
|
traceID: string;
|
|
95
|
+
/**
|
|
96
|
+
* The spanId to use for the dependency call
|
|
97
|
+
*/
|
|
91
98
|
spanID: string;
|
|
99
|
+
/**
|
|
100
|
+
* The traceFlags to use for the dependency call
|
|
101
|
+
*/
|
|
92
102
|
traceFlags?: number;
|
|
93
|
-
|
|
103
|
+
/**
|
|
104
|
+
* The trace context to use for reporting the remote dependency call
|
|
105
|
+
*/
|
|
106
|
+
eventTraceCtx: ITraceCtx;
|
|
107
|
+
constructor(traceId: string, spanId: string, logger: IDiagnosticLogger, traceCtx?: IDistributedTraceContext);
|
|
94
108
|
getAbsoluteUrl(): string;
|
|
95
109
|
getPathName(): string;
|
|
96
110
|
CreateTrackItem(ajaxType: string, enableRequestHeaderTracking: boolean, getResponse: () => IAjaxRecordResponse): IDependencyTelemetry;
|
|
111
|
+
getPartAProps(): {
|
|
112
|
+
[key: string]: any;
|
|
113
|
+
};
|
|
97
114
|
}
|
|
98
115
|
|
|
99
116
|
declare type DependencyListenerFunction = (dependencyDetails: IDependencyListenerDetails) => void;
|
|
@@ -102,7 +119,7 @@ export declare const DfltAjaxCorrelationHeaderExDomains: string[];
|
|
|
102
119
|
|
|
103
120
|
declare const _DYN_HEADER_MAP = "headerMap";
|
|
104
121
|
|
|
105
|
-
declare const
|
|
122
|
+
declare const _DYN_INCLUDE_CORRELATION_3 = "includeCorrelationHeaders";
|
|
106
123
|
|
|
107
124
|
declare interface IAjaxRecordResponse {
|
|
108
125
|
statusText: string;
|
|
@@ -175,7 +192,13 @@ declare interface IDependencyListenerHandler {
|
|
|
175
192
|
}
|
|
176
193
|
|
|
177
194
|
export declare interface IInstrumentationRequirements extends IDependenciesPlugin {
|
|
178
|
-
[
|
|
195
|
+
[_DYN_INCLUDE_CORRELATION_3]: (ajaxData: ajaxRecord, input?: Request | string, init?: RequestInit, xhr?: XMLHttpRequestInstrumented) => any;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
declare interface ITraceCtx {
|
|
199
|
+
traceId: string;
|
|
200
|
+
spanId: string;
|
|
201
|
+
traceFlags: number;
|
|
179
202
|
}
|
|
180
203
|
|
|
181
204
|
declare class XHRMonitoringState {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Dependencies Plugin, 3.0.0-beta.2208-
|
|
2
|
+
* Application Insights JavaScript SDK - Dependencies Plugin, 3.0.0-beta.2208-16
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
//
|
|
8
|
-
// Note: DON'T Export these const from the package as we are still targeting
|
|
9
|
-
//
|
|
7
|
+
// ###################################################################################################################################################
|
|
8
|
+
// Note: DON'T Export these const from the package as we are still targeting IE/ES5 this will export a mutable variables that someone could change ###
|
|
9
|
+
// ###################################################################################################################################################
|
|
10
10
|
// Generally you should only put values that are used more than 2 times and then only if not already exposed as a constant (such as SdkCoreNames)
|
|
11
11
|
// as when using "short" named values from here they will be will be minified smaller than the SdkCoreNames[eSdkCoreNames.xxxx] value.
|
|
12
12
|
export var STR_DURATION = "duration";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalConstants.js.map","sources":["InternalConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n//
|
|
1
|
+
{"version":3,"file":"InternalConstants.js.map","sources":["InternalConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// ###################################################################################################################################################\r\n// Note: DON'T Export these const from the package as we are still targeting IE/ES5 this will export a mutable variables that someone could change ###\r\n// ###################################################################################################################################################\r\n// Generally you should only put values that are used more than 2 times and then only if not already exposed as a constant (such as SdkCoreNames)\r\n// as when using \"short\" named values from here they will be will be minified smaller than the SdkCoreNames[eSdkCoreNames.xxxx] value.\r\nexport var STR_DURATION = \"duration\";\r\nexport var STR_PROPERTIES = \"properties\";\r\n//# sourceMappingURL=InternalConstants.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Dependencies Plugin, 3.0.0-beta.2208-
|
|
2
|
+
* Application Insights JavaScript SDK - Dependencies Plugin, 3.0.0-beta.2208-16
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -8,36 +8,38 @@
|
|
|
8
8
|
// ##############################################################
|
|
9
9
|
// AUTO GENERATED FILE: This file is Auto Generated during build.
|
|
10
10
|
// ##############################################################
|
|
11
|
-
//
|
|
12
|
-
// Note: DON'T Export these const from the package as we are still targeting
|
|
13
|
-
//
|
|
11
|
+
// ###########################################################################################################################################
|
|
12
|
+
// Note: DON'T Export these const from the package as we are still targeting IE this will export a mutable variables that someone could change
|
|
13
|
+
// ###########################################################################################################################################
|
|
14
14
|
export var _DYN_REQUEST_URL = "requestUrl"; // Count: 12
|
|
15
15
|
export var _DYN_INST = "inst"; // Count: 5
|
|
16
16
|
export var _DYN_LENGTH = "length"; // Count: 9
|
|
17
|
-
export var _DYN_TRACE_ID = "traceID"; // Count:
|
|
17
|
+
export var _DYN_TRACE_ID = "traceID"; // Count: 9
|
|
18
18
|
export var _DYN_SPAN_ID = "spanID"; // Count: 8
|
|
19
|
-
export var _DYN_TRACE_FLAGS = "traceFlags"; // Count:
|
|
19
|
+
export var _DYN_TRACE_FLAGS = "traceFlags"; // Count: 13
|
|
20
20
|
export var _DYN_CORE = "core"; // Count: 6
|
|
21
|
+
export var _DYN_TRACE_ID0 = "traceId"; // Count: 5
|
|
22
|
+
export var _DYN_SPAN_ID1 = "spanId"; // Count: 5
|
|
21
23
|
export var _DYN_GET_DEFAULT_CONFIG = "getDefaultConfig"; // Count: 2
|
|
22
|
-
export var
|
|
23
|
-
export var
|
|
24
|
+
export var _DYN_TRACK_DEPENDENCY_DAT2 = "trackDependencyDataInternal"; // Count: 4
|
|
25
|
+
export var _DYN_INCLUDE_CORRELATION_3 = "includeCorrelationHeaders"; // Count: 4
|
|
24
26
|
export var _DYN_GET_ABSOLUTE_URL = "getAbsoluteUrl"; // Count: 3
|
|
25
27
|
export var _DYN_HEADERS = "headers"; // Count: 6
|
|
26
28
|
export var _DYN_REQUEST_HEADERS = "requestHeaders"; // Count: 13
|
|
27
29
|
export var _DYN_APP_ID = "appId"; // Count: 5
|
|
28
30
|
export var _DYN_SET_REQUEST_HEADER = "setRequestHeader"; // Count: 3
|
|
29
|
-
export var
|
|
31
|
+
export var _DYN_DISTRIBUTED_TRACING_4 = "distributedTracingMode"; // Count: 3
|
|
30
32
|
export var _DYN_START_TIME = "startTime"; // Count: 6
|
|
31
33
|
export var _DYN_TO_LOWER_CASE = "toLowerCase"; // Count: 6
|
|
32
|
-
export var
|
|
33
|
-
export var
|
|
34
|
-
export var
|
|
35
|
-
export var
|
|
36
|
-
export var
|
|
37
|
-
export var
|
|
34
|
+
export var _DYN_ENABLE_REQUEST_HEADE5 = "enableRequestHeaderTracking"; // Count: 2
|
|
35
|
+
export var _DYN_ENABLE_AJAX_ERROR_ST6 = "enableAjaxErrorStatusText"; // Count: 2
|
|
36
|
+
export var _DYN_ENABLE_AJAX_PERF_TRA7 = "enableAjaxPerfTracking"; // Count: 2
|
|
37
|
+
export var _DYN_MAX_AJAX_CALLS_PER_V8 = "maxAjaxCallsPerView"; // Count: 2
|
|
38
|
+
export var _DYN_ENABLE_RESPONSE_HEAD9 = "enableResponseHeaderTracking"; // Count: 2
|
|
39
|
+
export var _DYN_EXCLUDE_REQUEST_FROM10 = "excludeRequestFromAutoTrackingPatterns"; // Count: 2
|
|
38
40
|
export var _DYN_ADD_REQUEST_CONTEXT = "addRequestContext"; // Count: 2
|
|
39
|
-
export var
|
|
40
|
-
export var
|
|
41
|
+
export var _DYN_DISABLE_AJAX_TRACKIN11 = "disableAjaxTracking"; // Count: 2
|
|
42
|
+
export var _DYN_DISABLE_FETCH_TRACKI12 = "disableFetchTracking"; // Count: 2
|
|
41
43
|
export var _DYN_STATUS = "status"; // Count: 10
|
|
42
44
|
export var _DYN_STATUS_TEXT = "statusText"; // Count: 8
|
|
43
45
|
export var _DYN_HEADER_MAP = "headerMap"; // Count: 8
|
|
@@ -45,20 +47,23 @@ export var _DYN_OPEN_DONE = "openDone"; // Count: 3
|
|
|
45
47
|
export var _DYN_SEND_DONE = "sendDone"; // Count: 3
|
|
46
48
|
export var _DYN_REQUEST_SENT_TIME = "requestSentTime"; // Count: 9
|
|
47
49
|
export var _DYN_ABORT_DONE = "abortDone"; // Count: 3
|
|
50
|
+
export var _DYN_GET_TRACE_ID = "getTraceId"; // Count: 3
|
|
51
|
+
export var _DYN_GET_TRACE_FLAGS = "getTraceFlags"; // Count: 3
|
|
48
52
|
export var _DYN_METHOD = "method"; // Count: 10
|
|
49
53
|
export var _DYN_ERROR_STATUS_TEXT = "errorStatusText"; // Count: 3
|
|
50
|
-
export var
|
|
54
|
+
export var _DYN_STATE_CHANGE_ATTACHE13 = "stateChangeAttached"; // Count: 2
|
|
51
55
|
export var _DYN_RESPONSE_TEXT = "responseText"; // Count: 5
|
|
52
|
-
export var
|
|
56
|
+
export var _DYN_RESPONSE_FINISHED_TI14 = "responseFinishedTime"; // Count: 7
|
|
53
57
|
export var _DYN__CREATE_TRACK_ITEM = "CreateTrackItem"; // Count: 3
|
|
54
58
|
export var _DYN_RESPONSE = "response"; // Count: 4
|
|
55
|
-
export var
|
|
56
|
-
export var
|
|
59
|
+
export var _DYN_GET_ALL_RESPONSE_HEA15 = "getAllResponseHeaders"; // Count: 2
|
|
60
|
+
export var _DYN_GET_PART_APROPS = "getPartAProps"; // Count: 3
|
|
57
61
|
export var _DYN_PERF_MARK = "perfMark"; // Count: 4
|
|
58
|
-
export var
|
|
62
|
+
export var _DYN_AJAX_PERF_LOOKUP_DEL16 = "ajaxPerfLookupDelay"; // Count: 2
|
|
59
63
|
export var _DYN_NAME = "name"; // Count: 6
|
|
60
64
|
export var _DYN_PERF_TIMING = "perfTiming"; // Count: 3
|
|
61
|
-
export var
|
|
65
|
+
export var _DYN_AJAX_DIAGNOSTICS_MES17 = "ajaxDiagnosticsMessage"; // Count: 3
|
|
62
66
|
export var _DYN_CORRELATION_CONTEXT = "correlationContext"; // Count: 3
|
|
63
67
|
export var _DYN_AJAX_TOTAL_DURATION = "ajaxTotalDuration"; // Count: 3
|
|
68
|
+
export var _DYN_EVENT_TRACE_CTX = "eventTraceCtx"; // Count: 3
|
|
64
69
|
//# sourceMappingURL=__DynamicConstants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"__DynamicConstants.js.map","sources":["__DynamicConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n//
|
|
1
|
+
{"version":3,"file":"__DynamicConstants.js.map","sources":["__DynamicConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n// ###########################################################################################################################################\r\n// Note: DON'T Export these const from the package as we are still targeting IE this will export a mutable variables that someone could change\r\n// ###########################################################################################################################################\r\nexport var _DYN_REQUEST_URL = \"requestUrl\"; // Count: 12\r\nexport var _DYN_INST = \"inst\"; // Count: 5\r\nexport var _DYN_LENGTH = \"length\"; // Count: 9\r\nexport var _DYN_TRACE_ID = \"traceID\"; // Count: 9\r\nexport var _DYN_SPAN_ID = \"spanID\"; // Count: 8\r\nexport var _DYN_TRACE_FLAGS = \"traceFlags\"; // Count: 13\r\nexport var _DYN_CORE = \"core\"; // Count: 6\r\nexport var _DYN_TRACE_ID0 = \"traceId\"; // Count: 5\r\nexport var _DYN_SPAN_ID1 = \"spanId\"; // Count: 5\r\nexport var _DYN_GET_DEFAULT_CONFIG = \"getDefaultConfig\"; // Count: 2\r\nexport var _DYN_TRACK_DEPENDENCY_DAT2 = \"trackDependencyDataInternal\"; // Count: 4\r\nexport var _DYN_INCLUDE_CORRELATION_3 = \"includeCorrelationHeaders\"; // Count: 4\r\nexport var _DYN_GET_ABSOLUTE_URL = \"getAbsoluteUrl\"; // Count: 3\r\nexport var _DYN_HEADERS = \"headers\"; // Count: 6\r\nexport var _DYN_REQUEST_HEADERS = \"requestHeaders\"; // Count: 13\r\nexport var _DYN_APP_ID = \"appId\"; // Count: 5\r\nexport var _DYN_SET_REQUEST_HEADER = \"setRequestHeader\"; // Count: 3\r\nexport var _DYN_DISTRIBUTED_TRACING_4 = \"distributedTracingMode\"; // Count: 3\r\nexport var _DYN_START_TIME = \"startTime\"; // Count: 6\r\nexport var _DYN_TO_LOWER_CASE = \"toLowerCase\"; // Count: 6\r\nexport var _DYN_ENABLE_REQUEST_HEADE5 = \"enableRequestHeaderTracking\"; // Count: 2\r\nexport var _DYN_ENABLE_AJAX_ERROR_ST6 = \"enableAjaxErrorStatusText\"; // Count: 2\r\nexport var _DYN_ENABLE_AJAX_PERF_TRA7 = \"enableAjaxPerfTracking\"; // Count: 2\r\nexport var _DYN_MAX_AJAX_CALLS_PER_V8 = \"maxAjaxCallsPerView\"; // Count: 2\r\nexport var _DYN_ENABLE_RESPONSE_HEAD9 = \"enableResponseHeaderTracking\"; // Count: 2\r\nexport var _DYN_EXCLUDE_REQUEST_FROM10 = \"excludeRequestFromAutoTrackingPatterns\"; // Count: 2\r\nexport var _DYN_ADD_REQUEST_CONTEXT = \"addRequestContext\"; // Count: 2\r\nexport var _DYN_DISABLE_AJAX_TRACKIN11 = \"disableAjaxTracking\"; // Count: 2\r\nexport var _DYN_DISABLE_FETCH_TRACKI12 = \"disableFetchTracking\"; // Count: 2\r\nexport var _DYN_STATUS = \"status\"; // Count: 10\r\nexport var _DYN_STATUS_TEXT = \"statusText\"; // Count: 8\r\nexport var _DYN_HEADER_MAP = \"headerMap\"; // Count: 8\r\nexport var _DYN_OPEN_DONE = \"openDone\"; // Count: 3\r\nexport var _DYN_SEND_DONE = \"sendDone\"; // Count: 3\r\nexport var _DYN_REQUEST_SENT_TIME = \"requestSentTime\"; // Count: 9\r\nexport var _DYN_ABORT_DONE = \"abortDone\"; // Count: 3\r\nexport var _DYN_GET_TRACE_ID = \"getTraceId\"; // Count: 3\r\nexport var _DYN_GET_TRACE_FLAGS = \"getTraceFlags\"; // Count: 3\r\nexport var _DYN_METHOD = \"method\"; // Count: 10\r\nexport var _DYN_ERROR_STATUS_TEXT = \"errorStatusText\"; // Count: 3\r\nexport var _DYN_STATE_CHANGE_ATTACHE13 = \"stateChangeAttached\"; // Count: 2\r\nexport var _DYN_RESPONSE_TEXT = \"responseText\"; // Count: 5\r\nexport var _DYN_RESPONSE_FINISHED_TI14 = \"responseFinishedTime\"; // Count: 7\r\nexport var _DYN__CREATE_TRACK_ITEM = \"CreateTrackItem\"; // Count: 3\r\nexport var _DYN_RESPONSE = \"response\"; // Count: 4\r\nexport var _DYN_GET_ALL_RESPONSE_HEA15 = \"getAllResponseHeaders\"; // Count: 2\r\nexport var _DYN_GET_PART_APROPS = \"getPartAProps\"; // Count: 3\r\nexport var _DYN_PERF_MARK = \"perfMark\"; // Count: 4\r\nexport var _DYN_AJAX_PERF_LOOKUP_DEL16 = \"ajaxPerfLookupDelay\"; // Count: 2\r\nexport var _DYN_NAME = \"name\"; // Count: 6\r\nexport var _DYN_PERF_TIMING = \"perfTiming\"; // Count: 3\r\nexport var _DYN_AJAX_DIAGNOSTICS_MES17 = \"ajaxDiagnosticsMessage\"; // Count: 3\r\nexport var _DYN_CORRELATION_CONTEXT = \"correlationContext\"; // Count: 3\r\nexport var _DYN_AJAX_TOTAL_DURATION = \"ajaxTotalDuration\"; // Count: 3\r\nexport var _DYN_EVENT_TRACE_CTX = \"eventTraceCtx\"; // Count: 3\r\n//# sourceMappingURL=__DynamicConstants.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
package/dist-esm/ajax.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Dependencies Plugin, 3.0.0-beta.2208-
|
|
2
|
+
* Application Insights JavaScript SDK - Dependencies Plugin, 3.0.0-beta.2208-16
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
import { __assignFn as __assign, __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
|
|
8
8
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
9
|
-
import {
|
|
9
|
+
import { DisabledPropertyName, PropertiesPluginIdentifier, RemoteDependencyData, RequestHeaders, correlationIdCanIncludeCorrelationHeader, correlationIdGetCorrelationContext, createDistributedTraceContextFromTrace, createTelemetryItem, createTraceParent, dateTimeUtilsNow, formatTraceParent, isInternalApplicationInsightsEndpoint } from "@microsoft/applicationinsights-common";
|
|
10
10
|
import { BaseTelemetryPlugin, InstrumentFunc, InstrumentProto, _throwInternal, arrForEach, createProcessTelemetryContext, createUniqueNamespace, deepFreeze, dumpObj, eventOn, generateW3CId, getExceptionName, getGlobal, getIEVersion, getLocation, getPerformance, isFunction, isNullOrUndefined, isString, isXhrSupported, mergeEvtNamespace, objForEachKey, strPrototype, strTrim } from "@microsoft/applicationinsights-core-js";
|
|
11
11
|
import { STR_PROPERTIES } from "./InternalConstants";
|
|
12
|
-
import { _DYN_ABORT_DONE, _DYN_ADD_REQUEST_CONTEXT,
|
|
12
|
+
import { _DYN_ABORT_DONE, _DYN_ADD_REQUEST_CONTEXT, _DYN_AJAX_DIAGNOSTICS_MES17, _DYN_AJAX_PERF_LOOKUP_DEL16, _DYN_APP_ID, _DYN_CORE, _DYN_CORRELATION_CONTEXT, _DYN_DISABLE_AJAX_TRACKIN11, _DYN_DISABLE_FETCH_TRACKI12, _DYN_DISTRIBUTED_TRACING_4, _DYN_ENABLE_AJAX_ERROR_ST6, _DYN_ENABLE_AJAX_PERF_TRA7, _DYN_ENABLE_REQUEST_HEADE5, _DYN_ENABLE_RESPONSE_HEAD9, _DYN_ERROR_STATUS_TEXT, _DYN_EXCLUDE_REQUEST_FROM10, _DYN_GET_ABSOLUTE_URL, _DYN_GET_ALL_RESPONSE_HEA15, _DYN_GET_DEFAULT_CONFIG, _DYN_GET_PART_APROPS, _DYN_GET_TRACE_FLAGS, _DYN_GET_TRACE_ID, _DYN_HEADERS, _DYN_HEADER_MAP, _DYN_INCLUDE_CORRELATION_3, _DYN_INST, _DYN_LENGTH, _DYN_MAX_AJAX_CALLS_PER_V8, _DYN_METHOD, _DYN_NAME, _DYN_OPEN_DONE, _DYN_PERF_MARK, _DYN_PERF_TIMING, _DYN_REQUEST_HEADERS, _DYN_REQUEST_SENT_TIME, _DYN_REQUEST_URL, _DYN_RESPONSE, _DYN_RESPONSE_FINISHED_TI14, _DYN_RESPONSE_TEXT, _DYN_SEND_DONE, _DYN_SET_REQUEST_HEADER, _DYN_SPAN_ID, _DYN_SPAN_ID1, _DYN_START_TIME, _DYN_STATE_CHANGE_ATTACHE13, _DYN_STATUS, _DYN_STATUS_TEXT, _DYN_TO_LOWER_CASE, _DYN_TRACE_FLAGS, _DYN_TRACE_ID, _DYN_TRACE_ID0, _DYN_TRACK_DEPENDENCY_DAT2, _DYN__CREATE_TRACK_ITEM } from "./__DynamicConstants";
|
|
13
13
|
import { ajaxRecord } from "./ajaxRecord";
|
|
14
14
|
var AJAX_MONITOR_PREFIX = "ai.ajxmn.";
|
|
15
15
|
var strDiagLog = "diagLog";
|
|
16
16
|
var strAjaxData = "ajaxData";
|
|
17
17
|
var strFetch = "fetch";
|
|
18
|
-
var strTrackDependencyDataInternal = "trackDependencyDataInternal"; // Using string to help with minification
|
|
19
18
|
// Using a global value so that to handle same iKey with multiple app insights instances (mostly for testing)
|
|
20
19
|
var _markCount = 0;
|
|
21
20
|
/** @Ignore */
|
|
@@ -130,8 +129,8 @@ function _processDependencyListeners(listeners, core, ajaxData, xhr, input, init
|
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
|
-
ajaxData[_DYN_TRACE_ID /* @min:%2etraceID */] = details
|
|
134
|
-
ajaxData[_DYN_SPAN_ID /* @min:%2espanID */] = details
|
|
132
|
+
ajaxData[_DYN_TRACE_ID /* @min:%2etraceID */] = details[_DYN_TRACE_ID0 /* @min:%2etraceId */];
|
|
133
|
+
ajaxData[_DYN_SPAN_ID /* @min:%2espanID */] = details[_DYN_SPAN_ID1 /* @min:%2espanId */];
|
|
135
134
|
ajaxData[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] = details[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */];
|
|
136
135
|
}
|
|
137
136
|
}
|
|
@@ -186,14 +185,14 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
186
185
|
_initDefaults();
|
|
187
186
|
};
|
|
188
187
|
_self.trackDependencyData = function (dependency, properties) {
|
|
189
|
-
_self[
|
|
188
|
+
_self[_DYN_TRACK_DEPENDENCY_DAT2 /* @min:%2etrackDependencyDataInternal */](dependency, properties);
|
|
190
189
|
};
|
|
191
|
-
_self[
|
|
190
|
+
_self[_DYN_INCLUDE_CORRELATION_3 /* @min:%2eincludeCorrelationHeaders */] = function (ajaxData, input, init, xhr) {
|
|
192
191
|
// Test Hook to allow the overriding of the location host
|
|
193
192
|
var currentWindowHost = _self["_currentWindowHost"] || _currentWindowHost;
|
|
194
193
|
_processDependencyListeners(_dependencyListeners, _self[_DYN_CORE /* @min:%2ecore */], ajaxData, xhr, input, init);
|
|
195
194
|
if (input) { // Fetch
|
|
196
|
-
if (
|
|
195
|
+
if (correlationIdCanIncludeCorrelationHeader(_config, ajaxData[_DYN_GET_ABSOLUTE_URL /* @min:%2egetAbsoluteUrl */](), currentWindowHost)) {
|
|
197
196
|
if (!init) {
|
|
198
197
|
init = {};
|
|
199
198
|
}
|
|
@@ -231,7 +230,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
231
230
|
return init;
|
|
232
231
|
}
|
|
233
232
|
else if (xhr) { // XHR
|
|
234
|
-
if (
|
|
233
|
+
if (correlationIdCanIncludeCorrelationHeader(_config, ajaxData[_DYN_GET_ABSOLUTE_URL /* @min:%2egetAbsoluteUrl */](), currentWindowHost)) {
|
|
235
234
|
if (_isUsingAIHeaders) {
|
|
236
235
|
var id = "|" + ajaxData[_DYN_TRACE_ID /* @min:%2etraceID */] + "." + ajaxData[_DYN_SPAN_ID /* @min:%2espanID */];
|
|
237
236
|
xhr[_DYN_SET_REQUEST_HEADER /* @min:%2esetRequestHeader */](RequestHeaders[3 /* eRequestHeaders.requestIdHeader */], id);
|
|
@@ -262,13 +261,13 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
262
261
|
}
|
|
263
262
|
return undefined;
|
|
264
263
|
};
|
|
265
|
-
_self[
|
|
264
|
+
_self[_DYN_TRACK_DEPENDENCY_DAT2 /* @min:%2etrackDependencyDataInternal */] = function (dependency, properties, systemProperties) {
|
|
266
265
|
if (_maxAjaxCallsPerView === -1 || _trackAjaxAttempts < _maxAjaxCallsPerView) {
|
|
267
266
|
// Hack since expected format in w3c mode is |abc.def.
|
|
268
267
|
// Non-w3c format is |abc.def
|
|
269
268
|
// @todo Remove if better solution is available, e.g. handle in portal
|
|
270
|
-
if ((_config[
|
|
271
|
-
|| _config[
|
|
269
|
+
if ((_config[_DYN_DISTRIBUTED_TRACING_4 /* @min:%2edistributedTracingMode */] === 2 /* eDistributedTracingModes.W3C */
|
|
270
|
+
|| _config[_DYN_DISTRIBUTED_TRACING_4 /* @min:%2edistributedTracingMode */] === 1 /* eDistributedTracingModes.AI_AND_W3C */)
|
|
272
271
|
&& typeof dependency.id === "string" && dependency.id[dependency.id[_DYN_LENGTH /* @min:%2elength */] - 1] !== ".") {
|
|
273
272
|
dependency.id += ".";
|
|
274
273
|
}
|
|
@@ -334,13 +333,13 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
334
333
|
objForEachKey(defaultConfig, function (field, value) {
|
|
335
334
|
_config[field] = ctx.getConfig(AjaxMonitor.identifier, field, value);
|
|
336
335
|
});
|
|
337
|
-
var distributedTracingMode = _config[
|
|
338
|
-
_enableRequestHeaderTracking = _config[
|
|
339
|
-
_enableAjaxErrorStatusText = _config[
|
|
340
|
-
_enableAjaxPerfTracking = _config[
|
|
341
|
-
_maxAjaxCallsPerView = _config[
|
|
342
|
-
_enableResponseHeaderTracking = _config[
|
|
343
|
-
_excludeRequestFromAutoTrackingPatterns = _config[
|
|
336
|
+
var distributedTracingMode = _config[_DYN_DISTRIBUTED_TRACING_4 /* @min:%2edistributedTracingMode */];
|
|
337
|
+
_enableRequestHeaderTracking = _config[_DYN_ENABLE_REQUEST_HEADE5 /* @min:%2eenableRequestHeaderTracking */];
|
|
338
|
+
_enableAjaxErrorStatusText = _config[_DYN_ENABLE_AJAX_ERROR_ST6 /* @min:%2eenableAjaxErrorStatusText */];
|
|
339
|
+
_enableAjaxPerfTracking = _config[_DYN_ENABLE_AJAX_PERF_TRA7 /* @min:%2eenableAjaxPerfTracking */];
|
|
340
|
+
_maxAjaxCallsPerView = _config[_DYN_MAX_AJAX_CALLS_PER_V8 /* @min:%2emaxAjaxCallsPerView */];
|
|
341
|
+
_enableResponseHeaderTracking = _config[_DYN_ENABLE_RESPONSE_HEAD9 /* @min:%2eenableResponseHeaderTracking */];
|
|
342
|
+
_excludeRequestFromAutoTrackingPatterns = _config[_DYN_EXCLUDE_REQUEST_FROM10 /* @min:%2eexcludeRequestFromAutoTrackingPatterns */];
|
|
344
343
|
_addRequestContext = _config[_DYN_ADD_REQUEST_CONTEXT /* @min:%2eaddRequestContext */];
|
|
345
344
|
_isUsingAIHeaders = distributedTracingMode === 0 /* eDistributedTracingModes.AI */ || distributedTracingMode === 1 /* eDistributedTracingModes.AI_AND_W3C */;
|
|
346
345
|
_isUsingW3CHeaders = distributedTracingMode === 1 /* eDistributedTracingModes.AI_AND_W3C */ || distributedTracingMode === 2 /* eDistributedTracingModes.W3C */;
|
|
@@ -353,8 +352,8 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
353
352
|
_markPrefix = AJAX_MONITOR_PREFIX + iKey + ".";
|
|
354
353
|
}
|
|
355
354
|
}
|
|
356
|
-
_disableAjaxTracking = !!_config[
|
|
357
|
-
_disableFetchTracking = !!_config[
|
|
355
|
+
_disableAjaxTracking = !!_config[_DYN_DISABLE_AJAX_TRACKIN11 /* @min:%2edisableAjaxTracking */];
|
|
356
|
+
_disableFetchTracking = !!_config[_DYN_DISABLE_FETCH_TRACKI12 /* @min:%2edisableFetchTracking */];
|
|
358
357
|
}
|
|
359
358
|
function _populateContext() {
|
|
360
359
|
var propExt = _self[_DYN_CORE /* @min:%2ecore */].getPlugin(PropertiesPluginIdentifier);
|
|
@@ -395,7 +394,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
395
394
|
!(isPolyfill && _xhrInitialized)) {
|
|
396
395
|
var ctx = callDetails.ctx();
|
|
397
396
|
fetchData = _createFetchRecord(input, init);
|
|
398
|
-
var newInit = _self[
|
|
397
|
+
var newInit = _self[_DYN_INCLUDE_CORRELATION_3 /* @min:%2eincludeCorrelationHeaders */](fetchData, input, init);
|
|
399
398
|
if (newInit !== init) {
|
|
400
399
|
callDetails.set(1, newInit);
|
|
401
400
|
}
|
|
@@ -428,7 +427,8 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
428
427
|
return ajaxResponse;
|
|
429
428
|
});
|
|
430
429
|
return response;
|
|
431
|
-
})
|
|
430
|
+
})
|
|
431
|
+
.catch(function (reason) {
|
|
432
432
|
_reportFetchMetrics(callDetails, 0, input, null, fetchData_1, null, { error: reason.message });
|
|
433
433
|
throw reason;
|
|
434
434
|
});
|
|
@@ -495,7 +495,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
495
495
|
if (_isMonitoredXhrInstance(xhr) && !ajaxData.xhrMonitoringState[_DYN_SEND_DONE /* @min:%2esendDone */]) {
|
|
496
496
|
_createMarkId("xhr", ajaxData);
|
|
497
497
|
ajaxData[_DYN_REQUEST_SENT_TIME /* @min:%2erequestSentTime */] = dateTimeUtilsNow();
|
|
498
|
-
_self[
|
|
498
|
+
_self[_DYN_INCLUDE_CORRELATION_3 /* @min:%2eincludeCorrelationHeaders */](ajaxData, undefined, undefined, xhr);
|
|
499
499
|
ajaxData.xhrMonitoringState[_DYN_SEND_DONE /* @min:%2esendDone */] = true;
|
|
500
500
|
}
|
|
501
501
|
}
|
|
@@ -613,11 +613,12 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
613
613
|
return distributedTraceCtx;
|
|
614
614
|
}
|
|
615
615
|
function _openHandler(xhr, method, url, async) {
|
|
616
|
+
var _a;
|
|
616
617
|
var distributedTraceCtx = _getDistributedTraceCtx();
|
|
617
|
-
var traceID = (distributedTraceCtx && distributedTraceCtx
|
|
618
|
+
var traceID = (distributedTraceCtx && distributedTraceCtx[_DYN_GET_TRACE_ID /* @min:%2egetTraceId */]()) || generateW3CId();
|
|
618
619
|
var spanID = generateW3CId().substr(0, 16);
|
|
619
|
-
var ajaxData = new ajaxRecord(traceID, spanID, _self[strDiagLog]());
|
|
620
|
-
ajaxData[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] = distributedTraceCtx && distributedTraceCtx
|
|
620
|
+
var ajaxData = new ajaxRecord(traceID, spanID, _self[strDiagLog](), (_a = _self.core) === null || _a === void 0 ? void 0 : _a.getTraceCtx());
|
|
621
|
+
ajaxData[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] = distributedTraceCtx && distributedTraceCtx[_DYN_GET_TRACE_FLAGS /* @min:%2egetTraceFlags */]();
|
|
621
622
|
ajaxData[_DYN_METHOD /* @min:%2emethod */] = method;
|
|
622
623
|
ajaxData[_DYN_REQUEST_URL /* @min:%2erequestUrl */] = url;
|
|
623
624
|
ajaxData.xhrMonitoringState[_DYN_OPEN_DONE /* @min:%2eopenDone */] = true;
|
|
@@ -627,7 +628,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
627
628
|
xhr[strAjaxData] = ajaxData;
|
|
628
629
|
}
|
|
629
630
|
function _attachToOnReadyStateChange(xhr) {
|
|
630
|
-
xhr[strAjaxData].xhrMonitoringState[
|
|
631
|
+
xhr[strAjaxData].xhrMonitoringState[_DYN_STATE_CHANGE_ATTACHE13 /* @min:%2estateChangeAttached */] = eventOn(xhr, "readystatechange", function () {
|
|
631
632
|
var _a;
|
|
632
633
|
try {
|
|
633
634
|
if (xhr && xhr.readyState === 4 && _isMonitoredXhrInstance(xhr)) {
|
|
@@ -639,7 +640,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
639
640
|
// ignore messages with c00c023f, as this a known IE9 XHR abort issue
|
|
640
641
|
if (!exceptionText || _indexOf(exceptionText[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */](), "c00c023f") === -1) {
|
|
641
642
|
_throwInternalCritical(_self, 16 /* _eInternalMessageId.FailedMonitorAjaxRSC */, "Failed to monitor XMLHttpRequest 'readystatechange' event handler, monitoring data for this ajax call may be incorrect.", (_a = {},
|
|
642
|
-
_a[
|
|
643
|
+
_a[_DYN_AJAX_DIAGNOSTICS_MES17 /* @min:ajaxDiagnosticsMessage */] = _getFailedAjaxDiagnosticsMessage(xhr),
|
|
643
644
|
_a.exception = exceptionText,
|
|
644
645
|
_a));
|
|
645
646
|
}
|
|
@@ -661,7 +662,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
661
662
|
}
|
|
662
663
|
function _onAjaxComplete(xhr) {
|
|
663
664
|
var ajaxData = xhr[strAjaxData];
|
|
664
|
-
ajaxData[
|
|
665
|
+
ajaxData[_DYN_RESPONSE_FINISHED_TI14 /* @min:%2eresponseFinishedTime */] = dateTimeUtilsNow();
|
|
665
666
|
ajaxData[_DYN_STATUS /* @min:%2estatus */] = xhr[_DYN_STATUS /* @min:%2estatus */];
|
|
666
667
|
function _reportXhrError(e, failedProps) {
|
|
667
668
|
var errorProps = failedProps || {};
|
|
@@ -685,7 +686,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
685
686
|
_a.response = xhr[_DYN_RESPONSE /* @min:%2eresponse */],
|
|
686
687
|
_a);
|
|
687
688
|
if (_enableResponseHeaderTracking) {
|
|
688
|
-
var headers = xhr[
|
|
689
|
+
var headers = xhr[_DYN_GET_ALL_RESPONSE_HEA15 /* @min:%2egetAllResponseHeaders */]();
|
|
689
690
|
if (headers) {
|
|
690
691
|
// xhr.getAllResponseHeaders() method returns all the response headers, separated by CRLF, as a string or null
|
|
691
692
|
// the regex converts the header string into an array of individual headers
|
|
@@ -717,12 +718,12 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
717
718
|
if (properties !== undefined) {
|
|
718
719
|
dependency[STR_PROPERTIES /* @min:%2eproperties */] = __assign(__assign({}, dependency.properties), properties);
|
|
719
720
|
}
|
|
720
|
-
_self[
|
|
721
|
+
_self[_DYN_TRACK_DEPENDENCY_DAT2 /* @min:%2etrackDependencyDataInternal */](dependency, null, ajaxData[_DYN_GET_PART_APROPS /* @min:%2egetPartAProps */]());
|
|
721
722
|
}
|
|
722
723
|
else {
|
|
723
724
|
_reportXhrError(null, {
|
|
724
725
|
requestSentTime: ajaxData[_DYN_REQUEST_SENT_TIME /* @min:%2erequestSentTime */],
|
|
725
|
-
responseFinishedTime: ajaxData[
|
|
726
|
+
responseFinishedTime: ajaxData[_DYN_RESPONSE_FINISHED_TI14 /* @min:%2eresponseFinishedTime */]
|
|
726
727
|
});
|
|
727
728
|
}
|
|
728
729
|
}
|
|
@@ -742,18 +743,18 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
742
743
|
function _getAjaxCorrelationContext(xhr) {
|
|
743
744
|
var _a;
|
|
744
745
|
try {
|
|
745
|
-
var responseHeadersString = xhr[
|
|
746
|
+
var responseHeadersString = xhr[_DYN_GET_ALL_RESPONSE_HEA15 /* @min:%2egetAllResponseHeaders */]();
|
|
746
747
|
if (responseHeadersString !== null) {
|
|
747
748
|
var index = _indexOf(responseHeadersString[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */](), RequestHeaders[8 /* eRequestHeaders.requestContextHeaderLowerCase */]);
|
|
748
749
|
if (index !== -1) {
|
|
749
750
|
var responseHeader = xhr.getResponseHeader(RequestHeaders[0 /* eRequestHeaders.requestContextHeader */]);
|
|
750
|
-
return
|
|
751
|
+
return correlationIdGetCorrelationContext(responseHeader);
|
|
751
752
|
}
|
|
752
753
|
}
|
|
753
754
|
}
|
|
754
755
|
catch (e) {
|
|
755
756
|
_throwInternalWarning(_self, 18 /* _eInternalMessageId.FailedMonitorAjaxGetCorrelationHeader */, "Failed to get Request-Context correlation header as it may be not included in the response or not accessible.", (_a = {},
|
|
756
|
-
_a[
|
|
757
|
+
_a[_DYN_AJAX_DIAGNOSTICS_MES17 /* @min:ajaxDiagnosticsMessage */] = _getFailedAjaxDiagnosticsMessage(xhr),
|
|
757
758
|
_a.exception = dumpObj(e),
|
|
758
759
|
_a));
|
|
759
760
|
}
|
|
@@ -776,7 +777,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
776
777
|
var perfMark = ajaxData[_DYN_PERF_MARK /* @min:%2eperfMark */];
|
|
777
778
|
var performance = getPerformance();
|
|
778
779
|
var maxAttempts = _config.maxAjaxPerfLookupAttempts;
|
|
779
|
-
var retryDelay = _config[
|
|
780
|
+
var retryDelay = _config[_DYN_AJAX_PERF_LOOKUP_DEL16 /* @min:%2eajaxPerfLookupDelay */];
|
|
780
781
|
var requestUrl = ajaxData[_DYN_REQUEST_URL /* @min:%2erequestUrl */];
|
|
781
782
|
var attempt = 0;
|
|
782
783
|
(function locateResourceTiming() {
|
|
@@ -831,11 +832,12 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
831
832
|
})();
|
|
832
833
|
}
|
|
833
834
|
function _createFetchRecord(input, init) {
|
|
835
|
+
var _a;
|
|
834
836
|
var distributedTraceCtx = _getDistributedTraceCtx();
|
|
835
|
-
var traceID = (distributedTraceCtx && distributedTraceCtx
|
|
837
|
+
var traceID = (distributedTraceCtx && distributedTraceCtx[_DYN_GET_TRACE_ID /* @min:%2egetTraceId */]()) || generateW3CId();
|
|
836
838
|
var spanID = generateW3CId().substr(0, 16);
|
|
837
|
-
var ajaxData = new ajaxRecord(traceID, spanID, _self[strDiagLog]());
|
|
838
|
-
ajaxData[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] = distributedTraceCtx && distributedTraceCtx
|
|
839
|
+
var ajaxData = new ajaxRecord(traceID, spanID, _self[strDiagLog](), (_a = _self.core) === null || _a === void 0 ? void 0 : _a.getTraceCtx());
|
|
840
|
+
ajaxData[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] = distributedTraceCtx && distributedTraceCtx[_DYN_GET_TRACE_FLAGS /* @min:%2egetTraceFlags */]();
|
|
839
841
|
ajaxData[_DYN_REQUEST_SENT_TIME /* @min:%2erequestSentTime */] = dateTimeUtilsNow();
|
|
840
842
|
ajaxData[_DYN_ERROR_STATUS_TEXT /* @min:%2eerrorStatusText */] = _enableAjaxErrorStatusText;
|
|
841
843
|
if (input instanceof Request) {
|
|
@@ -894,7 +896,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
894
896
|
}
|
|
895
897
|
_throwInternalWarning(_self, msgId, "Failed to calculate the duration of the fetch call, monitoring data for this fetch call won't be sent.", errorProps);
|
|
896
898
|
}
|
|
897
|
-
ajaxData[
|
|
899
|
+
ajaxData[_DYN_RESPONSE_FINISHED_TI14 /* @min:%2eresponseFinishedTime */] = dateTimeUtilsNow();
|
|
898
900
|
ajaxData[_DYN_STATUS /* @min:%2estatus */] = status;
|
|
899
901
|
_findPerfResourceEntry("fetch", ajaxData, function () {
|
|
900
902
|
var dependency = ajaxData[_DYN__CREATE_TRACK_ITEM /* @min:%2eCreateTrackItem */]("Fetch", _enableRequestHeaderTracking, getResponse);
|
|
@@ -911,12 +913,12 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
911
913
|
if (properties !== undefined) {
|
|
912
914
|
dependency[STR_PROPERTIES /* @min:%2eproperties */] = __assign(__assign({}, dependency.properties), properties);
|
|
913
915
|
}
|
|
914
|
-
_self[
|
|
916
|
+
_self[_DYN_TRACK_DEPENDENCY_DAT2 /* @min:%2etrackDependencyDataInternal */](dependency, null, ajaxData[_DYN_GET_PART_APROPS /* @min:%2egetPartAProps */]());
|
|
915
917
|
}
|
|
916
918
|
else {
|
|
917
919
|
_reportFetchError(14 /* _eInternalMessageId.FailedMonitorAjaxDur */, null, {
|
|
918
920
|
requestSentTime: ajaxData[_DYN_REQUEST_SENT_TIME /* @min:%2erequestSentTime */],
|
|
919
|
-
responseFinishedTime: ajaxData[
|
|
921
|
+
responseFinishedTime: ajaxData[_DYN_RESPONSE_FINISHED_TI14 /* @min:%2eresponseFinishedTime */]
|
|
920
922
|
});
|
|
921
923
|
}
|
|
922
924
|
}, function (e) {
|
|
@@ -927,7 +929,7 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
927
929
|
if (response && response[_DYN_HEADERS /* @min:%2eheaders */]) {
|
|
928
930
|
try {
|
|
929
931
|
var responseHeader = response[_DYN_HEADERS /* @min:%2eheaders */].get(RequestHeaders[0 /* eRequestHeaders.requestContextHeader */]);
|
|
930
|
-
return
|
|
932
|
+
return correlationIdGetCorrelationContext(responseHeader);
|
|
931
933
|
}
|
|
932
934
|
catch (e) {
|
|
933
935
|
_throwInternalWarning(_self, 18 /* _eInternalMessageId.FailedMonitorAjaxGetCorrelationHeader */, "Failed to get Request-Context correlation header as it may be not included in the response or not accessible.", {
|
|
@@ -943,10 +945,10 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
943
945
|
AjaxMonitor.getDefaultConfig = function () {
|
|
944
946
|
var _a;
|
|
945
947
|
var config = (_a = {},
|
|
946
|
-
_a[
|
|
947
|
-
_a[
|
|
948
|
-
_a[
|
|
949
|
-
_a[
|
|
948
|
+
_a[_DYN_MAX_AJAX_CALLS_PER_V8 /* @min:maxAjaxCallsPerView */] = 500,
|
|
949
|
+
_a[_DYN_DISABLE_AJAX_TRACKIN11 /* @min:disableAjaxTracking */] = false,
|
|
950
|
+
_a[_DYN_DISABLE_FETCH_TRACKI12 /* @min:disableFetchTracking */] = false,
|
|
951
|
+
_a[_DYN_EXCLUDE_REQUEST_FROM10 /* @min:excludeRequestFromAutoTrackingPatterns */] = undefined,
|
|
950
952
|
_a.disableCorrelationHeaders = false,
|
|
951
953
|
_a.distributedTracingMode = 1 /* eDistributedTracingModes.AI_AND_W3C */,
|
|
952
954
|
_a.correlationHeaderExcludedDomains = DfltAjaxCorrelationHeaderExDomains,
|
|
@@ -954,12 +956,12 @@ var AjaxMonitor = /** @class */ (function (_super) {
|
|
|
954
956
|
_a.correlationHeaderExcludePatterns = undefined,
|
|
955
957
|
_a[_DYN_APP_ID /* @min:appId */] = undefined,
|
|
956
958
|
_a.enableCorsCorrelation = false,
|
|
957
|
-
_a[
|
|
958
|
-
_a[
|
|
959
|
-
_a[
|
|
960
|
-
_a[
|
|
959
|
+
_a[_DYN_ENABLE_REQUEST_HEADE5 /* @min:enableRequestHeaderTracking */] = false,
|
|
960
|
+
_a[_DYN_ENABLE_RESPONSE_HEAD9 /* @min:enableResponseHeaderTracking */] = false,
|
|
961
|
+
_a[_DYN_ENABLE_AJAX_ERROR_ST6 /* @min:enableAjaxErrorStatusText */] = false,
|
|
962
|
+
_a[_DYN_ENABLE_AJAX_PERF_TRA7 /* @min:enableAjaxPerfTracking */] = false,
|
|
961
963
|
_a.maxAjaxPerfLookupAttempts = 3,
|
|
962
|
-
_a[
|
|
964
|
+
_a[_DYN_AJAX_PERF_LOOKUP_DEL16 /* @min:ajaxPerfLookupDelay */] = 25,
|
|
963
965
|
_a.ignoreHeaders = [
|
|
964
966
|
"Authorization",
|
|
965
967
|
"X-API-Key",
|