opentelemetry-js
opentelemetry-js copied to clipboard
feat(opentelemetry-resources): add schema url
Which problem is this PR solving?
Add Schema URL for resources : https://github.com/open-telemetry/opentelemetry-js/issues/4182
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
I have added the schema URL to the Resource.ts and made the necessary changes to the IResource.ts. I have fixed the first two checkboxes and I am asking for clarification on the third because most of the exporters packages in the experimental folder are already exporting resources. I am trying to add a new feature request as per the issue request.
Fixes # (Schema URL can be added using the Resource constructor and Schema URL is handled according to the specification on Resource#merge)
Short description of the changes
I have added schemaUrl parameter, added a return function and merged schema URLs, handling conflicts
Type of change
Please delete options that are not relevant.
- [ x ] Bug fix (non-breaking change which fixes an issue)
- [ x ] New feature (non-breaking change which adds functionality)
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
I added some tests to the Resource.test.ts within the test suite.
-
cd opentelemetry-js/packages/opentelemetry-resources
-
npm run test
-
[x] should initialize resource with schema URL
-
[x] should merge resources with different schema URLs
-
[x] should retain the same schema URL when merging resources with identical URL
-
[x] should retain schema URL from the resource that has it when merging
Checklist:
- [x] Followed the style guidelines of this project
- [x] Unit tests have been added
- [ ] Documentation has been updated