@instana/core
Advanced tools
Comparing version 1.138.0 to 2.0.0-rc.0
@@ -6,2 +6,43 @@ # Change Log | ||
# [2.0.0-rc.0](https://github.com/instana/nodejs/compare/v1.138.0...v2.0.0-rc.0) (2022-03-08) | ||
### chore | ||
* removed disableAutomaticTracing legacy config ([#432](https://github.com/instana/nodejs/issues/432)) ([c8f6cef](https://github.com/instana/nodejs/commit/c8f6cef241c8b9f1b06ff6fe6de70386d6086e6f)) | ||
* removed legacy support for config.timeBetweenHealthcheckCalls ([#476](https://github.com/instana/nodejs/issues/476)) ([4c4f894](https://github.com/instana/nodejs/commit/4c4f894f9308da8fe3503585a7feac8a108a75af)) | ||
### Code Refactoring | ||
* remove npm package instana-nodejs-sensor ([bebfc2d](https://github.com/instana/nodejs/commit/bebfc2da9989ade98034e5a1ae87e0a0bd43a5d8)) | ||
### Features | ||
* added asynclocalstorage implementation ([#430](https://github.com/instana/nodejs/issues/430)) ([fe86e3a](https://github.com/instana/nodejs/commit/fe86e3a32592a98de9cb869916435e45db07a1ea)) | ||
* self-disable if detected Node.js runtime version is too old ([d934d37](https://github.com/instana/nodejs/commit/d934d37e1f56ea5b877f39e699054c1e4b675dd1)) | ||
### BREAKING CHANGES | ||
* Removed support for legacy config `instana({ timeBetweenHealthcheckCalls: ... })`. | ||
Use `instana({ metrics: { timeBetweenHealthcheckCalls: ...}})`. | ||
Co-authored-by: kirrg001 <katharina.irrgang@gmail.com> | ||
* Starting with version 2.0.0, consumers of the package who | ||
still use the deprecated package name instana-nodejs-sensor will need to follow | ||
https://www.ibm.com/docs/en/obi/current?topic=nodejs-collector-installation#change-of-package-name | ||
to receive updates in the future. | ||
refs 80206 | ||
* Removed "disableAutomaticTracing" config option. | ||
Use `instana({ automaticTracingEnabled: Boolean })`. | ||
Co-authored-by: kirrg001 <katharina.irrgang@gmail.com> | ||
# [1.138.0](https://github.com/instana/nodejs/compare/v1.137.5...v1.138.0) (2022-02-08) | ||
@@ -8,0 +49,0 @@ |
{ | ||
"name": "@instana/core", | ||
"version": "1.138.0", | ||
"version": "2.0.0-rc.0", | ||
"description": "Core library for Instana's Node.js packages", | ||
@@ -33,3 +33,2 @@ "main": "src/index.js", | ||
"performance", | ||
"sensor", | ||
"tracing" | ||
@@ -141,3 +140,3 @@ ], | ||
}, | ||
"gitHead": "ec183a8bde1766a97bc2ee10af4326aeffb5ac87" | ||
"gitHead": "040c7b2ab701f2a16ba25b12f684ff9ecc8023eb" | ||
} |
@@ -352,13 +352,15 @@ /* | ||
* Get the currently active span. | ||
* @param {boolean} [fallbackToSharedContext=false] | ||
* @returns {InstanaSpan} | ||
*/ | ||
function getCurrentSpan() { | ||
return ns.get(currentSpanKey); | ||
function getCurrentSpan(fallbackToSharedContext = false) { | ||
return ns.get(currentSpanKey, fallbackToSharedContext); | ||
} | ||
/* | ||
/** | ||
* Get the reduced backup of the last active span in this cls context. | ||
* @param {boolean} [fallbackToSharedContext=false] | ||
*/ | ||
function getReducedSpan() { | ||
return ns.get(reducedSpanKey); | ||
function getReducedSpan(fallbackToSharedContext = false) { | ||
return ns.get(reducedSpanKey, fallbackToSharedContext); | ||
} | ||
@@ -365,0 +367,0 @@ |
@@ -38,9 +38,12 @@ /* | ||
* that is appropriate for the version of on nodejs that is running. | ||
* Node < v8 - uses AsyncWrap and async-hooks-jl | ||
* Node 12.17 - 16.6 - uses native AsyncLocalStorage. See below: | ||
* There is a bug introduced in Node 16.7 which breaks Async LS: https://github.com/nodejs/node/issues/40693 | ||
* Async LS fix introduced in v17.2: https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V17.md#commits-5 | ||
* Async LS fix introduced in v16.14: https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V16.md#commits | ||
* Node >= v8 - uses native async-hooks | ||
*/ | ||
if (process && semver.gte(process.versions.node, '8.0.0')) { | ||
if (process && semver.satisfies(process.versions.node, '12.17 - 16.6 || ^16.14 || >=17.2')) { | ||
module.exports = require('./async_local_storage_context'); | ||
} else { | ||
module.exports = require('./context'); | ||
} else { | ||
module.exports = require('./context-legacy'); | ||
} |
@@ -101,3 +101,3 @@ /* | ||
) { | ||
const activeEntrySpan = cls.getCurrentSpan(); | ||
const activeEntrySpan = cls.getCurrentSpan(true); | ||
let span; | ||
@@ -169,3 +169,9 @@ if (activeEntrySpan && activeEntrySpan.k === constants.ENTRY && activeEntrySpan.n !== 'graphql.server') { | ||
} | ||
const parentSpan = cls.getCurrentSpan() || cls.getReducedSpan(); | ||
/** | ||
* We pass `fallbackToSharedContext: true` to access the GraphQL query context, | ||
* which then triggered this subscription query. We need to connect them. | ||
*/ | ||
const parentSpan = cls.getCurrentSpan(true) || cls.getReducedSpan(true); | ||
if (parentSpan && !constants.isExitSpan(parentSpan) && parentSpan.t && parentSpan.s) { | ||
@@ -172,0 +178,0 @@ return cls.ns.runAndReturn(() => { |
@@ -8,3 +8,3 @@ /* | ||
const semver = require('semver'); | ||
const http2 = require('http2'); | ||
@@ -23,14 +23,8 @@ const cls = require('../../cls'); | ||
const sentHeadersS = 'Symbol(sent-headers)'; | ||
let HTTP2_HEADER_METHOD; | ||
let HTTP2_HEADER_PATH; | ||
let HTTP2_HEADER_STATUS; | ||
const HTTP2_HEADER_METHOD = http2.constants.HTTP2_HEADER_METHOD; | ||
const HTTP2_HEADER_PATH = http2.constants.HTTP2_HEADER_PATH; | ||
const HTTP2_HEADER_STATUS = http2.constants.HTTP2_HEADER_STATUS; | ||
exports.init = function init(config) { | ||
if (semver.gte(process.versions.node, '8.8.0')) { | ||
const http2 = require('http2'); | ||
HTTP2_HEADER_METHOD = http2.constants.HTTP2_HEADER_METHOD; | ||
HTTP2_HEADER_PATH = http2.constants.HTTP2_HEADER_PATH; | ||
HTTP2_HEADER_STATUS = http2.constants.HTTP2_HEADER_STATUS; | ||
instrument(http2); | ||
} | ||
instrument(http2); | ||
extraHttpHeadersToCapture = config.tracing.http.extraHttpHeadersToCapture; | ||
@@ -37,0 +31,0 @@ }; |
@@ -8,3 +8,4 @@ /* | ||
const semver = require('semver'); | ||
const http2 = require('http2'); | ||
const shimmer = require('shimmer'); | ||
@@ -15,3 +16,2 @@ const cls = require('../../cls'); | ||
const readSymbolProperty = require('../../../util/readSymbolProperty'); | ||
const shimmer = require('shimmer'); | ||
const tracingHeaders = require('../../tracingHeaders'); | ||
@@ -26,16 +26,9 @@ const { filterParams, sanitizeUrl } = require('../../../util/url'); | ||
const sentHeadersS = 'Symbol(sent-headers)'; | ||
let HTTP2_HEADER_AUTHORITY; | ||
let HTTP2_HEADER_METHOD; | ||
let HTTP2_HEADER_PATH; | ||
let HTTP2_HEADER_STATUS; | ||
const HTTP2_HEADER_AUTHORITY = http2.constants.HTTP2_HEADER_AUTHORITY; | ||
const HTTP2_HEADER_METHOD = http2.constants.HTTP2_HEADER_METHOD; | ||
const HTTP2_HEADER_PATH = http2.constants.HTTP2_HEADER_PATH; | ||
const HTTP2_HEADER_STATUS = http2.constants.HTTP2_HEADER_STATUS; | ||
exports.init = function init(config) { | ||
if (semver.gte(process.versions.node, '8.8.0')) { | ||
const http2 = require('http2'); | ||
HTTP2_HEADER_AUTHORITY = http2.constants.HTTP2_HEADER_AUTHORITY; | ||
HTTP2_HEADER_METHOD = http2.constants.HTTP2_HEADER_METHOD; | ||
HTTP2_HEADER_PATH = http2.constants.HTTP2_HEADER_PATH; | ||
HTTP2_HEADER_STATUS = http2.constants.HTTP2_HEADER_STATUS; | ||
instrument(http2); | ||
} | ||
instrument(http2); | ||
extraHttpHeadersToCapture = config.tracing.http.extraHttpHeadersToCapture; | ||
@@ -42,0 +35,0 @@ }; |
@@ -10,4 +10,2 @@ /* | ||
const coreHttpsModule = require('https'); | ||
const semver = require('semver'); | ||
const URL = require('url').URL; | ||
@@ -27,16 +25,4 @@ | ||
instrument(coreHttpModule, false); | ||
instrument(coreHttpsModule, true); | ||
// Up until Node 8, the core https module uses the http module internally, so https calls are traced automatically | ||
// without instrumenting https. Beginning with Node 9, the core https module started to use the internal core module | ||
// _http_client directly rather than going through the http module. Therefore, beginning with Node 9, explicit | ||
// instrumentation of the core https module is required. OTOH, in Node <= 8, we must _not_ instrument https, as | ||
// otherwise we would run our instrumentation code twice (once for https.request and once for http.request). | ||
// In case you wonder about the process.versions.node === '8.9.0' and if it shouldn't rather be something like | ||
// semver.gte(process.version.node, '8.9.0') – no, it should not. Node had backported the refactoring to use | ||
// _http_client directly in https (instead of going through http) from Node.js 9.0.0 to Node.js 8.9.0, only to revert | ||
// that immediately in Node.js 8.9.1 a few days later. So we must only apply this for exactly 8.9.0, but for no other | ||
// 8.x.x version. | ||
if (semver.gte(process.versions.node, '9.0.0') || process.versions.node === '8.9.0') { | ||
instrument(coreHttpsModule, true); | ||
} | ||
extraHttpHeadersToCapture = config.tracing.http.extraHttpHeadersToCapture; | ||
@@ -43,0 +29,0 @@ }; |
@@ -12,3 +12,3 @@ /* | ||
module.exports = exports = function supportedVersion(version) { | ||
return semver.satisfies(version, '^6 || ^7 || ^8.2.1 || ^9.1.0 || ^10.4.0 || ^11 || >=12.0.0'); | ||
return semver.satisfies(version, '^10.4.0 || ^11 || >=12.0.0'); | ||
}; |
@@ -8,11 +8,5 @@ /* | ||
const semver = require('semver'); | ||
// This is no longer used as of release 1.110.3, but apparently there are setups where the version of @instana/collector | ||
// and @instana/core do not match, so we need to keep this around for a while for backwards compatibility. | ||
// Node.js 0.12 is lacking support for Buffer.from, | ||
// and < 4.5.0 version Buffer.from doesn't support string as parameter | ||
const suppotsBufferFrom = Buffer.from && semver.satisfies(process.versions.node, '>=4.5.0'); | ||
/** | ||
@@ -23,7 +17,3 @@ * @param {string} str | ||
exports.fromString = function fromString(str, encoding = 'utf8') { | ||
if (suppotsBufferFrom) { | ||
return Buffer.from(str, encoding); | ||
} | ||
// eslint-disable-next-line no-buffer-constructor | ||
return new Buffer(str, encoding); | ||
return Buffer.from(str, encoding); | ||
}; |
@@ -24,3 +24,2 @@ /* | ||
* @property {boolean} [spanBatchingEnabled] | ||
* @property {boolean} [disableAutomaticTracing] | ||
* @property {boolean} [disableW3cTraceCorrelation] | ||
@@ -161,9 +160,4 @@ * @property {KafkaTracingOptions} [kafka] | ||
// The correct location for this is config.metrics.timeBetweenHealthcheckCalls but previous versions accepted | ||
// config.timeBetweenHealthcheckCalls. We still accept that to not break applications relying on that. | ||
config.metrics.timeBetweenHealthcheckCalls = | ||
config.metrics.timeBetweenHealthcheckCalls || | ||
config.timeBetweenHealthcheckCalls || | ||
defaults.metrics.timeBetweenHealthcheckCalls; | ||
delete config.timeBetweenHealthcheckCalls; | ||
config.metrics.timeBetweenHealthcheckCalls || defaults.metrics.timeBetweenHealthcheckCalls; | ||
} | ||
@@ -206,3 +200,2 @@ | ||
config.tracing.enabled = false; | ||
delete config.tracing.disableAutomaticTracing; | ||
return; | ||
@@ -224,6 +217,5 @@ } | ||
if (config.tracing.automaticTracingEnabled === false || config.tracing.disableAutomaticTracing) { | ||
if (config.tracing.automaticTracingEnabled === false) { | ||
logger.info('Not enabling automatic tracing as it is explicitly disabled via config.'); | ||
config.tracing.automaticTracingEnabled = false; | ||
delete config.tracing.disableAutomaticTracing; | ||
return; | ||
@@ -237,3 +229,2 @@ } | ||
config.tracing.automaticTracingEnabled = false; | ||
delete config.tracing.disableAutomaticTracing; | ||
return; | ||
@@ -240,0 +231,0 @@ } |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
574553
111
15907
1
35