checkin.js 966 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. Object.defineProperty(exports, '__esModule', { value: true });
  2. const utils = require('@sentry/utils');
  3. /**
  4. * Create envelope from check in item.
  5. */
  6. function createCheckInEnvelope(
  7. checkIn,
  8. dynamicSamplingContext,
  9. metadata,
  10. tunnel,
  11. dsn,
  12. ) {
  13. const headers = {
  14. sent_at: new Date().toISOString(),
  15. };
  16. if (metadata && metadata.sdk) {
  17. headers.sdk = {
  18. name: metadata.sdk.name,
  19. version: metadata.sdk.version,
  20. };
  21. }
  22. if (!!tunnel && !!dsn) {
  23. headers.dsn = utils.dsnToString(dsn);
  24. }
  25. if (dynamicSamplingContext) {
  26. headers.trace = utils.dropUndefinedKeys(dynamicSamplingContext) ;
  27. }
  28. const item = createCheckInEnvelopeItem(checkIn);
  29. return utils.createEnvelope(headers, [item]);
  30. }
  31. function createCheckInEnvelopeItem(checkIn) {
  32. const checkInHeaders = {
  33. type: 'check_in',
  34. };
  35. return [checkInHeaders, checkIn];
  36. }
  37. exports.createCheckInEnvelope = createCheckInEnvelope;
  38. //# sourceMappingURL=checkin.js.map