Skip to content

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

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

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
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
Copy link

codecov bot commented Oct 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.18%. Comparing base (fe4d368) to head (4962272).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4938   +/-   ##
=======================================
  Coverage   93.17%   93.18%           
=======================================
  Files         315      315           
  Lines        8086     8094    +8     
  Branches     1617     1619    +2     
=======================================
+ Hits         7534     7542    +8     
  Misses        552      552           
Files with missing lines Coverage Δ
packages/opentelemetry-core/src/utils/url.ts 100.00% <100.00%> (ø)

@jairo-mendoza
Copy link
Author

@pichlermarc Hi, all tests are now passing. Could I get another review and/or be placed in the merge queue? Thanks!

@pichlermarc pichlermarc dismissed their stale review December 5, 2024 14:21

previous comments are addressed

Copy link

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Mar 10, 2025
Copy link

This PR was closed because it has been stale for 14 days with no activity.

@github-actions github-actions bot closed this Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add allowUrls as a config option for web instrumentation
5 participants