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: Support URL object in fetch / XHR telemetry #1118

Merged
merged 4 commits into from
Aug 16, 2023

Conversation

dj-stormtrooper
Copy link
Contributor

Description of the change

Please include a summary of the change and which issues are fixed.
Please also include relevant motivation and context.

At Fingerprint.js we have experienced several issues with our customers who use Rollbar. Some telemetry events weren't captured due to unsupported URL type in fetch / XHR (see Parameter section - the URL type is valid argument type for fetch).

I added support to rollbarInstrumenter and covered this behaviour with unit tests.

fetch and XHR support any object with stringifier, so I can extend this condition to any object with toString method, thought it might be not really useful. Feel free to discuss the solution

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Maintenance
  • New release

Related issues

Shortcut stories and GitHub issues (delete irrelevant)

I didn't create particular issue for Rollbar, but It's similar to what had with Honeybadger: issue, PR

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • "Ready for review" label attached to the PR and reviewers assigned
  • Issue from task tracker has a link to this pull request
  • Changes have been reviewed by at least one other engineer

Copy link
Contributor

@waltjones waltjones left a comment

Choose a reason for hiding this comment

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

Good improvement, thank you!

I can accept this as is.

I can extend this condition to any object with toString method

That would be fine (but not necessary) as long as comments make it obvious that it's primarily meant to support URL.

@dj-stormtrooper
Copy link
Contributor Author

That would be fine (but not necessary) as long as comments make it obvious that it's primarily meant to support URL.

Yeah, I think we can keep it more specific, there is no need for a flexible solution here

I can accept this as is.

Great, thanks!

@waltjones waltjones merged commit 848d5f0 into rollbar:master Aug 16, 2023
5 checks passed
@goibon
Copy link

goibon commented Jan 26, 2024

@waltjones any chance we can get a new version of this package released that includes this change? I've been debugging why my project didn't have any paths in the network telemetry events and this PR looks like it would fix it. We use fetch with URL objects as the first parameter.

@waltjones
Copy link
Contributor

@goibon Released: https://github.com/rollbar/rollbar.js/releases/tag/v2.26.3

Apologies for the delay.

mudetroit pushed a commit that referenced this pull request Mar 14, 2024
* feat: Support `URL` type in `XHR.open` telemetry

* feat: Support `URL` object in `fetch` telemetry

* test: XHR test

* test: Fetch telemetry tests
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.

3 participants