Skip to content

Commit

Permalink
Merge 4ecedce into 9328558
Browse files Browse the repository at this point in the history
  • Loading branch information
Grunet committed Apr 10, 2023
2 parents 9328558 + 4ecedce commit 8a019b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/
### :bug: (Bug Fix)

* fix(instrumentation-http): fixed description for http.server.duration metric [#3710](https://github.com/open-telemetry/opentelemetry-js/pull/3710)
* fix(opentelemetry-sdk-trace-web): don't crash in runtimes where location isn't defined [#3715](https://github.com/open-telemetry/opentelemetry-js/pull/3715)

### :books: (Refine Doc)

Expand Down
6 changes: 5 additions & 1 deletion packages/opentelemetry-sdk-trace-web/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,11 @@ export function parseUrl(url: string): URLLike {
if (typeof URL === 'function') {
return new URL(
url,
typeof document !== 'undefined' ? document.baseURI : location.href
typeof document !== 'undefined'
? document.baseURI
: typeof location !== 'undefined' // Some JS runtimes (e.g. Deno) don't define this
? location.href
: undefined

Check warning on line 314 in packages/opentelemetry-sdk-trace-web/src/utils.ts

View check run for this annotation

Codecov / codecov/patch

packages/opentelemetry-sdk-trace-web/src/utils.ts#L314

Added line #L314 was not covered by tests
);
}
const element = getUrlNormalizingAnchor();
Expand Down

0 comments on commit 8a019b2

Please sign in to comment.