Socket
Socket
Sign inDemoInstall

dd-trace

Package Overview
Dependencies
19
Maintainers
3
Versions
558
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.0 to 0.6.1-beta.0

test/leak/node_modules/@airbnb/node-memwatch/.travis.yml

2

lib/version.js

@@ -1,1 +0,1 @@

module.exports = '0.6.0'
module.exports = '0.6.1-beta.0'
{
"name": "dd-trace",
"version": "0.6.0",
"version": "0.6.1-beta.0",
"description": "Datadog APM tracing client for JavaScript",

@@ -12,3 +12,3 @@ "main": "index.js",

"tdd": "node ./scripts/install_plugin_modules && mocha --watch",
"test": "node ./scripts/install_plugin_modules && nyc --reporter text --reporter lcov mocha 'test/**/*.spec.js'",
"test": "node ./scripts/install_plugin_modules && nyc --reporter text --reporter lcov mocha --exit 'test/**/*.spec.js'",
"leak": "(cd test/leak && yarn) && NODE_PATH=./test/leak/node_modules node --no-warnings ./node_modules/.bin/tape 'test/leak/{,!(node_modules)/**/}/*.js'"

@@ -42,2 +42,3 @@ },

"lodash.memoize": "^4.1.2",
"lodash.pick": "^4.4.0",
"lodash.uniq": "^4.5.0",

@@ -44,0 +45,0 @@ "methods": "^1.1.2",

'use strict'
const pick = require('lodash.pick')
const Uint64BE = require('int64-buffer').Uint64BE
const DatadogSpanContext = require('../span_context')
const log = require('../../log')

@@ -11,2 +13,3 @@ const traceKey = 'x-datadog-trace-id'

const baggageExpr = new RegExp(`^${baggagePrefix}(.+)$`)
const logKeys = [traceKey, spanKey, samplingKey]

@@ -20,2 +23,4 @@ class TextMapPropagator {

this._injectBaggageItems(spanContext, carrier)
log.debug(() => `Inject into carrier: ${JSON.stringify(pick(carrier, logKeys))}.`)
}

@@ -36,2 +41,4 @@

log.debug(() => `Extract from carrier: ${JSON.stringify(pick(carrier, logKeys))}.`)
return spanContext

@@ -38,0 +45,0 @@ }

@@ -25,2 +25,25 @@ 'use strict'

function createWrapExecute (tracer, config) {
config = web.normalizeConfig(config)
return function wrapExecute (execute) {
return function executeWithTrace () {
const req = this.raw.req
const res = this.raw.res
let returnValue
web.instrument(tracer, config, req, res, 'hapi.request', () => {
returnValue = execute.apply(this, arguments)
web.beforeEnd(req, () => {
web.enterRoute(req, this.route.path)
})
})
return returnValue
}
}
}
module.exports = [

@@ -40,3 +63,3 @@ {

name: 'hapi',
versions: ['<17.1'],
versions: ['8.5 - 17.0'],
file: 'lib/request.js',

@@ -49,3 +72,14 @@ patch (Generator, tracer, config) {

}
},
{
name: 'hapi',
versions: ['2 - 8.4'],
file: 'lib/request.js',
patch (Request, tracer, config) {
this.wrap(Request.prototype, '_execute', createWrapExecute(tracer, config))
},
unpatch (Request) {
this.unwrap(Request.prototype, '_execute')
}
}
]

@@ -5,2 +5,3 @@ 'use strict'

const getPort = require('get-port')
const semver = require('semver')
const agent = require('./agent')

@@ -16,2 +17,3 @@ const plugin = require('../../src/plugins/hapi')

let port
let handler

@@ -22,9 +24,7 @@ describe('hapi', () => {

tracer = require('../..')
handler = (request, h, body) => h.response ? h.response(body) : h(body)
})
afterEach(() => {
return Promise.all([
agent.close(),
server.stop()
])
return agent.close()
})

@@ -39,15 +39,44 @@

beforeEach(() => {
return getPort()
.then(_port => {
port = _port
server = Hapi.server({
address: '127.0.0.1',
port
if (semver.intersects(version, '>=17')) {
beforeEach(() => {
return getPort()
.then(_port => {
port = _port
server = Hapi.server({
address: '127.0.0.1',
port
})
return server.start()
})
})
return server.start()
})
})
afterEach(() => {
return server.stop()
})
} else {
beforeEach(done => {
getPort()
.then(_port => {
port = _port
if (Hapi.Server.prototype.connection) {
server = new Hapi.Server()
server.connection({ address: '127.0.0.1', port })
} else {
server = new Hapi.Server('127.0.0.1', port)
}
server.start(done)
})
})
afterEach(done => {
try {
server.stop()
} finally {
done()
}
})
}
it('should do automatic instrumentation on routes', done => {

@@ -57,3 +86,3 @@ server.route({

path: '/user/{id}',
handler: () => ''
handler
})

@@ -84,6 +113,6 @@

path: '/user/{id}',
handler: () => {
handler: (request, h) => {
expect(tracer.scopeManager().active()).to.not.be.null
done()
return ''
return handler(request, h)
}

@@ -106,6 +135,6 @@ })

done()
return ''
return handler(request, h)
}
],
handler: () => ''
handler
}

@@ -123,3 +152,3 @@ })

path: '/user/{id}',
handler: () => ''
handler
})

@@ -130,3 +159,10 @@

done()
return h.continue
if (typeof h === 'function') {
return h()
} else if (typeof h.continue === 'function') {
return h.continue()
} else {
return h.continue
}
})

@@ -143,3 +179,3 @@

path: '/user/{id}',
handler: () => ''
handler
})

@@ -183,4 +219,10 @@

path: '/user/{id}',
handler: () => {
throw new Error()
handler: (request, h) => {
const error = new Error()
if (typeof h === 'function') {
h(error)
} else {
throw error
}
}

@@ -187,0 +229,0 @@ })

@@ -199,3 +199,3 @@ 'use strict'

expect(span.context().tags).to.have.property([RESOURCE_NAME], 'GET /foo/bar')
expect(span.context().tags).to.have.property(RESOURCE_NAME, 'GET /foo/bar')
})

@@ -218,3 +218,3 @@ })

expect(span.context().tags).to.have.property([RESOURCE_NAME], 'GET /foo')
expect(span.context().tags).to.have.property(RESOURCE_NAME, 'GET /foo')
})

@@ -221,0 +221,0 @@ })

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc