Skip to content

Log injection breaks when upgrading from v0.15.5 to v0.16.2 #780

Description

@reinpold

Describe the bug
When upgrading dd-trace to v0.16.2 logs do not contain dd (https://github.com/DataDog/dd-trace-js/blob/v0.16.2/packages/dd-trace/src/plugins/util/log.js#L13-L16) block any more.

The issue seems to be in Instrumenter.enable method https://github.com/DataDog/dd-trace-js/blob/v0.16.2/packages/dd-trace/src/instrumenter.js#L39-L52 Namely, plugins do not get auto-instrumented, because this._enabled is set to true after setting and loading the plugins and not before. load method simply returns if this._enabled is false: https://github.com/DataDog/dd-trace-js/blob/v0.16.2/packages/dd-trace/src/instrumenter.js#L98 Moving this._enabled = true to the begging of enable method fixes log injection issue, but might introduce others.

Environment
DD_LOGS_INJECTION=true
DD_TRACE_ANALYTICS_ENABLED=true
DD_RUNTIME_METRICS_ENABLED=true

  • Operation system:
    Alpine Linux 3.9.4
  • Node version:
    v10.17.0
  • Tracer version:
    v0.16.2
  • Agent version:
    v6.15.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions