package.build.esm.checkin.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Base implementation for all Sentry JavaScript SDKs
import { dsnToString, dropUndefinedKeys, createEnvelope } from '@sentry/utils';
/**
* Create envelope from check in item.
*/
function createCheckInEnvelope(
checkIn,
dynamicSamplingContext,
metadata,
tunnel,
dsn,
) {
const headers = {
sent_at: new Date().toISOString(),
};
if (metadata && metadata.sdk) {
headers.sdk = {
name: metadata.sdk.name,
version: metadata.sdk.version,
};
}
if (!!tunnel && !!dsn) {
headers.dsn = dsnToString(dsn);
}
if (dynamicSamplingContext) {
headers.trace = dropUndefinedKeys(dynamicSamplingContext) ;
}
const item = createCheckInEnvelopeItem(checkIn);
return createEnvelope(headers, [item]);
}
function createCheckInEnvelopeItem(checkIn) {
const checkInHeaders = {
type: 'check_in',
};
return [checkInHeaders, checkIn];
}
export { createCheckInEnvelope };
//# sourceMappingURL=checkin.js.map