npm dd-trace 0.9.0

latest releases: 6.0.0-pre-ca25754, 6.0.0-pre-0f36e48, 5.12.0...
5 years ago

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

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

Don't miss a new dd-trace release

NewReleases is sending notifications on new releases.