@instana/core
Advanced tools
Comparing version 1.67.1 to 1.67.2
{ | ||
"name": "@instana/core", | ||
"version": "1.67.1", | ||
"version": "1.67.2", | ||
"description": "Core library for Instana's Node.js packages", | ||
@@ -111,3 +111,2 @@ "main": "src/index.js", | ||
"emitter-listener": "^1.1.2", | ||
"event-loop-lag": "^1.4.0", | ||
"methods": "^1.1.2", | ||
@@ -119,6 +118,2 @@ "opentracing": "^0.14.3", | ||
}, | ||
"optionalDependencies": { | ||
"event-loop-stats": "1.1.0", | ||
"gcstats.js": "1.0.0" | ||
}, | ||
"devDependencies": { | ||
@@ -131,3 +126,3 @@ "eslint": "^4.19.1", | ||
}, | ||
"gitHead": "90bf48ae5e18b9ffa22004819e485a90c8a3eb04" | ||
"gitHead": "aaf57f2d78c2a9c989c2052b52e7eae3343da4e5" | ||
} |
@@ -56,10 +56,28 @@ 'use strict'; | ||
if (opts.beforeHandler) { | ||
var originalBeforeHandler = opts.beforeHandler; | ||
opts.beforeHandler = function shimmedBeforeHandler() { | ||
annotateHttpEntrySpanWithPathTemplate(app, opts); | ||
return originalBeforeHandler.apply(this, arguments); | ||
}; | ||
var preHandler; | ||
var preHandlerKey; | ||
if (opts.preHandler) { | ||
// In Fastify 2.x, the attribute is called preHandler. | ||
preHandler = opts.preHandler; | ||
preHandlerKey = 'preHandler'; | ||
} else if (opts.beforeHandler) { | ||
// In Fastify 1.x, the attribute is called beforeHandler. | ||
preHandler = opts.beforeHandler; | ||
preHandlerKey = 'beforeHandler'; | ||
} | ||
if (preHandler) { | ||
if (typeof preHandler === 'function') { | ||
opts[preHandlerKey] = function shimmedPreHandler() { | ||
annotateHttpEntrySpanWithPathTemplate(app, opts); | ||
return preHandler.apply(this, arguments); | ||
}; | ||
} else if (Array.isArray(preHandler)) { | ||
opts[preHandlerKey].unshift(function prependedBeforeHandler(request, reply, done) { | ||
annotateHttpEntrySpanWithPathTemplate(app, opts); | ||
done(); | ||
}); | ||
} | ||
} | ||
return originalRoute.apply(this, arguments); | ||
@@ -66,0 +84,0 @@ }; |
@@ -116,3 +116,3 @@ 'use strict'; | ||
function setHeaders(map, span) { | ||
if (!map || !map.headers || map.headers[constants.traceLevelHeaderName]) { | ||
if (!map || !map.headers || tracingUtil.readAttribCaseInsensitive(map.headers, constants.traceLevelHeaderName)) { | ||
return; | ||
@@ -163,3 +163,3 @@ } | ||
return cls.ns.runAndReturn(function() { | ||
if (headers && headers[constants.traceLevelHeaderName] === '0') { | ||
if (tracingUtil.readAttribCaseInsensitive(headers, constants.traceLevelHeaderName) === '0') { | ||
cls.setTracingLevel('0'); | ||
@@ -172,4 +172,4 @@ return originalDispatchMessage.apply(ctx, originalArgs); | ||
constants.ENTRY, | ||
headers[constants.traceIdHeaderName], | ||
headers[constants.spanIdHeaderName] | ||
tracingUtil.readAttribCaseInsensitive(headers, constants.traceIdHeaderName), | ||
tracingUtil.readAttribCaseInsensitive(headers, constants.spanIdHeaderName) | ||
); | ||
@@ -240,15 +240,15 @@ span.ts = Date.now(); | ||
if (headers) { | ||
var traceId = headers[constants.traceIdHeaderName]; | ||
var parentId = headers[constants.spanIdHeaderName]; | ||
if (traceId && parentId) { | ||
span.t = traceId; | ||
span.p = parentId; | ||
} | ||
if (headers[constants.traceLevelHeaderName] === '0') { | ||
cls.setTracingLevel('0'); | ||
return result; | ||
} | ||
if (tracingUtil.readAttribCaseInsensitive(headers, constants.traceLevelHeaderName) === '0') { | ||
cls.setTracingLevel('0'); | ||
span.cancel(); | ||
return result; | ||
} | ||
var traceId = tracingUtil.readAttribCaseInsensitive(headers, constants.traceIdHeaderName); | ||
var parentSpanId = tracingUtil.readAttribCaseInsensitive(headers, constants.spanIdHeaderName); | ||
if (traceId && parentSpanId) { | ||
span.t = traceId; | ||
span.p = parentSpanId; | ||
} | ||
span.ts = Date.now(); | ||
@@ -328,22 +328,19 @@ span.stack = tracingUtil.getStackTrace(instrumentedChannelModelGet); | ||
return cls.ns.runAndReturn(function() { | ||
var span = cls.startSpan('rabbitmq', constants.ENTRY); | ||
var fields = result.fields || {}; | ||
var headers = result.properties && result.properties.headers ? result.properties.headers : {}; | ||
if (headers) { | ||
var traceId = headers[constants.traceIdHeaderName]; | ||
var parentId = headers[constants.spanIdHeaderName]; | ||
if (traceId && parentId) { | ||
span.t = traceId; | ||
span.p = parentId; | ||
if (tracingUtil.readAttribCaseInsensitive(headers, constants.traceLevelHeaderName) === '0') { | ||
cls.setTracingLevel('0'); | ||
if (originalCallback) { | ||
return originalCallback(err, result); | ||
} | ||
if (headers[constants.traceLevelHeaderName] === '0') { | ||
cls.setTracingLevel('0'); | ||
if (originalCallback) { | ||
return originalCallback(err, result); | ||
} | ||
return; | ||
} | ||
return; | ||
} | ||
var span = cls.startSpan( | ||
'rabbitmq', | ||
constants.ENTRY, | ||
tracingUtil.readAttribCaseInsensitive(headers, constants.traceIdHeaderName), | ||
tracingUtil.readAttribCaseInsensitive(headers, constants.spanIdHeaderName) | ||
); | ||
span.ts = Date.now(); | ||
@@ -350,0 +347,0 @@ span.stack = tracingUtil.getStackTrace(instrumentedChannelModelGet); |
@@ -353,2 +353,4 @@ 'use strict'; | ||
function readMetadata(metadata, key) { | ||
// The grpc library normalizes keys internally to lower-case, so we do not need to take care of reading | ||
// them case-insensitive ourselves. | ||
var values = metadata.get(key); | ||
@@ -355,0 +357,0 @@ if (values && values.length > 0) { |
@@ -93,1 +93,15 @@ 'use strict'; | ||
}; | ||
exports.readAttribCaseInsensitive = function readAttribCaseInsensitive(object, key) { | ||
if (!object || typeof object !== 'object' || typeof key !== 'string') { | ||
return null; | ||
} | ||
var keyUpper = key.toUpperCase(); | ||
var allKeys = Object.keys(object); | ||
for (var i = 0; i < allKeys.length; i++) { | ||
if (typeof allKeys[i] === 'string' && allKeys[i].toUpperCase() === keyUpper) { | ||
return object[allKeys[i]]; | ||
} | ||
} | ||
return null; | ||
}; |
@@ -10,3 +10,4 @@ 'use strict'; | ||
requireHook: require('./requireHook'), | ||
slidingWindow: require('./slidingWindow'), | ||
stackTrace: require('./stackTrace') | ||
}; |
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
285633
8
77
6365
- Removedevent-loop-lag@^1.4.0
- Removeddebug@3.2.7(transitive)
- Removedevent-loop-lag@1.4.0(transitive)
- Removedevent-loop-stats@1.1.0(transitive)
- Removedgcstats.js@1.0.0(transitive)
- Removedms@2.1.3(transitive)
- Removednan@2.22.0(transitive)