@sentry/core
Version:
Base implementation for all Sentry JavaScript SDKs
59 lines (51 loc) • 1.48 kB
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const dsn = require('../utils-hoist/dsn.js');
require('../utils-hoist/logger.js');
require('../utils-hoist/debug-build.js');
require('../utils-hoist/time.js');
require('../utils-hoist/syncpromise.js');
const envelope = require('../utils-hoist/envelope.js');
/**
* Creates OTEL log envelope item for a serialized OTEL log.
*
* @param log - The serialized OTEL log to include in the envelope.
* @returns The created OTEL log envelope item.
*/
function createOtelLogEnvelopeItem(log) {
return [
{
type: 'otel_log',
},
log,
];
}
/**
* Creates an envelope for a list of logs.
*
* @param logs - The logs to include in the envelope.
* @param metadata - The metadata to include in the envelope.
* @param tunnel - The tunnel to include in the envelope.
* @param dsn - The DSN to include in the envelope.
* @returns The created envelope.
*/
function createOtelLogEnvelope(
logs,
metadata,
tunnel,
dsn$1,
) {
const headers = {};
if (metadata?.sdk) {
headers.sdk = {
name: metadata.sdk.name,
version: metadata.sdk.version,
};
}
if (!!tunnel && !!dsn$1) {
headers.dsn = dsn.dsnToString(dsn$1);
}
return envelope.createEnvelope(headers, logs.map(createOtelLogEnvelopeItem));
}
exports.createOtelLogEnvelope = createOtelLogEnvelope;
exports.createOtelLogEnvelopeItem = createOtelLogEnvelopeItem;
//# sourceMappingURL=envelope.js.map