utils.js 1010 B

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