utils.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. Object.defineProperty(exports, '__esModule', { value: true });
  2. /**
  3. * Checks if a given value is a valid measurement value.
  4. */
  5. function isMeasurementValue(value) {
  6. return typeof value === 'number' && isFinite(value);
  7. }
  8. /**
  9. * Helper function to start child on transactions. This function will make sure that the transaction will
  10. * use the start timestamp of the created child span if it is earlier than the transactions actual
  11. * start timestamp.
  12. *
  13. * Note: this will not be possible anymore in v8,
  14. * unless we do some special handling for browser here...
  15. */
  16. function _startChild(transaction, { startTimestamp, ...ctx }) {
  17. // eslint-disable-next-line deprecation/deprecation
  18. if (startTimestamp && transaction.startTimestamp > startTimestamp) {
  19. // eslint-disable-next-line deprecation/deprecation
  20. transaction.startTimestamp = startTimestamp;
  21. }
  22. // eslint-disable-next-line deprecation/deprecation
  23. return transaction.startChild({
  24. startTimestamp,
  25. ...ctx,
  26. });
  27. }
  28. exports._startChild = _startChild;
  29. exports.isMeasurementValue = isMeasurementValue;
  30. //# sourceMappingURL=utils.js.map