add explicit dependency on opentelemetry api #719
Merged
+15
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Check all that apply