fix(sdk-node): use resource interface instead of concrete class #3803
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.
Which problem is this PR solving?
contrib repo currently fails to build because of issue with(sorry that was not correct, I needed to update the branch, but the fix is relevant regardless).@opentelemetry/resource-detector-instana
:We had this issue in the past. components should use interfaces and not concrete classes, as using concrete classes causes typescript to error when the classes have private properties when 2 different versions are used.
Since
@opentelemetry/sdk-node
has a dependency on"@opentelemetry/resources": "1.13.0"
, if it uses theResource
class which has private property_syncAttributes
, then everyone using this component with a resource must use the exact same version as well, which is not good.The
class NodeSDK
already usesIResource
and notResource
in other places here and here, so this only aligns the constructor to use it as wellShort description of the changes
Use the
IResource
interface instead of the concrete classResource
.Type of change
Please delete options that are not relevant.
Since
class Resource implements IResource
it shouldn't be a breaking change for any user to my understanding, but would appreciate other eyes on that.How Has This Been Tested?
It only changes typescript and I tested it compiles successfully.
Checklist: