@microsoft/applicationinsights-common 2.8.4-nightly.2205-08 → 2.8.4
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-common.integrity.json +9 -9
- package/browser/applicationinsights-common.js +174 -127
- package/browser/applicationinsights-common.js.map +1 -1
- package/browser/applicationinsights-common.min.js +2 -2
- package/browser/applicationinsights-common.min.js.map +1 -1
- package/dist/applicationinsights-common.api.json +81 -501
- package/dist/applicationinsights-common.api.md +24 -23
- package/dist/applicationinsights-common.d.ts +33 -91
- package/dist/applicationinsights-common.js +174 -127
- package/dist/applicationinsights-common.js.map +1 -1
- package/dist/applicationinsights-common.min.js +2 -2
- package/dist/applicationinsights-common.min.js.map +1 -1
- package/dist/applicationinsights-common.rollup.d.ts +33 -91
- package/dist-esm/ConnectionStringParser.js +1 -1
- package/dist-esm/Constants.js +1 -1
- package/dist-esm/DomHelperFuncs.js +1 -1
- package/dist-esm/Enums.js +6 -6
- package/dist-esm/Enums.js.map +1 -1
- package/dist-esm/HelperFuncs.js +1 -1
- package/dist-esm/Interfaces/ConnectionString.js +1 -1
- package/dist-esm/Interfaces/Context/IApplication.js +1 -1
- package/dist-esm/Interfaces/Context/IDevice.js +1 -1
- package/dist-esm/Interfaces/Context/IInternal.js +1 -1
- package/dist-esm/Interfaces/Context/ILocation.js +1 -1
- package/dist-esm/Interfaces/Context/IOperatingSystem.js +1 -1
- package/dist-esm/Interfaces/Context/ISample.js +1 -1
- package/dist-esm/Interfaces/Context/ISession.js +1 -1
- package/dist-esm/Interfaces/Context/ITelemetryTrace.js +1 -1
- package/dist-esm/Interfaces/Context/IUser.js +1 -1
- package/dist-esm/Interfaces/Context/IWeb.js +1 -1
- package/dist-esm/Interfaces/Contracts/AvailabilityData.js +1 -1
- package/dist-esm/Interfaces/Contracts/ContextTagKeys.js +1 -1
- package/dist-esm/Interfaces/Contracts/DataPointType.js +1 -1
- package/dist-esm/Interfaces/Contracts/DependencyKind.js +1 -1
- package/dist-esm/Interfaces/Contracts/DependencySourceType.js +1 -1
- package/dist-esm/Interfaces/Contracts/IBase.js +1 -1
- package/dist-esm/Interfaces/Contracts/IData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IDataPoint.js +1 -1
- package/dist-esm/Interfaces/Contracts/IDomain.js +1 -1
- package/dist-esm/Interfaces/Contracts/IEnvelope.js +1 -1
- package/dist-esm/Interfaces/Contracts/IEventData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IExceptionData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IExceptionDetails.js +1 -1
- package/dist-esm/Interfaces/Contracts/IMessageData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IMetricData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IPageViewData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IPageViewPerfData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IRemoteDependencyData.js +1 -1
- package/dist-esm/Interfaces/Contracts/IStackFrame.js +1 -1
- package/dist-esm/Interfaces/Contracts/RequestData.js +1 -1
- package/dist-esm/Interfaces/Contracts/SeverityLevel.js +6 -6
- package/dist-esm/Interfaces/Contracts/SeverityLevel.js.map +1 -1
- package/dist-esm/Interfaces/IAppInsights.js +1 -1
- package/dist-esm/Interfaces/IChannelControlsAI.js +1 -1
- package/dist-esm/Interfaces/IConfig.js +1 -1
- package/dist-esm/Interfaces/ICorrelationConfig.js +1 -1
- package/dist-esm/Interfaces/IDependencyTelemetry.js +1 -1
- package/dist-esm/Interfaces/IEventTelemetry.js +1 -1
- package/dist-esm/Interfaces/IExceptionTelemetry.js +1 -1
- package/dist-esm/Interfaces/IMetricTelemetry.js +1 -1
- package/dist-esm/Interfaces/IPageViewPerformanceTelemetry.js +1 -1
- package/dist-esm/Interfaces/IPageViewTelemetry.js +1 -1
- package/dist-esm/Interfaces/IPartC.js +1 -1
- package/dist-esm/Interfaces/IPropertiesPlugin.js +1 -1
- package/dist-esm/Interfaces/IRequestContext.js +1 -1
- package/dist-esm/Interfaces/ITelemetryContext.js +1 -1
- package/dist-esm/Interfaces/ITraceTelemetry.js +1 -1
- package/dist-esm/Interfaces/PartAExtensions.js +1 -1
- package/dist-esm/Interfaces/Telemetry/IEnvelope.js +1 -1
- package/dist-esm/Interfaces/Telemetry/ISerializable.js +1 -1
- package/dist-esm/RequestResponseHeaders.js +10 -10
- package/dist-esm/RequestResponseHeaders.js.map +1 -1
- package/dist-esm/StorageHelperFuncs.js +7 -7
- package/dist-esm/StorageHelperFuncs.js.map +1 -1
- package/dist-esm/Telemetry/Common/Data.js +3 -3
- package/dist-esm/Telemetry/Common/Data.js.map +1 -1
- package/dist-esm/Telemetry/Common/DataPoint.js +9 -9
- package/dist-esm/Telemetry/Common/DataPoint.js.map +1 -1
- package/dist-esm/Telemetry/Common/DataSanitizer.js +26 -26
- package/dist-esm/Telemetry/Common/DataSanitizer.js.map +1 -1
- package/dist-esm/Telemetry/Common/Envelope.js +7 -7
- package/dist-esm/Telemetry/Common/Envelope.js.map +1 -1
- package/dist-esm/Telemetry/Event.js +5 -5
- package/dist-esm/Telemetry/Event.js.map +1 -1
- package/dist-esm/Telemetry/Exception.js +18 -18
- package/dist-esm/Telemetry/Exception.js.map +1 -1
- package/dist-esm/Telemetry/Metric.js +4 -4
- package/dist-esm/Telemetry/Metric.js.map +1 -1
- package/dist-esm/Telemetry/PageView.js +8 -8
- package/dist-esm/Telemetry/PageView.js.map +1 -1
- package/dist-esm/Telemetry/PageViewPerformance.js +12 -12
- package/dist-esm/Telemetry/PageViewPerformance.js.map +1 -1
- package/dist-esm/Telemetry/RemoteDependencyData.js +22 -22
- package/dist-esm/Telemetry/RemoteDependencyData.js.map +1 -1
- package/dist-esm/Telemetry/Trace.js +5 -5
- package/dist-esm/Telemetry/Trace.js.map +1 -1
- package/dist-esm/TelemetryItemCreator.js +1 -1
- package/dist-esm/UrlHelperFuncs.js +1 -1
- package/dist-esm/Util.js +46 -3
- package/dist-esm/Util.js.map +1 -1
- package/dist-esm/applicationinsights-common.js +3 -4
- package/dist-esm/applicationinsights-common.js.map +1 -1
- package/package.json +54 -57
- package/src/Interfaces/Context/ITelemetryTrace.ts +6 -0
- package/src/Util.ts +49 -2
- package/src/applicationinsights-common.ts +6 -6
- package/types/Interfaces/Context/ITelemetryTrace.d.ts +5 -0
- package/types/Util.d.ts +9 -1
- package/types/applicationinsights-common.d.ts +2 -4
- package/types/tsdoc-metadata.json +1 -1
- package/dist-esm/Interfaces/ITraceParent.js +0 -8
- package/dist-esm/Interfaces/ITraceParent.js.map +0 -1
- package/dist-esm/W3cTraceParent.js +0 -192
- package/dist-esm/W3cTraceParent.js.map +0 -1
- package/src/Interfaces/ITraceParent.ts +0 -38
- package/src/W3cTraceParent.ts +0 -219
- package/types/Interfaces/ITraceParent.d.ts +0 -32
- package/types/W3cTraceParent.d.ts +0 -59
package/package.json
CHANGED
|
@@ -1,57 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@microsoft/applicationinsights-common",
|
|
3
|
-
"version": "2.8.4
|
|
4
|
-
"description": "Microsoft Application Insights Common JavaScript Library",
|
|
5
|
-
"homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
|
|
6
|
-
"author": "Microsoft Application Insights Team",
|
|
7
|
-
"main": "./dist/applicationinsights-common.js",
|
|
8
|
-
"module": "./dist-esm/applicationinsights-common.js",
|
|
9
|
-
"types": "./types/applicationinsights-common.d.ts",
|
|
10
|
-
"sideEffects": false,
|
|
11
|
-
"repository": {
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "https://github.com/microsoft/ApplicationInsights-JS/tree/master/shared/AppInsightsCommon"
|
|
14
|
-
},
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "npm run build:esm && npm run build:browser && npm run sri && npm run dtsgen",
|
|
17
|
-
"build:esm": "grunt common",
|
|
18
|
-
"build:browser": "rollup -c",
|
|
19
|
-
"rebuild": "npm run build",
|
|
20
|
-
"test": "grunt commontest",
|
|
21
|
-
"lint": "tslint -p tsconfig.json",
|
|
22
|
-
"dtsgen": "api-extractor run --local && node ../../scripts/dtsgen.js \"Microsoft Application Insights Common JavaScript Library\"",
|
|
23
|
-
"sri": "node ../../tools/subResourceIntegrity/generateIntegrityFile.js"
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@microsoft/ai-test-framework": "0.0.1",
|
|
27
|
-
"@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
|
|
28
|
-
"@microsoft/applicationinsights-rollup-es3": "1.1.3",
|
|
29
|
-
"@microsoft/api-extractor": "^7.18.1",
|
|
30
|
-
"grunt": "^1.5.3",
|
|
31
|
-
"grunt-cli": "^1.4.3",
|
|
32
|
-
"grunt-contrib-qunit": "^5.0.1",
|
|
33
|
-
"@nevware21/grunt-ts-plugin": "^0.4.3",
|
|
34
|
-
"@nevware21/grunt-eslint-ts": "^0.2.2",
|
|
35
|
-
"@rollup/plugin-commonjs": "^18.0.0",
|
|
36
|
-
"@rollup/plugin-node-resolve": "^11.2.1",
|
|
37
|
-
"@rollup/plugin-replace": "^2.3.3",
|
|
38
|
-
"rollup-plugin-cleanup": "^3.2.1",
|
|
39
|
-
"rollup": "^2.32.0",
|
|
40
|
-
"typescript": "^4.3.4",
|
|
41
|
-
"tslib": "^2.0.0",
|
|
42
|
-
"globby": "^11.0.0",
|
|
43
|
-
"magic-string": "^0.25.7"
|
|
44
|
-
},
|
|
45
|
-
"peerDependencies": {
|
|
46
|
-
"tslib": "*"
|
|
47
|
-
},
|
|
48
|
-
"dependencies": {
|
|
49
|
-
"@microsoft/applicationinsights-shims": "2.0.1",
|
|
50
|
-
"@microsoft/applicationinsights-core-js": "2.8.4
|
|
51
|
-
"@microsoft/dynamicproto-js": "^1.1.6"
|
|
52
|
-
},
|
|
53
|
-
"license": "MIT"
|
|
54
|
-
|
|
55
|
-
"tag": "nightly"
|
|
56
|
-
}
|
|
57
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@microsoft/applicationinsights-common",
|
|
3
|
+
"version": "2.8.4",
|
|
4
|
+
"description": "Microsoft Application Insights Common JavaScript Library",
|
|
5
|
+
"homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
|
|
6
|
+
"author": "Microsoft Application Insights Team",
|
|
7
|
+
"main": "./dist/applicationinsights-common.js",
|
|
8
|
+
"module": "./dist-esm/applicationinsights-common.js",
|
|
9
|
+
"types": "./types/applicationinsights-common.d.ts",
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/microsoft/ApplicationInsights-JS/tree/master/shared/AppInsightsCommon"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "npm run build:esm && npm run build:browser && npm run sri && npm run dtsgen",
|
|
17
|
+
"build:esm": "grunt common",
|
|
18
|
+
"build:browser": "rollup -c",
|
|
19
|
+
"rebuild": "npm run build",
|
|
20
|
+
"test": "grunt commontest",
|
|
21
|
+
"lint": "tslint -p tsconfig.json",
|
|
22
|
+
"dtsgen": "api-extractor run --local && node ../../scripts/dtsgen.js \"Microsoft Application Insights Common JavaScript Library\"",
|
|
23
|
+
"sri": "node ../../tools/subResourceIntegrity/generateIntegrityFile.js"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@microsoft/ai-test-framework": "0.0.1",
|
|
27
|
+
"@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
|
|
28
|
+
"@microsoft/applicationinsights-rollup-es3": "1.1.3",
|
|
29
|
+
"@microsoft/api-extractor": "^7.18.1",
|
|
30
|
+
"grunt": "^1.5.3",
|
|
31
|
+
"grunt-cli": "^1.4.3",
|
|
32
|
+
"grunt-contrib-qunit": "^5.0.1",
|
|
33
|
+
"@nevware21/grunt-ts-plugin": "^0.4.3",
|
|
34
|
+
"@nevware21/grunt-eslint-ts": "^0.2.2",
|
|
35
|
+
"@rollup/plugin-commonjs": "^18.0.0",
|
|
36
|
+
"@rollup/plugin-node-resolve": "^11.2.1",
|
|
37
|
+
"@rollup/plugin-replace": "^2.3.3",
|
|
38
|
+
"rollup-plugin-cleanup": "^3.2.1",
|
|
39
|
+
"rollup": "^2.32.0",
|
|
40
|
+
"typescript": "^4.3.4",
|
|
41
|
+
"tslib": "^2.0.0",
|
|
42
|
+
"globby": "^11.0.0",
|
|
43
|
+
"magic-string": "^0.25.7"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"tslib": "*"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@microsoft/applicationinsights-shims": "2.0.1",
|
|
50
|
+
"@microsoft/applicationinsights-core-js": "2.8.4",
|
|
51
|
+
"@microsoft/dynamicproto-js": "^1.1.6"
|
|
52
|
+
},
|
|
53
|
+
"license": "MIT"
|
|
54
|
+
}
|
|
@@ -13,10 +13,16 @@ export interface ITelemetryTrace {
|
|
|
13
13
|
parentID?: string;
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
+
* @deprecated Never Used
|
|
16
17
|
* Trace state
|
|
17
18
|
*/
|
|
18
19
|
traceState?: ITraceState;
|
|
19
20
|
|
|
21
|
+
/**
|
|
22
|
+
* An integer representation of the W3C TraceContext trace-flags. https://www.w3.org/TR/trace-context/#trace-flags
|
|
23
|
+
*/
|
|
24
|
+
traceFlags?: number;
|
|
25
|
+
|
|
20
26
|
/**
|
|
21
27
|
* Name
|
|
22
28
|
*/
|
package/src/Util.ts
CHANGED
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
dateNow, uaDisallowsSameSiteNone, disableCookies as coreDisableCookies,
|
|
10
10
|
canUseCookies as coreCanUseCookies, getCookie as coreGetCookie,
|
|
11
11
|
setCookie as coreSetCookie, deleteCookie as coreDeleteCookie,
|
|
12
|
-
isBeaconsSupported,
|
|
13
|
-
|
|
12
|
+
isBeaconsSupported, arrIndexOf, IDistributedTraceContext,
|
|
13
|
+
isValidTraceId, isValidSpanId
|
|
14
14
|
} from "@microsoft/applicationinsights-core-js";
|
|
15
15
|
import { eRequestHeaders, RequestHeaders } from "./RequestResponseHeaders";
|
|
16
16
|
import { dataSanitizeString } from "./Telemetry/Common/DataSanitizer";
|
|
@@ -20,6 +20,7 @@ import { stringToBoolOrDefault, msToTimeSpan, isCrossOriginError, getExtensionBy
|
|
|
20
20
|
import { strNotSpecified } from "./Constants";
|
|
21
21
|
import { utlCanUseLocalStorage, utlCanUseSessionStorage, utlDisableStorage, utlGetSessionStorage, utlGetSessionStorageKeys, utlGetLocalStorage, utlRemoveSessionStorage, utlRemoveStorage, utlSetSessionStorage, utlSetLocalStorage } from "./StorageHelperFuncs";
|
|
22
22
|
import { urlGetAbsoluteUrl, urlGetCompleteUrl, urlGetPathName, urlParseFullHost, urlParseHost, urlParseUrl } from "./UrlHelperFuncs";
|
|
23
|
+
import { ITelemetryTrace } from "./Interfaces/Context/ITelemetryTrace";
|
|
23
24
|
|
|
24
25
|
// listing only non-geo specific locations
|
|
25
26
|
const _internalEndpoints: string[] = [
|
|
@@ -489,3 +490,49 @@ export const DateTimeUtils: IDateTimeUtils = {
|
|
|
489
490
|
Now: dateTimeUtilsNow,
|
|
490
491
|
GetDuration: dateTimeUtilsDuration
|
|
491
492
|
};
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Creates a IDistributedTraceContext from an optional telemetryTrace
|
|
497
|
+
* @param telemetryTrace - The telemetryTrace instance that is being wrapped
|
|
498
|
+
* @param parentCtx - An optional parent distributed trace instance, almost always undefined as this scenario is only used in the case of multiple property handlers.
|
|
499
|
+
* @returns A new IDistributedTraceContext instance that is backed by the telemetryTrace or temporary object
|
|
500
|
+
*/
|
|
501
|
+
export function createDistributedTraceContextFromTrace(telemetryTrace?: ITelemetryTrace, parentCtx?: IDistributedTraceContext): IDistributedTraceContext {
|
|
502
|
+
let trace: ITelemetryTrace = telemetryTrace || {};
|
|
503
|
+
|
|
504
|
+
return {
|
|
505
|
+
getName: (): string => {
|
|
506
|
+
return trace.name;
|
|
507
|
+
},
|
|
508
|
+
setName: (newValue: string): void => {
|
|
509
|
+
parentCtx && parentCtx.setName(newValue);
|
|
510
|
+
trace.name = newValue;
|
|
511
|
+
},
|
|
512
|
+
getTraceId: (): string => {
|
|
513
|
+
return trace.traceID;
|
|
514
|
+
},
|
|
515
|
+
setTraceId: (newValue: string): void => {
|
|
516
|
+
parentCtx && parentCtx.setTraceId(newValue);
|
|
517
|
+
if (isValidTraceId(newValue)) {
|
|
518
|
+
trace.traceID = newValue
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
getSpanId: (): string => {
|
|
522
|
+
return trace.parentID;
|
|
523
|
+
},
|
|
524
|
+
setSpanId: (newValue: string): void => {
|
|
525
|
+
parentCtx && parentCtx.setSpanId(newValue);
|
|
526
|
+
if (isValidSpanId(newValue)) {
|
|
527
|
+
trace.parentID = newValue
|
|
528
|
+
}
|
|
529
|
+
},
|
|
530
|
+
getTraceFlags: (): number => {
|
|
531
|
+
return trace.traceFlags;
|
|
532
|
+
},
|
|
533
|
+
setTraceFlags: (newTraceFlags?: number): void => {
|
|
534
|
+
parentCtx && parentCtx.setTraceFlags(newTraceFlags);
|
|
535
|
+
trace.traceFlags = newTraceFlags
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
export {
|
|
4
4
|
IUtil, Util, ICorrelationIdHelper, CorrelationIdHelper,
|
|
5
5
|
IDateTimeUtils, DateTimeUtils, dateTimeUtilsNow, dateTimeUtilsDuration,
|
|
6
|
-
IUrlHelper, UrlHelper, isInternalApplicationInsightsEndpoint
|
|
6
|
+
IUrlHelper, UrlHelper, isInternalApplicationInsightsEndpoint,
|
|
7
|
+
createDistributedTraceContextFromTrace
|
|
7
8
|
} from "./Util";
|
|
8
9
|
export { parseConnectionString, ConnectionStringParser } from "./ConnectionStringParser";
|
|
9
10
|
export { FieldType } from "./Enums";
|
|
@@ -59,17 +60,16 @@ export { ITelemetryTrace, ITraceState } from "./Interfaces/Context/ITelemetryTra
|
|
|
59
60
|
export { IRequestContext } from "./Interfaces/IRequestContext";
|
|
60
61
|
export { eDistributedTracingModes, DistributedTracingModes } from "./Enums";
|
|
61
62
|
export { stringToBoolOrDefault, msToTimeSpan, getExtensionByName, isCrossOriginError } from "./HelperFuncs";
|
|
62
|
-
export {
|
|
63
|
+
export {
|
|
64
|
+
isBeaconsSupported as isBeaconApiSupported,
|
|
65
|
+
ITraceParent, createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent
|
|
66
|
+
} from "@microsoft/applicationinsights-core-js"
|
|
63
67
|
export { createDomEvent } from "./DomHelperFuncs";
|
|
64
68
|
export {
|
|
65
69
|
utlDisableStorage, utlEnableStorage, utlCanUseLocalStorage, utlGetLocalStorage, utlSetLocalStorage, utlRemoveStorage,
|
|
66
70
|
utlCanUseSessionStorage, utlGetSessionStorageKeys, utlGetSessionStorage, utlSetSessionStorage, utlRemoveSessionStorage
|
|
67
71
|
} from "./StorageHelperFuncs";
|
|
68
72
|
export { urlParseUrl, urlGetAbsoluteUrl, urlGetPathName, urlGetCompleteUrl, urlParseHost, urlParseFullHost } from "./UrlHelperFuncs";
|
|
69
|
-
export { ITraceParent } from "./Interfaces/ITraceParent";
|
|
70
|
-
export {
|
|
71
|
-
createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent
|
|
72
|
-
} from "./W3cTraceParent";
|
|
73
73
|
|
|
74
74
|
export const PropertiesPluginIdentifier = "AppInsightsPropertiesPlugin";
|
|
75
75
|
export const BreezeChannelIdentifier = "AppInsightsChannelPlugin";
|
|
@@ -8,9 +8,14 @@ export interface ITelemetryTrace {
|
|
|
8
8
|
*/
|
|
9
9
|
parentID?: string;
|
|
10
10
|
/**
|
|
11
|
+
* @deprecated Never Used
|
|
11
12
|
* Trace state
|
|
12
13
|
*/
|
|
13
14
|
traceState?: ITraceState;
|
|
15
|
+
/**
|
|
16
|
+
* An integer representation of the W3C TraceContext trace-flags. https://www.w3.org/TR/trace-context/#trace-flags
|
|
17
|
+
*/
|
|
18
|
+
traceFlags?: number;
|
|
14
19
|
/**
|
|
15
20
|
* Name
|
|
16
21
|
*/
|
package/types/Util.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { IDiagnosticLogger, IPlugin } from "@microsoft/applicationinsights-core-js";
|
|
1
|
+
import { IDiagnosticLogger, IPlugin, IDistributedTraceContext } from "@microsoft/applicationinsights-core-js";
|
|
2
2
|
import { ICorrelationConfig } from "./Interfaces/ICorrelationConfig";
|
|
3
|
+
import { ITelemetryTrace } from "./Interfaces/Context/ITelemetryTrace";
|
|
3
4
|
export declare function isInternalApplicationInsightsEndpoint(endpointUrl: string): boolean;
|
|
4
5
|
export interface IUtil {
|
|
5
6
|
NotSpecified: string;
|
|
@@ -219,3 +220,10 @@ export interface IDateTimeUtils {
|
|
|
219
220
|
* A utility class that helps getting time related parameters
|
|
220
221
|
*/
|
|
221
222
|
export declare const DateTimeUtils: IDateTimeUtils;
|
|
223
|
+
/**
|
|
224
|
+
* Creates a IDistributedTraceContext from an optional telemetryTrace
|
|
225
|
+
* @param telemetryTrace - The telemetryTrace instance that is being wrapped
|
|
226
|
+
* @param parentCtx - An optional parent distributed trace instance, almost always undefined as this scenario is only used in the case of multiple property handlers.
|
|
227
|
+
* @returns A new IDistributedTraceContext instance that is backed by the telemetryTrace or temporary object
|
|
228
|
+
*/
|
|
229
|
+
export declare function createDistributedTraceContextFromTrace(telemetryTrace?: ITelemetryTrace, parentCtx?: IDistributedTraceContext): IDistributedTraceContext;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { IUtil, Util, ICorrelationIdHelper, CorrelationIdHelper, IDateTimeUtils, DateTimeUtils, dateTimeUtilsNow, dateTimeUtilsDuration, IUrlHelper, UrlHelper, isInternalApplicationInsightsEndpoint } from "./Util";
|
|
1
|
+
export { IUtil, Util, ICorrelationIdHelper, CorrelationIdHelper, IDateTimeUtils, DateTimeUtils, dateTimeUtilsNow, dateTimeUtilsDuration, IUrlHelper, UrlHelper, isInternalApplicationInsightsEndpoint, createDistributedTraceContextFromTrace } from "./Util";
|
|
2
2
|
export { parseConnectionString, ConnectionStringParser } from "./ConnectionStringParser";
|
|
3
3
|
export { FieldType } from "./Enums";
|
|
4
4
|
export { IRequestHeaders, RequestHeaders, eRequestHeaders } from "./RequestResponseHeaders";
|
|
@@ -48,12 +48,10 @@ export { ITelemetryTrace, ITraceState } from "./Interfaces/Context/ITelemetryTra
|
|
|
48
48
|
export { IRequestContext } from "./Interfaces/IRequestContext";
|
|
49
49
|
export { eDistributedTracingModes, DistributedTracingModes } from "./Enums";
|
|
50
50
|
export { stringToBoolOrDefault, msToTimeSpan, getExtensionByName, isCrossOriginError } from "./HelperFuncs";
|
|
51
|
-
export { isBeaconsSupported as isBeaconApiSupported } from "@microsoft/applicationinsights-core-js";
|
|
51
|
+
export { isBeaconsSupported as isBeaconApiSupported, ITraceParent, createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent } from "@microsoft/applicationinsights-core-js";
|
|
52
52
|
export { createDomEvent } from "./DomHelperFuncs";
|
|
53
53
|
export { utlDisableStorage, utlEnableStorage, utlCanUseLocalStorage, utlGetLocalStorage, utlSetLocalStorage, utlRemoveStorage, utlCanUseSessionStorage, utlGetSessionStorageKeys, utlGetSessionStorage, utlSetSessionStorage, utlRemoveSessionStorage } from "./StorageHelperFuncs";
|
|
54
54
|
export { urlParseUrl, urlGetAbsoluteUrl, urlGetPathName, urlGetCompleteUrl, urlParseHost, urlParseFullHost } from "./UrlHelperFuncs";
|
|
55
|
-
export { ITraceParent } from "./Interfaces/ITraceParent";
|
|
56
|
-
export { createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent } from "./W3cTraceParent";
|
|
57
55
|
export declare const PropertiesPluginIdentifier = "AppInsightsPropertiesPlugin";
|
|
58
56
|
export declare const BreezeChannelIdentifier = "AppInsightsChannelPlugin";
|
|
59
57
|
export declare const AnalyticsPluginIdentifier = "ApplicationInsightsAnalytics";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ITraceParent.js.map","sources":["ITraceParent.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nexport {};\r\n//# sourceMappingURL=ITraceParent.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA"}
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Common, 2.8.4-nightly.2205-08
|
|
3
|
-
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
-
*/
|
|
5
|
-
import { generateW3CId, getDocument, getPerformance, isArray, isString, strTrim } from "@microsoft/applicationinsights-core-js";
|
|
6
|
-
// using {0,16} for leading and trailing whitespace just to constrain the possible runtime of a random string
|
|
7
|
-
var TRACE_PARENT_REGEX = /^([\da-f]{2})-([\da-f]{32})-([\da-f]{16})-([\da-f]{2})(-[^\s]*)?$/;
|
|
8
|
-
var DEFAULT_VERSION = "00";
|
|
9
|
-
var INVALID_VERSION = "ff";
|
|
10
|
-
var INVALID_TRACE_ID = "00000000000000000000000000000000";
|
|
11
|
-
var INVALID_SPAN_ID = "0000000000000000";
|
|
12
|
-
var SAMPLED_FLAG = 0x01;
|
|
13
|
-
function _isValid(value, len, invalidValue) {
|
|
14
|
-
if (value && value.length === len && value !== invalidValue) {
|
|
15
|
-
return !!value.match(/^[\da-f]*$/);
|
|
16
|
-
}
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
function _formatValue(value, len, defValue) {
|
|
20
|
-
if (_isValid(value, len)) {
|
|
21
|
-
return value;
|
|
22
|
-
}
|
|
23
|
-
return defValue;
|
|
24
|
-
}
|
|
25
|
-
function _formatFlags(value) {
|
|
26
|
-
if (isNaN(value) || value < 0 || value > 255) {
|
|
27
|
-
value = 0x01;
|
|
28
|
-
}
|
|
29
|
-
var result = value.toString(16);
|
|
30
|
-
while (result.length < 2) {
|
|
31
|
-
result = "0" + result;
|
|
32
|
-
}
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
function _getTraceParentValue(values) {
|
|
36
|
-
if (values) {
|
|
37
|
-
for (var i = 0; i < values.length; i++) {
|
|
38
|
-
var value = values[i];
|
|
39
|
-
if (value.name) {
|
|
40
|
-
if (value.name === "traceparent") {
|
|
41
|
-
return value;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return {};
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Create a new ITraceParent instance using the provided values.
|
|
50
|
-
* @param traceId - The traceId to use, when invalid a new random W3C id will be generated.
|
|
51
|
-
* @param spanId - The parent/span id to use, a new random value will be generated if it is invalid.
|
|
52
|
-
* @param flags - The traceFlags to use, defaults to zero (0) if not supplied or invalid
|
|
53
|
-
* @param version - The version to used, defaults to version "01" if not supplied or invalid.
|
|
54
|
-
* @returns
|
|
55
|
-
*/
|
|
56
|
-
export function createTraceParent(traceId, spanId, flags, version) {
|
|
57
|
-
return {
|
|
58
|
-
version: _isValid(version, 2, INVALID_VERSION) ? version : DEFAULT_VERSION,
|
|
59
|
-
traceId: isValidTraceId(traceId) ? traceId : generateW3CId(),
|
|
60
|
-
spanId: isValidSpanId(spanId) ? spanId : generateW3CId().substr(0, 16),
|
|
61
|
-
traceFlags: flags >= 0 && flags <= 0xFF ? flags : 1
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Attempt to parse the provided string as a W3C TraceParent header value (https://www.w3.org/TR/trace-context/#traceparent-header)
|
|
66
|
-
*
|
|
67
|
-
* @param value
|
|
68
|
-
* @returns
|
|
69
|
-
*/
|
|
70
|
-
export function parseTraceParent(value) {
|
|
71
|
-
if (!value) {
|
|
72
|
-
// Don't pass a null/undefined or empty string
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
if (isArray(value)) {
|
|
76
|
-
// The value may have been encoded on the page into an array so handle this automatically
|
|
77
|
-
value = value[0] || "";
|
|
78
|
-
}
|
|
79
|
-
if (!value || !isString(value) || value.length > 8192) {
|
|
80
|
-
// limit potential processing based on total length
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
// See https://www.w3.org/TR/trace-context/#versioning-of-traceparent
|
|
84
|
-
var match = TRACE_PARENT_REGEX.exec(strTrim(value));
|
|
85
|
-
if (!match || // No match
|
|
86
|
-
match[1] === INVALID_VERSION || // version ff is forbidden
|
|
87
|
-
match[2] === INVALID_TRACE_ID || // All zeros is considered to be invalid
|
|
88
|
-
match[3] === INVALID_SPAN_ID) { // All zeros is considered to be invalid
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
version: match[1],
|
|
93
|
-
traceId: match[2],
|
|
94
|
-
spanId: match[3],
|
|
95
|
-
traceFlags: parseInt(match[4], 16)
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Is the provided W3c Trace Id a valid string representation, it must be a 32-character string
|
|
100
|
-
* of lowercase hexadecimal characters for example, 4bf92f3577b34da6a3ce929d0e0e4736.
|
|
101
|
-
* If all characters as zero (00000000000000000000000000000000) it will be considered an invalid value.
|
|
102
|
-
* @param value - The W3c trace Id to be validated
|
|
103
|
-
* @returns true if valid otherwise false
|
|
104
|
-
*/
|
|
105
|
-
export function isValidTraceId(value) {
|
|
106
|
-
return _isValid(value, 32, INVALID_TRACE_ID);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Is the provided W3c span id (aka. parent id) a valid string representation, it must be a 16-character
|
|
110
|
-
* string of lowercase hexadecimal characters, for example, 00f067aa0ba902b7.
|
|
111
|
-
* If all characters are zero (0000000000000000) this is considered an invalid value.
|
|
112
|
-
* @param value - The W3c span id to be validated
|
|
113
|
-
* @returns true if valid otherwise false
|
|
114
|
-
*/
|
|
115
|
-
export function isValidSpanId(value) {
|
|
116
|
-
return _isValid(value, 16, INVALID_SPAN_ID);
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Validates that the provided ITraceParent instance conforms to the currently supported specifications
|
|
120
|
-
* @param value
|
|
121
|
-
* @returns
|
|
122
|
-
*/
|
|
123
|
-
export function isValidTraceParent(value) {
|
|
124
|
-
if (!value ||
|
|
125
|
-
!_isValid(value.version, 2, INVALID_VERSION) ||
|
|
126
|
-
!_isValid(value.traceId, 32, INVALID_TRACE_ID) ||
|
|
127
|
-
!_isValid(value.spanId, 16, INVALID_SPAN_ID) ||
|
|
128
|
-
!_isValid(_formatFlags(value.traceFlags), 2)) {
|
|
129
|
-
// Each known field must contain a valid value
|
|
130
|
-
return false;
|
|
131
|
-
}
|
|
132
|
-
return true;
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Is the parsed traceParent indicating that the trace is currently sampled.
|
|
136
|
-
* @param value - The parsed traceParent value
|
|
137
|
-
* @returns
|
|
138
|
-
*/
|
|
139
|
-
export function isSampledFlag(value) {
|
|
140
|
-
if (isValidTraceParent(value)) {
|
|
141
|
-
return (value.traceFlags & SAMPLED_FLAG) === SAMPLED_FLAG;
|
|
142
|
-
}
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Format the ITraceParent value as a string using the supported and know version formats.
|
|
147
|
-
* So even if the passed traceParent is a later version the string value returned from this
|
|
148
|
-
* function will convert it to only the known version formats.
|
|
149
|
-
* This currently only supports version "00" and invalid "ff"
|
|
150
|
-
* @param value - The parsed traceParent value
|
|
151
|
-
* @returns
|
|
152
|
-
*/
|
|
153
|
-
export function formatTraceParent(value) {
|
|
154
|
-
if (value) {
|
|
155
|
-
// Special Note: This only supports formatting as version 00, future versions should encode any known supported version
|
|
156
|
-
// So parsing a future version will populate the correct version value but reformatting will reduce it to version 00.
|
|
157
|
-
var flags = _formatFlags(value.traceFlags);
|
|
158
|
-
if (!_isValid(flags, 2)) {
|
|
159
|
-
flags = "01";
|
|
160
|
-
}
|
|
161
|
-
var version = value.version || DEFAULT_VERSION;
|
|
162
|
-
if (version !== "00" && version !== "ff") {
|
|
163
|
-
// Reduce version to "00"
|
|
164
|
-
version = DEFAULT_VERSION;
|
|
165
|
-
}
|
|
166
|
-
// Format as version 00
|
|
167
|
-
return "".concat(version, "-").concat(_formatValue(value.traceId, 32, INVALID_TRACE_ID), "-").concat(_formatValue(value.spanId, 16, INVALID_SPAN_ID), "-").concat(flags);
|
|
168
|
-
}
|
|
169
|
-
return "";
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Helper function to fetch the passed traceparent from the page, looking for it as a meta-tag or a Server-Timing header.
|
|
173
|
-
* @returns
|
|
174
|
-
*/
|
|
175
|
-
export function findW3cTraceParent() {
|
|
176
|
-
var traceParent;
|
|
177
|
-
var doc = getDocument();
|
|
178
|
-
if (doc) {
|
|
179
|
-
// Look for a meta-tag called "traceparent"
|
|
180
|
-
traceParent = parseTraceParent(_getTraceParentValue(doc.querySelectorAll("meta")).content);
|
|
181
|
-
}
|
|
182
|
-
if (!traceParent) {
|
|
183
|
-
var perf = getPerformance();
|
|
184
|
-
if (perf) {
|
|
185
|
-
// Try looking for a server-timing header
|
|
186
|
-
var navPerf = perf.getEntriesByType("navigation") || [];
|
|
187
|
-
traceParent = parseTraceParent(_getTraceParentValue((navPerf.length > 0 ? navPerf[0] : {}).serverTiming).description);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return traceParent;
|
|
191
|
-
}
|
|
192
|
-
//# sourceMappingURL=W3cTraceParent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"W3cTraceParent.js.map","sources":["W3cTraceParent.js"],"sourcesContent":["import { generateW3CId, getDocument, getPerformance, isArray, isString, strTrim } from \"@microsoft/applicationinsights-core-js\";\r\n// using {0,16} for leading and trailing whitespace just to constrain the possible runtime of a random string\r\nvar TRACE_PARENT_REGEX = /^([\\da-f]{2})-([\\da-f]{32})-([\\da-f]{16})-([\\da-f]{2})(-[^\\s]*)?$/;\r\nvar DEFAULT_VERSION = \"00\";\r\nvar INVALID_VERSION = \"ff\";\r\nvar INVALID_TRACE_ID = \"00000000000000000000000000000000\";\r\nvar INVALID_SPAN_ID = \"0000000000000000\";\r\nvar SAMPLED_FLAG = 0x01;\r\nfunction _isValid(value, len, invalidValue) {\r\n if (value && value.length === len && value !== invalidValue) {\r\n return !!value.match(/^[\\da-f]*$/);\r\n }\r\n return false;\r\n}\r\nfunction _formatValue(value, len, defValue) {\r\n if (_isValid(value, len)) {\r\n return value;\r\n }\r\n return defValue;\r\n}\r\nfunction _formatFlags(value) {\r\n if (isNaN(value) || value < 0 || value > 255) {\r\n value = 0x01;\r\n }\r\n var result = value.toString(16);\r\n while (result.length < 2) {\r\n result = \"0\" + result;\r\n }\r\n return result;\r\n}\r\nfunction _getTraceParentValue(values) {\r\n if (values) {\r\n for (var i = 0; i < values.length; i++) {\r\n var value = values[i];\r\n if (value.name) {\r\n if (value.name === \"traceparent\") {\r\n return value;\r\n }\r\n }\r\n }\r\n }\r\n return {};\r\n}\r\n/**\r\n * Create a new ITraceParent instance using the provided values.\r\n * @param traceId - The traceId to use, when invalid a new random W3C id will be generated.\r\n * @param spanId - The parent/span id to use, a new random value will be generated if it is invalid.\r\n * @param flags - The traceFlags to use, defaults to zero (0) if not supplied or invalid\r\n * @param version - The version to used, defaults to version \"01\" if not supplied or invalid.\r\n * @returns\r\n */\r\nexport function createTraceParent(traceId, spanId, flags, version) {\r\n return {\r\n version: _isValid(version, 2, INVALID_VERSION) ? version : DEFAULT_VERSION,\r\n traceId: isValidTraceId(traceId) ? traceId : generateW3CId(),\r\n spanId: isValidSpanId(spanId) ? spanId : generateW3CId().substr(0, 16),\r\n traceFlags: flags >= 0 && flags <= 0xFF ? flags : 1\r\n };\r\n}\r\n/**\r\n * Attempt to parse the provided string as a W3C TraceParent header value (https://www.w3.org/TR/trace-context/#traceparent-header)\r\n *\r\n * @param value\r\n * @returns\r\n */\r\nexport function parseTraceParent(value) {\r\n if (!value) {\r\n // Don't pass a null/undefined or empty string\r\n return null;\r\n }\r\n if (isArray(value)) {\r\n // The value may have been encoded on the page into an array so handle this automatically\r\n value = value[0] || \"\";\r\n }\r\n if (!value || !isString(value) || value.length > 8192) {\r\n // limit potential processing based on total length\r\n return null;\r\n }\r\n // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent\r\n var match = TRACE_PARENT_REGEX.exec(strTrim(value));\r\n if (!match || // No match\r\n match[1] === INVALID_VERSION || // version ff is forbidden\r\n match[2] === INVALID_TRACE_ID || // All zeros is considered to be invalid\r\n match[3] === INVALID_SPAN_ID) { // All zeros is considered to be invalid\r\n return null;\r\n }\r\n return {\r\n version: match[1],\r\n traceId: match[2],\r\n spanId: match[3],\r\n traceFlags: parseInt(match[4], 16)\r\n };\r\n}\r\n/**\r\n * Is the provided W3c Trace Id a valid string representation, it must be a 32-character string\r\n * of lowercase hexadecimal characters for example, 4bf92f3577b34da6a3ce929d0e0e4736.\r\n * If all characters as zero (00000000000000000000000000000000) it will be considered an invalid value.\r\n * @param value - The W3c trace Id to be validated\r\n * @returns true if valid otherwise false\r\n */\r\nexport function isValidTraceId(value) {\r\n return _isValid(value, 32, INVALID_TRACE_ID);\r\n}\r\n/**\r\n * Is the provided W3c span id (aka. parent id) a valid string representation, it must be a 16-character\r\n * string of lowercase hexadecimal characters, for example, 00f067aa0ba902b7.\r\n * If all characters are zero (0000000000000000) this is considered an invalid value.\r\n * @param value - The W3c span id to be validated\r\n * @returns true if valid otherwise false\r\n */\r\nexport function isValidSpanId(value) {\r\n return _isValid(value, 16, INVALID_SPAN_ID);\r\n}\r\n/**\r\n * Validates that the provided ITraceParent instance conforms to the currently supported specifications\r\n * @param value\r\n * @returns\r\n */\r\nexport function isValidTraceParent(value) {\r\n if (!value ||\r\n !_isValid(value.version, 2, INVALID_VERSION) ||\r\n !_isValid(value.traceId, 32, INVALID_TRACE_ID) ||\r\n !_isValid(value.spanId, 16, INVALID_SPAN_ID) ||\r\n !_isValid(_formatFlags(value.traceFlags), 2)) {\r\n // Each known field must contain a valid value\r\n return false;\r\n }\r\n return true;\r\n}\r\n/**\r\n * Is the parsed traceParent indicating that the trace is currently sampled.\r\n * @param value - The parsed traceParent value\r\n * @returns\r\n */\r\nexport function isSampledFlag(value) {\r\n if (isValidTraceParent(value)) {\r\n return (value.traceFlags & SAMPLED_FLAG) === SAMPLED_FLAG;\r\n }\r\n return false;\r\n}\r\n/**\r\n * Format the ITraceParent value as a string using the supported and know version formats.\r\n * So even if the passed traceParent is a later version the string value returned from this\r\n * function will convert it to only the known version formats.\r\n * This currently only supports version \"00\" and invalid \"ff\"\r\n * @param value - The parsed traceParent value\r\n * @returns\r\n */\r\nexport function formatTraceParent(value) {\r\n if (value) {\r\n // Special Note: This only supports formatting as version 00, future versions should encode any known supported version\r\n // So parsing a future version will populate the correct version value but reformatting will reduce it to version 00.\r\n var flags = _formatFlags(value.traceFlags);\r\n if (!_isValid(flags, 2)) {\r\n flags = \"01\";\r\n }\r\n var version = value.version || DEFAULT_VERSION;\r\n if (version !== \"00\" && version !== \"ff\") {\r\n // Reduce version to \"00\"\r\n version = DEFAULT_VERSION;\r\n }\r\n // Format as version 00\r\n return \"\".concat(version, \"-\").concat(_formatValue(value.traceId, 32, INVALID_TRACE_ID), \"-\").concat(_formatValue(value.spanId, 16, INVALID_SPAN_ID), \"-\").concat(flags);\r\n }\r\n return \"\";\r\n}\r\n/**\r\n * Helper function to fetch the passed traceparent from the page, looking for it as a meta-tag or a Server-Timing header.\r\n * @returns\r\n */\r\nexport function findW3cTraceParent() {\r\n var traceParent;\r\n var doc = getDocument();\r\n if (doc) {\r\n // Look for a meta-tag called \"traceparent\"\r\n traceParent = parseTraceParent(_getTraceParentValue(doc.querySelectorAll(\"meta\")).content);\r\n }\r\n if (!traceParent) {\r\n var perf = getPerformance();\r\n if (perf) {\r\n // Try looking for a server-timing header\r\n var navPerf = perf.getEntriesByType(\"navigation\") || [];\r\n traceParent = parseTraceParent(_getTraceParentValue((navPerf.length > 0 ? navPerf[0] : {}).serverTiming).description);\r\n }\r\n }\r\n return traceParent;\r\n}\r\n//# sourceMappingURL=W3cTraceParent.js.map"],"names":[],"mappings":";;;;AAAA;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;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;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;AACA"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This interface represents the components of a W3C traceparent header
|
|
6
|
-
*/
|
|
7
|
-
export interface ITraceParent {
|
|
8
|
-
/**
|
|
9
|
-
* The version of the definition, this MUST be a string with a length of 2 and only contain lowercase
|
|
10
|
-
* hexadecimal characters. A value of 'ff' is considered to be an invalid version.
|
|
11
|
-
*/
|
|
12
|
-
version: string;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* This is the ID of the whole trace forest and is used to uniquely identify a distributed trace
|
|
16
|
-
* through a system. It is represented as a 32-character string of lowercase hexadecimal characters,
|
|
17
|
-
* for example, 4bf92f3577b34da6a3ce929d0e0e4736.
|
|
18
|
-
* All characters as zero (00000000000000000000000000000000) is considered an invalid value.
|
|
19
|
-
*/
|
|
20
|
-
traceId: string;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* This is the ID of the current request as known by the caller (in some tracing systems, this is also
|
|
24
|
-
* known as the parent-id, where a span is the execution of a client request). It is represented as an
|
|
25
|
-
* 16-character string of lowercase hexadecimal characters, for example, 00f067aa0ba902b7.
|
|
26
|
-
* All bytes as zero (0000000000000000) is considered an invalid value.
|
|
27
|
-
*/
|
|
28
|
-
spanId: string;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* An 8-bit value of flags that controls tracing such as sampling, trace level, etc. These flags are
|
|
32
|
-
* recommendations given by the caller rather than strict rules to follow.
|
|
33
|
-
* As this is a bit field, you cannot interpret flags by decoding the hex value and looking at the resulting
|
|
34
|
-
* number. For example, a flag 00000001 could be encoded as 01 in hex, or 09 in hex if present with the flag
|
|
35
|
-
* 00001000. A common mistake in bit fields is forgetting to mask when interpreting flags.
|
|
36
|
-
*/
|
|
37
|
-
traceFlags: number;
|
|
38
|
-
}
|