@opentelemetry/instrumentation-document-load
Advanced tools
Comparing version 0.20.0 to 0.21.0
@@ -37,6 +37,2 @@ import { InstrumentationBase, InstrumentationConfig } from '@opentelemetry/instrumentation'; | ||
/** | ||
* gets performance entries of navigation | ||
*/ | ||
private _getEntries; | ||
/** | ||
* Creates and ends a span with network information about resource added as timed events | ||
@@ -43,0 +39,0 @@ * @param resource |
@@ -23,2 +23,3 @@ /* | ||
import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; | ||
import { addSpanPerformancePaintEvents, getPerformanceNavigationEntries, } from './utils'; | ||
/** | ||
@@ -67,3 +68,3 @@ * This class represents a document load plugin | ||
const metaElement = [...document.getElementsByTagName('meta')].find(e => e.getAttribute('name') === TRACE_PARENT_HEADER); | ||
const entries = this._getEntries(); | ||
const entries = getPerformanceNavigationEntries(); | ||
const traceparent = (metaElement && metaElement.content) || ''; | ||
@@ -96,2 +97,3 @@ context.with(propagation.extract(ROOT_CONTEXT, { traceparent }), () => { | ||
addSpanNetworkEvent(rootSpan, PTN.LOAD_EVENT_END, entries); | ||
addSpanPerformancePaintEvents(rootSpan); | ||
this._endSpan(rootSpan, PTN.LOAD_EVENT_END, entries); | ||
@@ -119,38 +121,2 @@ }); | ||
/** | ||
* gets performance entries of navigation | ||
*/ | ||
_getEntries() { | ||
var _a, _b; | ||
const entries = {}; | ||
const performanceNavigationTiming = (_b = (_a = otperformance).getEntriesByType) === null || _b === void 0 ? void 0 : _b.call(_a, 'navigation')[0]; | ||
if (performanceNavigationTiming) { | ||
const keys = Object.values(PTN); | ||
keys.forEach((key) => { | ||
if (hasKey(performanceNavigationTiming, key)) { | ||
const value = performanceNavigationTiming[key]; | ||
if (typeof value === 'number') { | ||
entries[key] = value; | ||
} | ||
} | ||
}); | ||
} | ||
else { | ||
// // fallback to previous version | ||
const perf = otperformance; | ||
const performanceTiming = perf.timing; | ||
if (performanceTiming) { | ||
const keys = Object.values(PTN); | ||
keys.forEach((key) => { | ||
if (hasKey(performanceTiming, key)) { | ||
const value = performanceTiming[key]; | ||
if (typeof value === 'number') { | ||
entries[key] = value; | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
return entries; | ||
} | ||
/** | ||
* Creates and ends a span with network information about resource added as timed events | ||
@@ -157,0 +123,0 @@ * @param resource |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.20.0"; | ||
export declare const VERSION = "0.21.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -17,3 +17,3 @@ /* | ||
// this is autogenerated file, see scripts/version-update.js | ||
export const VERSION = '0.20.0'; | ||
export const VERSION = '0.21.0'; | ||
//# sourceMappingURL=version.js.map |
@@ -37,6 +37,2 @@ import { InstrumentationBase, InstrumentationConfig } from '@opentelemetry/instrumentation'; | ||
/** | ||
* gets performance entries of navigation | ||
*/ | ||
private _getEntries; | ||
/** | ||
* Creates and ends a span with network information about resource added as timed events | ||
@@ -43,0 +39,0 @@ * @param resource |
@@ -26,2 +26,3 @@ "use strict"; | ||
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions"); | ||
const utils_1 = require("./utils"); | ||
/** | ||
@@ -70,3 +71,3 @@ * This class represents a document load plugin | ||
const metaElement = [...document.getElementsByTagName('meta')].find(e => e.getAttribute('name') === core_1.TRACE_PARENT_HEADER); | ||
const entries = this._getEntries(); | ||
const entries = utils_1.getPerformanceNavigationEntries(); | ||
const traceparent = (metaElement && metaElement.content) || ''; | ||
@@ -99,2 +100,3 @@ api_1.context.with(api_1.propagation.extract(api_1.ROOT_CONTEXT, { traceparent }), () => { | ||
web_1.addSpanNetworkEvent(rootSpan, web_1.PerformanceTimingNames.LOAD_EVENT_END, entries); | ||
utils_1.addSpanPerformancePaintEvents(rootSpan); | ||
this._endSpan(rootSpan, web_1.PerformanceTimingNames.LOAD_EVENT_END, entries); | ||
@@ -122,38 +124,2 @@ }); | ||
/** | ||
* gets performance entries of navigation | ||
*/ | ||
_getEntries() { | ||
var _a, _b; | ||
const entries = {}; | ||
const performanceNavigationTiming = (_b = (_a = core_1.otperformance).getEntriesByType) === null || _b === void 0 ? void 0 : _b.call(_a, 'navigation')[0]; | ||
if (performanceNavigationTiming) { | ||
const keys = Object.values(web_1.PerformanceTimingNames); | ||
keys.forEach((key) => { | ||
if (web_1.hasKey(performanceNavigationTiming, key)) { | ||
const value = performanceNavigationTiming[key]; | ||
if (typeof value === 'number') { | ||
entries[key] = value; | ||
} | ||
} | ||
}); | ||
} | ||
else { | ||
// // fallback to previous version | ||
const perf = core_1.otperformance; | ||
const performanceTiming = perf.timing; | ||
if (performanceTiming) { | ||
const keys = Object.values(web_1.PerformanceTimingNames); | ||
keys.forEach((key) => { | ||
if (web_1.hasKey(performanceTiming, key)) { | ||
const value = performanceTiming[key]; | ||
if (typeof value === 'number') { | ||
entries[key] = value; | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
return entries; | ||
} | ||
/** | ||
* Creates and ends a span with network information about resource added as timed events | ||
@@ -160,0 +126,0 @@ * @param resource |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.20.0"; | ||
export declare const VERSION = "0.21.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.20.0'; | ||
exports.VERSION = '0.21.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/instrumentation-document-load", | ||
"version": "0.20.0", | ||
"version": "0.21.0", | ||
"description": "OpenTelemetry document-load automatic instrumentation package.", | ||
@@ -49,6 +49,10 @@ "main": "build/src/index.js", | ||
}, | ||
"peerDependencies": { | ||
"@opentelemetry/api": "^0.21.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.14.3", | ||
"@babel/core": "7.14.5", | ||
"@opentelemetry/api": "0.21.0", | ||
"@types/mocha": "8.2.2", | ||
"@types/node": "14.17.2", | ||
"@types/node": "14.17.3", | ||
"@types/sinon": "10.0.2", | ||
@@ -74,14 +78,13 @@ "@types/webpack-env": "1.16.0", | ||
"webpack": "4.46.0", | ||
"webpack-cli": "4.7.0", | ||
"webpack-merge": "5.7.3" | ||
"webpack-cli": "4.7.2", | ||
"webpack-merge": "5.8.0" | ||
}, | ||
"dependencies": { | ||
"@opentelemetry/api": "^0.20.0", | ||
"@opentelemetry/core": "^0.20.0", | ||
"@opentelemetry/instrumentation": "^0.20.0", | ||
"@opentelemetry/semantic-conventions": "^0.20.0", | ||
"@opentelemetry/tracing": "^0.20.0", | ||
"@opentelemetry/web": "^0.20.0" | ||
"@opentelemetry/core": "^0.21.0", | ||
"@opentelemetry/instrumentation": "^0.21.0", | ||
"@opentelemetry/semantic-conventions": "^0.21.0", | ||
"@opentelemetry/tracing": "^0.21.0", | ||
"@opentelemetry/web": "^0.21.0" | ||
}, | ||
"gitHead": "5d73dc2d11a8fd57b21a0c6286861cb992556ca1" | ||
"gitHead": "621f0141e406b75ef11a77fb85ce8caab9c8a272" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
69743
51
818
0
26
+ Added@opentelemetry/api@0.21.0(transitive)
+ Added@opentelemetry/api-metrics@0.21.0(transitive)
+ Added@opentelemetry/core@0.21.0(transitive)
+ Added@opentelemetry/instrumentation@0.21.0(transitive)
+ Added@opentelemetry/resources@0.21.0(transitive)
+ Added@opentelemetry/semantic-conventions@0.21.0(transitive)
+ Added@opentelemetry/tracing@0.21.0(transitive)
+ Added@opentelemetry/web@0.21.0(transitive)
- Removed@opentelemetry/api@^0.20.0
- Removed@opentelemetry/api@0.20.0(transitive)
- Removed@opentelemetry/api-metrics@0.20.0(transitive)
- Removed@opentelemetry/core@0.20.0(transitive)
- Removed@opentelemetry/instrumentation@0.20.0(transitive)
- Removed@opentelemetry/resources@0.20.0(transitive)
- Removed@opentelemetry/semantic-conventions@0.20.0(transitive)
- Removed@opentelemetry/tracing@0.20.0(transitive)
- Removed@opentelemetry/web@0.20.0(transitive)
Updated@opentelemetry/core@^0.21.0
Updated@opentelemetry/web@^0.21.0