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

fix(exporter-zipkin): remove deprecated url.parse usage #5390

Merged

Conversation

chancancode
Copy link
Contributor

Which problem is this PR solving?

Addresses the following deprecation/eslint warning:

/home/runner/work/opentelemetry-js/opentelemetry-js/packages/opentelemetry-exporter-zipkin/src/platform/node/util.ts
  34:19  warning  'url.parse' was deprecated since v11.0.0. Use 'url.URL' constructor instead  node/no-deprecated-api

Ref #5365

Short description of the changes

url.parse is deprecated in favor of new URL().

url.parse do not get CVEs so at minimum using it in production code a security liability, if not an outright vulnerability.

They do behave differently so it's often not a straightforward direct replacement. However, in this case, the only reason we are even calling url.parse is to extract a set of info to merge into the options we pass into http(s).request. http(s).request now takes a separate URL argument, so we can bypass that.

So I think we should be able to make this change compatibly, outside of some weird edge cases that are probably not applicable here. @pichlermarc you worked on #5091 so let me know if you can think of anything relevant that you want to see tested.

It is worth noting in the CHANGELOG since this used to trigger a Node runtime deprecation warning with --pending-deprecation.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 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

  • eslint

Checklist:

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

@chancancode chancancode requested a review from a team as a code owner January 29, 2025 01:27
Addresses the following deprecation/eslint warning:

```
/home/runner/work/opentelemetry-js/opentelemetry-js/packages/opentelemetry-exporter-zipkin/src/platform/node/util.ts
  34:19  warning  'url.parse' was deprecated since v11.0.0. Use 'url.URL' constructor instead  node/no-deprecated-api
```

`http(s).request` now takes a URL (the global one, not `url.URL`)
argument separate from the options bag, so we should be able to
make this change compatibly, outside of some weird edge cases that
are probably not applicable here.

It is worth noting in the CHANGELOG since this used to trigger a
Node runtime deprecation warning with `--pending-deprecation`.

Ref open-telemetry#5365
@chancancode chancancode force-pushed the eslint-warning-exporter-zipkin branch from a173adc to 8d4deef Compare January 29, 2025 01:28
@chancancode chancancode mentioned this pull request Jan 29, 2025
25 tasks
Copy link

codecov bot commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.63%. Comparing base (e42fbb9) to head (8d4deef).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5390      +/-   ##
==========================================
- Coverage   94.63%   94.63%   -0.01%     
==========================================
  Files         318      318              
  Lines        8036     8035       -1     
  Branches     1685     1685              
==========================================
- Hits         7605     7604       -1     
  Misses        431      431              
Files with missing lines Coverage Δ
...elemetry-exporter-zipkin/src/platform/node/util.ts 96.77% <100.00%> (-0.11%) ⬇️

Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

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

thanks 👍

@pichlermarc pichlermarc added this pull request to the merge queue Jan 29, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 29, 2025
@pichlermarc pichlermarc added this pull request to the merge queue Jan 29, 2025
Merged via the queue into open-telemetry:main with commit 22569ac Jan 29, 2025
15 checks passed
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.

2 participants