From this release moving forward, we are including TypeScript definition files directly in the project. This will make it easier to officially support them, have parity between the definitions and the code for every new versions, and have better visibility on requested changes. If you were using @types/dd-trace, it is highly recommended to migrate to the official typings instead. Simply remove the dependency and your IDE/transpiler should pick up the change.
Bug Fixes
- http: fix suppressed error event and span never finishing (#450)
- http: fix http req.abort() support and flushing stream too early (#448)
- restify: fix restify crashing with array middleware (#449), fixes #440
Features
- core:: rewrite the scope manager with a new CPS style API (#411)
- dns: add support for
dns
(#442) - docs: add typescript definitions and replace jsdoc with typedoc (#403), thanks @alloy, @perryh, @dominikeinkemmer, @ColinBradleyDriveWorks and @atreidesend for the original typings!
- generic-pool: add support for
generic-pool
(#443) - graphql: rewrite according to apollo engine reporting format (#451), fixes #431
- http: add whitelist/blacklist settings to express plugin (#438), thanks @RyanGordon!
- net: add support for
net
(#442)
Improvements
- http: add header tags and separate client/server config in http plugin (#433)
Breaking Changes
GraphQL is now instrumented according to the Apollo Engine Reporting format
This change has no impact on code, but trace structure has changed to be in line with Apollo Engine Reporting format. Let us know what you think of the new format!
tracer.trace() is deprecated
It will probably come back in the future, but the current implementation relied on the old scope manager which has been rewritten. tracer.startSpan()
should be used instead.
Scope manager was rewritten with a CPS style API.
This is a change we have been trying to avoid, but is unfortunately necessary to ensure the stability of the tracer and proper context propagation. The previous implementation was overly complex, difficult to use and prone to errors which led to many issues. By using continuation passing style, it's much easier to reason about, the implementation is very simple and it's more powerful since the scope persists for the entire scope of the function, both synchronous or asynchronous.
You can find the documentation for the new API here.
Here are a few examples of how to migrate to the new API:
// === old API ===
const scope = tracer.scopeManager().activate(span)
tracer.scopeManager().active() === scope
scope.span() === span
scope.close()
// === new API ===
tracer.scope().activate(span, () => {
tracer.scope().active() === span
})
// === old API ===
const scope = tracer.scopeManager().activate(span)
setTimeout(() => {
tracer.scopeManager().active() === scope
scope.span() === span
scope.close()
tracer.scopeManager().active() === null
})
tracer.scopeManager().active() === scope
// === new API ===
tracer.scope().activate(span, () => {
setTimeout(() => {
tracer.scope().active() === span
})
tracer.scope().active() === span
})
tracer.scope().active() === null