add explicit dependency on opentelemetry api by rochdev · Pull Request #719 · DataDog/datadog-lambda-js
What does this PR do?
Add explicit dependency on OpenTelemetry API.
Motivation
The dependency is now optional in dd-trace because it's only needed when used. However, this means that when the dependency is present but bundled, dd-trace is unable to access it. This is only a problem in serverless because it's the only environment where dd-trace is installed outside of the project root and optional dependencies are skipped at the same time. In theory this would be a problem in any case since it results in multiple versions being installed, but for OTel specifically it works because it uses globals to share state between versions.
Testing Guidelines
Additional Notes
The right approach would be to have a separate Datadog scoped package that we would recommend using instead of bundling the OpenTelemetry provider with dd-trace. I added a TODO to this effect.
Types of Changes
- Bug fix
- New feature
- Breaking change
- Misc (docs, refactoring, dependency upgrade, etc.)
Check all that apply
- This PR's description is comprehensive
- This PR contains breaking changes that are documented in the description
- This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
- This PR impacts documentation, and it has been updated (or a ticket has been logged)
- This PR's changes are covered by the automated tests
- This PR collects user input/sensitive content into Datadog
- This PR passes the integration tests (ask a Datadog member to run the tests)