utils.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. Object.defineProperty(exports, '__esModule', { value: true });
  2. const utils = require('@sentry/utils');
  3. const hub = require('../hub.js');
  4. /**
  5. * Grabs active transaction off scope.
  6. *
  7. * @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
  8. */
  9. function getActiveTransaction(maybeHub) {
  10. // eslint-disable-next-line deprecation/deprecation
  11. const hub$1 = maybeHub || hub.getCurrentHub();
  12. // eslint-disable-next-line deprecation/deprecation
  13. const scope = hub$1.getScope();
  14. // eslint-disable-next-line deprecation/deprecation
  15. return scope.getTransaction() ;
  16. }
  17. /**
  18. * The `extractTraceparentData` function and `TRACEPARENT_REGEXP` constant used
  19. * to be declared in this file. It was later moved into `@sentry/utils` as part of a
  20. * move to remove `@sentry/tracing` dependencies from `@sentry/node` (`extractTraceparentData`
  21. * is the only tracing function used by `@sentry/node`).
  22. *
  23. * These exports are kept here for backwards compatability's sake.
  24. *
  25. * See https://github.com/getsentry/sentry-javascript/issues/4642 for more details.
  26. *
  27. * @deprecated Import this function from `@sentry/utils` instead
  28. */
  29. const extractTraceparentData = utils.extractTraceparentData;
  30. exports.stripUrlQueryAndFragment = utils.stripUrlQueryAndFragment;
  31. exports.extractTraceparentData = extractTraceparentData;
  32. exports.getActiveTransaction = getActiveTransaction;
  33. //# sourceMappingURL=utils.js.map