Skip to content

Commit

Permalink
Allow fetch to be used with NodeJS native fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
drewcorlin1 committed Oct 18, 2023
1 parent e229969 commit d24e132
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ export class FetchInstrumentation extends InstrumentationBase<
parsedUrl.protocol.replace(':', '')
);
if (typeof navigator !== 'undefined') {
span.setAttribute(SemanticAttributes.HTTP_USER_AGENT, navigator.userAgent);
span.setAttribute(
SemanticAttributes.HTTP_USER_AGENT,
navigator.userAgent
);
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-sdk-trace-web/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ export function sortResources(
});
}

/** Returns the origin if present (if in browser context) */
function getOrigin(): string | undefined{
/** Returns the origin if present (if in browser context). */
function getOrigin(): string | undefined {
return typeof location !== 'undefined' ? location.origin : undefined;
}

Expand Down

0 comments on commit d24e132

Please sign in to comment.