opentelemetry-js
opentelemetry-js copied to clipboard
feat(instrumentation): Add allowUrls config option to web instrumentation
trafficstars
Which problem is this PR solving?
This change provides easier control over which urls should have spans created for it. It can also be used with ignoreUrls for more granular control.
Fixes #4899
Short description of the changes
Added allowUrls as a config option to both the XMLHttpRequestInstrumentation and FetchInstrumentation classes.
Addition of the isUrlAllowed function in the core package that both the fetch and xhr instrumentation will depend on.
Type of change
Please delete options that are not relevant.
- [x] New feature (non-breaking change which adds functionality)
- [x] This change requires a documentation update
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
- [x] Unit tests for both xhr and http instrumentation have been added
- [x] Tweaked
opentelemetry-webexamples (fetchandxml-http-request) to accept multiple URLs. Then I added theallowUrlsconfig option on the instrumentation set up and verified that traces were being created (or not created).
Checklist:
- [x] Followed the style guidelines of this project
- [x] Unit tests have been added
- [ ] Documentation has been updated
- To see the specific tasks where the Asana app for GitHub is being used, see below:
- https://app.asana.com/0/0/1207047530689178