Socket
Socket
Sign inDemoInstall

dd-trace

Package Overview
Dependencies
Maintainers
3
Versions
579
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dd-trace - npm Package Compare versions

Comparing version 0.10.2 to 0.11.0-beta.0

index.d.ts

2

lib/version.js

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

module.exports = '0.10.2'
module.exports = '0.11.0-beta.0'
{
"name": "dd-trace",
"version": "0.10.2",
"version": "0.11.0-beta.0",
"description": "Datadog APM tracing client for JavaScript",
"main": "index.js",
"typings": "docs/index.d.ts",
"typings": "index.d.ts",
"scripts": {
"rebuild": "node-gyp rebuild",
"prebuild": "node scripts/prebuild.js",
"install": "node scripts/post_install.js",
"install:rebuild": "node-gyp-build",
"bench": "node benchmark",

@@ -43,2 +47,3 @@ "type:doc": "cd docs && yarn && yarn build",

"async-hook-jl": "^1.7.6",
"hot-shots": "^5.0.0",
"int64-buffer": "^0.1.9",

@@ -55,2 +60,4 @@ "koalas": "^1.0.2",

"msgpack-lite": "^0.1.26",
"nan": "^2.12.1",
"node-gyp-build": "^3.8.0",
"opentracing": ">=0.12.1",

@@ -65,2 +72,3 @@ "parent-module": "^0.1.0",

"shimmer": "^1.2.0",
"tar": "^4.4.8",
"url-parse": "^1.4.3"

@@ -85,2 +93,4 @@ },

"nock": "^9.6.1",
"node-abi": "^2.7.1",
"prebuildify": "^2.11.0",
"proxyquire": "^1.8.0",

@@ -87,0 +97,0 @@ "require-dir": "^1.0.0",

@@ -8,4 +8,4 @@ 'use strict'

class Config {
constructor (service, options) {
options = typeof service === 'object' ? service : options || {}
constructor (service, runtimeId, options) {
options = options || {}

@@ -21,4 +21,3 @@ const enabled = coalesce(options.enabled, platform.env('DD_TRACE_ENABLED'), true)

platform.env('DD_AGENT_HOST'),
platform.env('DD_TRACE_AGENT_HOSTNAME'),
'localhost'
platform.env('DD_TRACE_AGENT_HOSTNAME')
)

@@ -35,6 +34,5 @@ const port = coalesce(options.port, platform.env('DD_TRACE_AGENT_PORT'), 8126)

this.env = env
this.url = url ? new URL(url) : new URL(`${protocol}://${hostname}:${port}`)
this.tags = Object.assign({}, options.tags)
this.url = url ? new URL(url) : new URL(`${protocol}://${hostname || 'localhost'}:${port}`)
this.hostname = hostname || this.url.hostname
this.flushInterval = flushInterval
this.bufferSize = 100000
this.sampleRate = sampleRate

@@ -45,5 +43,14 @@ this.logger = options.logger

this.analytics = String(analytics) === 'true'
this.runtimeId = coalesce(runtimeId, '')
this.tags = Object.assign({ 'runtime-id': this.runtimeId }, options.tags)
this.experimental = {
runtimeMetrics: isFlagEnabled(options.experimental, 'runtimeMetrics')
}
}
}
function isFlagEnabled (obj, prop) {
return obj === true || (typeof obj === 'object' && obj !== null && obj[prop])
}
module.exports = Config

@@ -79,5 +79,5 @@ 'use strict'

function extractError (trace, span) {
const error = span._error
const error = span.context()._tags['error']
if (error) {
if (error instanceof Error) {
trace.meta['error.msg'] = error.message

@@ -84,0 +84,0 @@ trace.meta['error.type'] = error.name

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

Object.keys(keyValuePairs).forEach(key => {
this._spanContext._tags[key] = String(keyValuePairs[key])
this._spanContext._tags[key] = keyValuePairs[key]
})

@@ -111,0 +111,0 @@ } catch (e) {

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

this._prioritySampler = new PrioritySampler(config.env)
this._writer = new Writer(this._prioritySampler, config.url, config.bufferSize)
this._writer = new Writer(this._prioritySampler, config.url)
this._recorder = new Recorder(this._writer, config.flushInterval)

@@ -36,0 +36,0 @@ this._recorder.init()

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

const id = require('./id')
const uuid = require('./uuid')
const now = require('./now')

@@ -12,2 +13,3 @@ const env = require('./env')

const msgpack = require('./msgpack')
const metrics = require('./metrics')
const Uint64BE = require('./uint64be')

@@ -26,2 +28,3 @@

id,
uuid,
now,

@@ -33,2 +36,3 @@ env,

msgpack,
metrics,
Uint64BE,

@@ -35,0 +39,0 @@ on: emitter.on.bind(emitter),

@@ -29,3 +29,4 @@ 'use strict'

const service = platform.service()
const config = new Config(service, options)
const runtimeId = platform.uuid()
const config = new Config(service, runtimeId, options)

@@ -36,2 +37,6 @@ if (config.enabled) {

if (config.experimental.runtimeMetrics) {
platform.metrics().start()
}
this._tracer = new DatadogTracer(config)

@@ -38,0 +43,0 @@ this._instrumenter.enable()

'use strict'
const asyncWrap = process.binding('async_wrap')
let asyncHook

@@ -15,2 +17,8 @@

const providers = Object.keys(asyncWrap.Providers)
.reduce((prev, next) => {
prev[asyncWrap.Providers[next]] = next
return prev
}, {})
module.exports = {

@@ -22,3 +30,3 @@ createHook (callbacks) {

hooks.init = (uid, handle, provider, parentUid, parentHandle) => {
callbacks.init(uid)
callbacks.init(uid, providers[provider])
}

@@ -25,0 +33,0 @@ }

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

const Base = require('./base')
const platform = require('../../platform')

@@ -11,3 +12,3 @@ let singleton = null

class Scope extends Base {
constructor () {
constructor (options) {
if (singleton) return singleton

@@ -27,2 +28,6 @@

this._hook.enable()
if (options && options.debug) {
this._debug()
}
}

@@ -67,2 +72,4 @@

}
platform.metrics().increment('async.resources')
}

@@ -72,5 +79,33 @@

delete this._spans[asyncId]
platform.metrics().decrement('async.resources')
}
_debug () {
asyncHooks.createHook({
init: this._debugInit.bind(this),
destroy: this._debugDestroy.bind(this),
promiseResolve: this._debugDestroy.bind(this)
}).enable()
this._types = Object.create(null)
}
_debugInit (asyncId, type) {
this._types[asyncId] = type
platform.metrics().increment(`async.resources.${type}`)
}
_debugDestroy (asyncId) {
const type = this._types[asyncId]
if (type) {
platform.metrics().decrement(`async.resources.${type}`)
}
delete this._types[asyncId]
}
}
module.exports = Scope

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

this._scopeManager = new ScopeManager()
this._scope = new Scope()
this._scope = new Scope({
debug: config.debug
})
}

@@ -30,0 +32,0 @@

@@ -9,8 +9,10 @@ 'use strict'

const MAX_SIZE = 8 * 1024 * 1024 // 8MB
class Writer {
constructor (prioritySampler, url, size) {
constructor (prioritySampler, url) {
this._queue = []
this._prioritySampler = prioritySampler
this._url = url
this._size = size
this._size = 0
}

@@ -40,7 +42,8 @@

if (this.length < this._size) {
this._queue.push(buffer)
} else {
this._squeeze(buffer)
if (buffer.length + this._size > MAX_SIZE) {
this.flush()
}
this._size += buffer.length
this._queue.push(buffer)
}

@@ -56,2 +59,3 @@ }

this._queue = []
this._size = 0
}

@@ -88,9 +92,4 @@ }

}
_squeeze (buffer) {
const index = Math.floor(Math.random() * this.length)
this._queue[index] = buffer
}
}
module.exports = Writer

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc