Comparing version 0.7.1 to 0.7.2
@@ -1,1 +0,1 @@ | ||
module.exports = '0.7.1' | ||
module.exports = '0.7.2' |
{ | ||
"name": "dd-trace", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"description": "Datadog APM tracing client for JavaScript", | ||
@@ -12,6 +12,6 @@ "main": "index.js", | ||
"services": "node ./scripts/install_plugin_modules && node test/setup/services", | ||
"tdd": "yarn services && mocha --watch 'test/setup/**/*.js'", | ||
"test": "yarn services && cov8 --include \"src/**/*.js\" -- mocha --exit 'test/setup/all.js' 'test/**/*.spec.js'", | ||
"tdd": "yarn services && NO_DEPRECATION=* mocha --watch 'test/setup/**/*.js'", | ||
"test": "yarn services && NO_DEPRECATION=* cov8 --include \"src/**/*.js\" -- mocha --exit 'test/setup/all.js' 'test/**/*.spec.js'", | ||
"test:core": "mocha --exit --exclude \"test/plugins/**/*.spec.js\" --file test/setup/core.js \"test/**/*.spec.js\"", | ||
"test:plugins": "yarn services && cov8 --include \"src/**/*.js\" -- mocha --exit --file \"test/setup/all.js\" \"test/plugins/@($(echo $PLUGINS)).spec.js\" \"test/plugins/@($(echo $PLUGINS))/**/*.spec.js\"", | ||
"test:plugins": "yarn services && NO_DEPRECATION=* cov8 --include \"src/**/*.js\" -- mocha --exit --file \"test/setup/all.js\" \"test/plugins/@($(echo $PLUGINS)).spec.js\" \"test/plugins/@($(echo $PLUGINS))/**/*.spec.js\"", | ||
"leak:core": "node ./scripts/install_plugin_modules && (cd test/leak && yarn) && NODE_PATH=./test/leak/node_modules node --no-warnings ./node_modules/.bin/tape 'test/leak/{,!(node_modules|plugins)/**/}/*.js'", | ||
@@ -18,0 +18,0 @@ "leak:plugins": "yarn services && (cd test/leak && yarn) && NODE_PATH=./test/leak/node_modules node --no-warnings ./node_modules/.bin/tape \"test/leak/plugins/@($(echo $PLUGINS)).js\"" |
@@ -117,11 +117,5 @@ 'use strict' | ||
promise.then(() => finish(span), e => finish(span, e)) | ||
return promise | ||
.then(() => { | ||
finish(span) | ||
return promise | ||
}) | ||
.catch(err => { | ||
finish(span, err) | ||
return promise | ||
}) | ||
} | ||
@@ -128,0 +122,0 @@ |
@@ -30,16 +30,5 @@ 'use strict' | ||
} else { | ||
const result = request.apply(this, arguments) | ||
const promise = new Promise((resolve, reject) => { | ||
result | ||
.then(function () { | ||
finish(span) | ||
resolve.apply(this, arguments) | ||
}) | ||
.catch(function (e) { | ||
finish(span, e) | ||
reject.apply(this, arguments) | ||
}) | ||
}) | ||
const promise = request.apply(this, arguments) | ||
promise.abort = result.abort | ||
promise.then(() => finish(span), e => finish(span, e)) | ||
@@ -46,0 +35,0 @@ return promise |
@@ -76,3 +76,3 @@ 'use strict' | ||
function wrapFields (type, tracer, config, responsePathAsArray) { | ||
if (!type || type._datadog_patched) { | ||
if (!type || !type._fields || type._datadog_patched) { | ||
return | ||
@@ -90,9 +90,9 @@ } | ||
if (field.type) { | ||
if (field.type._fields) { | ||
wrapFields(field.type, tracer, config, responsePathAsArray) | ||
} else if (field.type.ofType && field.type.ofType._fields) { | ||
wrapFields(field.type.ofType, tracer, config, responsePathAsArray) | ||
} | ||
let unwrappedType = field.type | ||
while (unwrappedType.ofType) { | ||
unwrappedType = unwrappedType.ofType | ||
} | ||
wrapFields(unwrappedType, tracer, config, responsePathAsArray) | ||
}) | ||
@@ -145,14 +145,6 @@ } | ||
try { | ||
let result = fn.apply(thisContext, args) | ||
const result = fn.apply(thisContext, args) | ||
if (result && typeof result.then === 'function') { | ||
result = result | ||
.then(value => { | ||
callback(null, value) | ||
return value | ||
}) | ||
.catch(err => { | ||
callback(err) | ||
return Promise.reject(err) | ||
}) | ||
result.then(value => callback(null, value), callback) | ||
} else { | ||
@@ -159,0 +151,0 @@ callback(null, result) |
@@ -15,3 +15,3 @@ 'use strict' | ||
return function wrapUse (use) { | ||
return function useWithTrace (fn) { | ||
return function useWithTrace () { | ||
if (!this._datadog_trace_patched) { | ||
@@ -22,6 +22,11 @@ this._datadog_trace_patched = true | ||
return use.call(this, function (ctx, next) { | ||
const result = use.apply(this, arguments) | ||
const fn = this.middleware.pop() | ||
this.middleware.push(function (ctx, next) { | ||
web.reactivate(ctx.req) | ||
return fn.apply(this, arguments) | ||
}) | ||
return result | ||
} | ||
@@ -28,0 +33,0 @@ } |
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
128699
3646