Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(instrumentation): Add allowUrls config option to web instrumentation #4938

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

jairo-mendoza
Copy link

@jairo-mendoza jairo-mendoza commented Aug 21, 2024

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.

  • New feature (non-breaking change which adds functionality)
  • 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

  • Unit tests for both xhr and http instrumentation have been added
  • Tweaked opentelemetry-web examples (fetch and xml-http-request) to accept multiple URLs. Then I added the allowUrls config option on the instrumentation set up and verified that traces were being created (or not created).

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

Copy link

linux-foundation-easycla bot commented Aug 21, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@jairo-mendoza jairo-mendoza changed the title feat: Add allowUrls config option to Fetch Instrumentation feat: Add allowUrls config option to web Instrumentation Aug 21, 2024
@jairo-mendoza jairo-mendoza changed the title feat: Add allowUrls config option to web Instrumentation feat(instrumentation): Add allowUrls config option to web instrumentation Aug 22, 2024
@jairo-mendoza jairo-mendoza marked this pull request as ready for review August 22, 2024 16:06
@jairo-mendoza jairo-mendoza requested a review from a team August 22, 2024 16:06
* @param url
* @param allowedUrls
*/
export function isUrlAllowed(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit / fyi: as your introducing a new function to core, technically the xhr and fetch WILL require that they depend on this new version being released before they can consume this new function.

Generally, all versions are bumped together, but it might be worth calling out (somewhere)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Called out the new function in core in the main changelog, but I'm not 100% sure if it's the right spot for the call out

Copy link
Author

@jairo-mendoza jairo-mendoza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry-- fixed a merge conflict and seems like it need reapproval

@jairo-mendoza jairo-mendoza requested a review from a team as a code owner September 24, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add allowUrls as a config option for web instrumentation
3 participants