Socket
Socket
Sign inDemoInstall

@sentry/core

Package Overview
Dependencies
2
Maintainers
11
Versions
476
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.92.0 to 7.93.0

cjs/semanticAttributes.js

4

cjs/baseclient.js

@@ -135,4 +135,6 @@ Object.defineProperty(exports, '__esModule', { value: true });

const eventMessage = utils.isParameterizedString(message) ? message : String(message);
const promisedEvent = utils.isPrimitive(message)
? this.eventFromMessage(String(message), level, hint)
? this.eventFromMessage(eventMessage, level, hint)
: this.eventFromException(message, hint);

@@ -139,0 +141,0 @@

Object.defineProperty(exports, '__esModule', { value: true });
const utils = require('@sentry/utils');
const constants = require('./constants.js');
const debugBuild = require('./debug-build.js');
const hub = require('./hub.js');
const session = require('./session.js');
const prepareEvent = require('./utils/prepareEvent.js');
// Note: All functions in this file are typed with a return value of `ReturnType<Hub[HUB_FUNCTION]>`,
// where HUB_FUNCTION is some method on the Hub class.
//
// This is done to make sure the top level SDK methods stay in sync with the hub methods.
// Although every method here has an explicit return type, some of them (that map to void returns) do not
// contain `return` keywords. This is done to save on bundle size, as `return` is not minifiable.
/**
* Captures an exception event and sends it to Sentry.
* This accepts an event hint as optional second parameter.
* Alternatively, you can also pass a CaptureContext directly as second parameter.
*
* @param exception The exception to capture.
* @param hint Optinal additional data to attach to the Sentry event.
* @returns the id of the captured Sentry event.
*/

@@ -25,2 +22,3 @@ function captureException(

) {
// eslint-disable-next-line deprecation/deprecation
return hub.getCurrentHub().captureException(exception, prepareEvent.parseEventHintOrCaptureContext(hint));

@@ -32,5 +30,5 @@ }

*
* @param message The message to send to Sentry.
* @param Severity Define the level of the message.
* @returns The generated eventId.
* @param exception The exception to capture.
* @param captureContext Define the level of the message or pass in additional data to attach to the message.
* @returns the id of the captured message.
*/

@@ -46,2 +44,3 @@ function captureMessage(

const context = typeof captureContext !== 'string' ? { captureContext } : undefined;
// eslint-disable-next-line deprecation/deprecation
return hub.getCurrentHub().captureMessage(message, level, context);

@@ -53,6 +52,8 @@ }

*
* @param event The event to send to Sentry.
* @returns The generated eventId.
* @param exception The event to send to Sentry.
* @param hint Optional additional data to attach to the Sentry event.
* @returns the id of the captured event.
*/
function captureEvent(event, hint) {
// eslint-disable-next-line deprecation/deprecation
return hub.getCurrentHub().captureEvent(event, hint);

@@ -150,7 +151,25 @@ }

* popScope();
*
* @param callback that will be enclosed into push/popScope.
*/
function withScope(callback) {
return hub.getCurrentHub().withScope(callback);
/**
* Either creates a new active scope, or sets the given scope as active scope in the given callback.
*/
function withScope(
...rest
) {
// If a scope is defined, we want to make this the active scope instead of the default one
if (rest.length === 2) {
const [scope, callback] = rest;
if (!scope) {
return hub.getCurrentHub().withScope(callback);
}
const hub$1 = hub.getCurrentHub();
return hub$1.withScope(() => {
hub$1.getStackTop().scope = scope ;
return callback(scope );
});
}
return hub.getCurrentHub().withScope(rest[0]);
}

@@ -177,2 +196,4 @@

* @returns The transaction which was just started
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/

@@ -183,2 +204,3 @@ function startTransaction(

) {
// eslint-disable-next-line deprecation/deprecation
return hub.getCurrentHub().startTransaction({ ...context }, customSamplingContext);

@@ -309,2 +331,98 @@ }

/**
* Start a session on the current isolation scope.
*
* @param context (optional) additional properties to be applied to the returned session object
*
* @returns the new active session
*/
function startSession(context) {
const client = getClient();
const isolationScope = hub.getIsolationScope();
const currentScope = getCurrentScope();
const { release, environment = constants.DEFAULT_ENVIRONMENT } = (client && client.getOptions()) || {};
// Will fetch userAgent if called from browser sdk
const { userAgent } = utils.GLOBAL_OBJ.navigator || {};
const session$1 = session.makeSession({
release,
environment,
user: isolationScope.getUser(),
...(userAgent && { userAgent }),
...context,
});
// End existing session if there's one
const currentSession = isolationScope.getSession();
if (currentSession && currentSession.status === 'ok') {
session.updateSession(currentSession, { status: 'exited' });
}
endSession();
// Afterwards we set the new session on the scope
isolationScope.setSession(session$1);
// TODO (v8): Remove this and only use the isolation scope(?).
// For v7 though, we can't "soft-break" people using getCurrentHub().getScope().setSession()
currentScope.setSession(session$1);
return session$1;
}
/**
* End the session on the current isolation scope.
*/
function endSession() {
const isolationScope = hub.getIsolationScope();
const currentScope = getCurrentScope();
const session$1 = isolationScope.getSession();
if (session$1) {
session.closeSession(session$1);
}
_sendSessionUpdate();
// the session is over; take it off of the scope
isolationScope.setSession();
// TODO (v8): Remove this and only use the isolation scope(?).
// For v7 though, we can't "soft-break" people using getCurrentHub().getScope().setSession()
currentScope.setSession();
}
/**
* Sends the current Session on the scope
*/
function _sendSessionUpdate() {
const isolationScope = hub.getIsolationScope();
const currentScope = getCurrentScope();
const client = getClient();
// TODO (v8): Remove currentScope and only use the isolation scope(?).
// For v7 though, we can't "soft-break" people using getCurrentHub().getScope().setSession()
const session = currentScope.getSession() || isolationScope.getSession();
if (session && client && client.captureSession) {
client.captureSession(session);
}
}
/**
* Sends the current session on the scope to Sentry
*
* @param end If set the session will be marked as exited and removed from the scope.
* Defaults to `false`.
*/
function captureSession(end = false) {
// both send the update and pull the session from the scope
if (end) {
endSession();
return;
}
// only send the update
_sendSessionUpdate();
}
exports.addBreadcrumb = addBreadcrumb;

@@ -315,4 +433,6 @@ exports.captureCheckIn = captureCheckIn;

exports.captureMessage = captureMessage;
exports.captureSession = captureSession;
exports.close = close;
exports.configureScope = configureScope;
exports.endSession = endSession;
exports.flush = flush;

@@ -328,2 +448,3 @@ exports.getClient = getClient;

exports.setUser = setUser;
exports.startSession = startSession;
exports.startTransaction = startTransaction;

@@ -330,0 +451,0 @@ exports.withMonitor = withMonitor;

@@ -86,2 +86,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

top.client = client;
top.scope.setClient(client);
if (client && client.setupIntegrations) {

@@ -183,2 +184,4 @@ client.setupIntegrations();

* @inheritDoc
*
* @deprecated Use `Sentry.captureException()` instead.
*/

@@ -188,14 +191,9 @@ captureException(exception, hint) {

const syntheticException = new Error('Sentry syntheticException');
this._withClient((client, scope) => {
client.captureException(
exception,
{
originalException: exception,
syntheticException,
...hint,
event_id: eventId,
},
scope,
);
this.getScope().captureException(exception, {
originalException: exception,
syntheticException,
...hint,
event_id: eventId,
});
return eventId;

@@ -206,2 +204,4 @@ }

* @inheritDoc
*
* @deprecated Use `Sentry.captureMessage()` instead.
*/

@@ -216,15 +216,9 @@ captureMessage(

const syntheticException = new Error(message);
this._withClient((client, scope) => {
client.captureMessage(
message,
level,
{
originalException: message,
syntheticException,
...hint,
event_id: eventId,
},
scope,
);
this.getScope().captureMessage(message, level, {
originalException: message,
syntheticException,
...hint,
event_id: eventId,
});
return eventId;

@@ -235,2 +229,4 @@ }

* @inheritDoc
*
* @deprecated Use `Sentry.captureEvent()` instead.
*/

@@ -243,5 +239,3 @@ captureEvent(event, hint) {

this._withClient((client, scope) => {
client.captureEvent(event, { ...hint, event_id: eventId }, scope);
});
this.getScope().captureEvent(event, { ...hint, event_id: eventId });
return eventId;

@@ -367,3 +361,19 @@ }

/**
* @inheritDoc
* Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.
*
* A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a
* new child span within the transaction or any span, call the respective `.startChild()` method.
*
* Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.
*
* The transaction must be finished with a call to its `.end()` method, at which point the transaction with all its
* finished child spans will be sent to Sentry.
*
* @param context Properties of the new `Transaction`.
* @param customSamplingContext Information given to the transaction sampling function (along with context-dependent
* default values). See {@link Options.tracesSampler}.
*
* @returns The transaction which was just started
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/

@@ -399,2 +409,4 @@ startTransaction(context, customSamplingContext) {

* @inheritDoc
*
* @deprecated Use top level `captureSession` instead.
*/

@@ -404,2 +416,3 @@ captureSession(endSession = false) {

if (endSession) {
// eslint-disable-next-line deprecation/deprecation
return this.endSession();

@@ -414,2 +427,3 @@ }

* @inheritDoc
* @deprecated Use top level `endSession` instead.
*/

@@ -431,2 +445,3 @@ endSession() {

* @inheritDoc
* @deprecated Use top level `startSession` instead.
*/

@@ -453,2 +468,3 @@ startSession(context) {

}
// eslint-disable-next-line deprecation/deprecation
this.endSession();

@@ -465,2 +481,5 @@

* when Tracing is used.
*
* @deprecated Use top-level `getClient().getOptions().sendDefaultPii` instead. This function
* only unnecessarily increased API surface but only wrapped accessing the option.
*/

@@ -467,0 +486,0 @@ shouldSendDefaultPii() {

@@ -12,2 +12,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

const measurement = require('./tracing/measurement.js');
const semanticAttributes = require('./semanticAttributes.js');
const envelope = require('./envelope.js');

@@ -68,3 +69,6 @@ const exports$1 = require('./exports.js');

exports.getDynamicSamplingContextFromClient = dynamicSamplingContext.getDynamicSamplingContextFromClient;
exports.getDynamicSamplingContextFromSpan = dynamicSamplingContext.getDynamicSamplingContextFromSpan;
exports.setMeasurement = measurement.setMeasurement;
exports.SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE = semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE;
exports.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE;
exports.createEventEnvelope = envelope.createEventEnvelope;

@@ -77,4 +81,6 @@ exports.createSessionEnvelope = envelope.createSessionEnvelope;

exports.captureMessage = exports$1.captureMessage;
exports.captureSession = exports$1.captureSession;
exports.close = exports$1.close;
exports.configureScope = exports$1.configureScope;
exports.endSession = exports$1.endSession;
exports.flush = exports$1.flush;

@@ -90,2 +96,3 @@ exports.getClient = exports$1.getClient;

exports.setUser = exports$1.setUser;
exports.startSession = exports$1.startSession;
exports.startTransaction = exports$1.startTransaction;

@@ -134,2 +141,4 @@ exports.withMonitor = exports$1.withMonitor;

exports.handleCallbackErrors = handleCallbackErrors.handleCallbackErrors;
exports.spanIsSampled = spanUtils.spanIsSampled;
exports.spanToJSON = spanUtils.spanToJSON;
exports.spanToTraceHeader = spanUtils.spanToTraceHeader;

@@ -136,0 +145,0 @@ exports.DEFAULT_ENVIRONMENT = constants.DEFAULT_ENVIRONMENT;

@@ -95,2 +95,6 @@ Object.defineProperty(exports, '__esModule', { value: true });

function setupIntegration(client, integration, integrationIndex) {
if (integrationIndex[integration.name]) {
debugBuild.DEBUG_BUILD && utils.logger.log(`Integration skipped because it was already installed: ${integration.name}`);
return;
}
integrationIndex[integration.name] = integration;

@@ -97,0 +101,0 @@

@@ -5,2 +5,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

const integration = require('../integration.js');
const spanUtils = require('../utils/spanUtils.js');

@@ -85,2 +86,4 @@ const DEFAULT_OPTIONS = {

if (transaction) {
const name = spanUtils.spanToJSON(transaction).description || '';
// TODO (v8): Remove the nextjs check and just base it on `transactionNamingScheme` for all SDKs. (We have to

@@ -91,3 +94,3 @@ // keep it the way it is for the moment, because changing the names of transactions in Sentry has the potential

getSDKName(client) === 'sentry.javascript.nextjs'
? transaction.name.startsWith('/api')
? name.startsWith('/api')
: transactionNamingScheme !== 'path';

@@ -98,3 +101,3 @@

method: shouldIncludeMethodInTransactionName,
customRoute: transaction.name,
customRoute: name,
});

@@ -101,0 +104,0 @@

@@ -6,2 +6,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

const exports$1 = require('../exports.js');
const spanUtils = require('../utils/spanUtils.js');
const constants = require('./constants.js');

@@ -26,2 +27,3 @@ const integration = require('./integration.js');

const { release, environment } = client.getOptions();
// eslint-disable-next-line deprecation/deprecation
const transaction = scope.getTransaction();

@@ -36,3 +38,3 @@ const metricTags = {};

if (transaction) {
metricTags.transaction = transaction.name;
metricTags.transaction = spanUtils.spanToJSON(transaction).description || '';
}

@@ -39,0 +41,0 @@

@@ -54,3 +54,5 @@ Object.defineProperty(exports, '__esModule', { value: true });

/** Transaction Name */
/**
* Transaction Name
*/

@@ -242,3 +244,4 @@ /** Span */

/**
* @inheritDoc
* Sets the transaction name on the scope for future events.
* @deprecated Use extra or tags instead.
*/

@@ -267,3 +270,5 @@ setTransactionName(name) {

/**
* @inheritDoc
* Sets the Span on the scope.
* @param span Span
* @deprecated Instead of setting a span on a scope, use `startSpan()`/`startSpanManual()` instead.
*/

@@ -277,3 +282,4 @@ setSpan(span) {

/**
* @inheritDoc
* Returns the `Span` if there is one.
* @deprecated Use `getActiveSpan()` instead.
*/

@@ -285,3 +291,4 @@ getSpan() {

/**
* @inheritDoc
* Returns the `Transaction` attached to the scope (if there is one).
* @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
*/

@@ -291,3 +298,3 @@ getTransaction() {

// have a pointer to the currently-active transaction.
const span = this.getSpan();
const span = this._span;
return span && span.transaction;

@@ -548,2 +555,86 @@ }

/**
* Capture an exception for this scope.
*
* @param exception The exception to capture.
* @param hint Optinal additional data to attach to the Sentry event.
* @returns the id of the captured Sentry event.
*/
captureException(exception, hint) {
const eventId = hint && hint.event_id ? hint.event_id : utils.uuid4();
if (!this._client) {
utils.logger.warn('No client configured on scope - will not capture exception!');
return eventId;
}
const syntheticException = new Error('Sentry syntheticException');
this._client.captureException(
exception,
{
originalException: exception,
syntheticException,
...hint,
event_id: eventId,
},
this,
);
return eventId;
}
/**
* Capture a message for this scope.
*
* @param message The message to capture.
* @param level An optional severity level to report the message with.
* @param hint Optional additional data to attach to the Sentry event.
* @returns the id of the captured message.
*/
captureMessage(message, level, hint) {
const eventId = hint && hint.event_id ? hint.event_id : utils.uuid4();
if (!this._client) {
utils.logger.warn('No client configured on scope - will not capture message!');
return eventId;
}
const syntheticException = new Error(message);
this._client.captureMessage(
message,
level,
{
originalException: message,
syntheticException,
...hint,
event_id: eventId,
},
this,
);
return eventId;
}
/**
* Captures a manually created event for this scope and sends it to Sentry.
*
* @param exception The event to capture.
* @param hint Optional additional data to attach to the Sentry event.
* @returns the id of the captured event.
*/
captureEvent(event, hint) {
const eventId = hint && hint.event_id ? hint.event_id : utils.uuid4();
if (!this._client) {
utils.logger.warn('No client configured on scope - will not capture event!');
return eventId;
}
this._client.captureEvent(event, { ...hint, event_id: eventId }, this);
return eventId;
}
/**
* This will be called on every set call.

@@ -550,0 +641,0 @@ */

@@ -239,5 +239,6 @@ Object.defineProperty(exports, '__esModule', { value: true });

// eslint-disable-next-line deprecation/deprecation
const span = scope.getSpan();
if (span) {
const samplingContext = span.transaction ? span.transaction.getDynamicSamplingContext() : undefined;
const samplingContext = span.transaction ? dynamicSamplingContext.getDynamicSamplingContextFromSpan(span) : undefined;
return [samplingContext, spanUtils.spanToTraceContext(span)];

@@ -244,0 +245,0 @@ }

@@ -5,2 +5,4 @@ Object.defineProperty(exports, '__esModule', { value: true });

const constants = require('../constants.js');
const exports$1 = require('../exports.js');
const spanUtils = require('../utils/spanUtils.js');

@@ -10,3 +12,3 @@ /**

*
* Dispatchs the `createDsc` lifecycle hook as a side effect.
* Dispatches the `createDsc` lifecycle hook as a side effect.
*/

@@ -36,3 +38,62 @@ function getDynamicSamplingContextFromClient(

/**
* A Span with a frozen dynamic sampling context.
*/
/**
* Creates a dynamic sampling context from a span (and client and scope)
*
* @param span the span from which a few values like the root span name and sample rate are extracted.
*
* @returns a dynamic sampling context
*/
function getDynamicSamplingContextFromSpan(span) {
const client = exports$1.getClient();
if (!client) {
return {};
}
// passing emit=false here to only emit later once the DSC is actually populated
const dsc = getDynamicSamplingContextFromClient(spanUtils.spanToJSON(span).trace_id || '', client, exports$1.getCurrentScope());
// As long as we use `Transaction`s internally, this should be fine.
// TODO: We need to replace this with a `getRootSpan(span)` function though
const txn = span.transaction ;
if (!txn) {
return dsc;
}
// TODO (v8): Remove v7FrozenDsc as a Transaction will no longer have _frozenDynamicSamplingContext
// For now we need to avoid breaking users who directly created a txn with a DSC, where this field is still set.
// @see Transaction class constructor
const v7FrozenDsc = txn && txn._frozenDynamicSamplingContext;
if (v7FrozenDsc) {
return v7FrozenDsc;
}
// TODO (v8): Replace txn.metadata with txn.attributes[]
// We can't do this yet because attributes aren't always set yet.
// eslint-disable-next-line deprecation/deprecation
const { sampleRate: maybeSampleRate, source } = txn.metadata;
if (maybeSampleRate != null) {
dsc.sample_rate = `${maybeSampleRate}`;
}
// We don't want to have a transaction name in the DSC if the source is "url" because URLs might contain PII
const jsonSpan = spanUtils.spanToJSON(txn);
// after JSON conversion, txn.name becomes jsonSpan.description
if (source && source !== 'url') {
dsc.transaction = jsonSpan.description;
}
dsc.sampled = String(spanUtils.spanIsSampled(txn));
client.emit && client.emit('createDsc', dsc);
return dsc;
}
exports.getDynamicSamplingContextFromClient = getDynamicSamplingContextFromClient;
exports.getDynamicSamplingContextFromSpan = getDynamicSamplingContextFromSpan;
//# sourceMappingURL=dynamicSamplingContext.js.map

@@ -26,2 +26,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

function errorCallback() {
// eslint-disable-next-line deprecation/deprecation
const activeTransaction = utils$1.getActiveTransaction();

@@ -28,0 +29,0 @@ if (activeTransaction) {

@@ -15,2 +15,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

const scope = this.getScope();
// eslint-disable-next-line deprecation/deprecation
const span = scope.getSpan();

@@ -58,5 +59,7 @@

// eslint-disable-next-line deprecation/deprecation
transactionContext.sampled = false;
}
// eslint-disable-next-line deprecation/deprecation
let transaction$1 = new transaction.Transaction(transactionContext, this);

@@ -68,3 +71,3 @@ transaction$1 = sampling.sampleTransaction(transaction$1, options, {

});
if (transaction$1.sampled) {
if (transaction$1.isRecording()) {
transaction$1.initSpanRecorder(options._experiments && (options._experiments.maxSpans ));

@@ -93,2 +96,3 @@ }

// eslint-disable-next-line deprecation/deprecation
let transaction = new idletransaction.IdleTransaction(transactionContext, hub, idleTimeout, finalTimeout, heartbeatInterval, onScope);

@@ -100,3 +104,3 @@ transaction = sampling.sampleTransaction(transaction, options, {

});
if (transaction.sampled) {
if (transaction.isRecording()) {
transaction.initSpanRecorder(options._experiments && (options._experiments.maxSpans ));

@@ -103,0 +107,0 @@ }

@@ -5,5 +5,5 @@ Object.defineProperty(exports, '__esModule', { value: true });

const debugBuild = require('../debug-build.js');
const spanUtils = require('../utils/spanUtils.js');
const span = require('./span.js');
const transaction = require('./transaction.js');
const utils$1 = require('./utils.js');

@@ -45,3 +45,3 @@ const TRACING_DEFAULTS = {

// the transaction that this span recorder belongs to.
if (span.spanId !== this.transactionSpanId) {
if (span.spanContext().spanId !== this.transactionSpanId) {
// We patch span.end() to pop an activity after setting an endTimestamp.

@@ -51,3 +51,3 @@ // eslint-disable-next-line @typescript-eslint/unbound-method

span.end = (...rest) => {
this._popActivity(span.spanId);
this._popActivity(span.spanContext().spanId);
return originalEnd.apply(span, rest);

@@ -58,3 +58,3 @@ };

if (span.endTimestamp === undefined) {
this._pushActivity(span.spanId);
this._pushActivity(span.spanContext().spanId);
}

@@ -87,2 +87,5 @@ }

/**
* @deprecated Transactions will be removed in v8. Use spans instead.
*/
constructor(

@@ -115,3 +118,4 @@ transactionContext,

// context and attach it to the error.
debugBuild.DEBUG_BUILD && utils.logger.log(`Setting idle transaction on scope. Span ID: ${this.spanId}`);
debugBuild.DEBUG_BUILD && utils.logger.log(`Setting idle transaction on scope. Span ID: ${this.spanContext().spanId}`);
// eslint-disable-next-line deprecation/deprecation
_idleHub.getScope().setSpan(this);

@@ -131,4 +135,4 @@ }

/** {@inheritDoc} */
end(endTimestamp = utils.timestampInSeconds()) {
const endTimestampInS = utils$1.ensureTimestampInSeconds(endTimestamp);
end(endTimestamp) {
const endTimestampInS = spanUtils.spanTimeInputToSeconds(endTimestamp);

@@ -139,3 +143,3 @@ this._finished = true;

if (this.op === 'ui.action.click') {
this.setTag(FINISH_REASON_TAG, this._finishReason);
this.setAttribute(FINISH_REASON_TAG, this._finishReason);
}

@@ -148,3 +152,3 @@

for (const callback of this._beforeFinishCallbacks) {
callback(this, endTimestamp);
callback(this, endTimestampInS);
}

@@ -154,3 +158,3 @@

// If we are dealing with the transaction itself, we just return it
if (span.spanId === this.spanId) {
if (span.spanContext().spanId === this.spanContext().spanId) {
return true;

@@ -193,3 +197,5 @@ }

const scope = this._idleHub.getScope();
// eslint-disable-next-line deprecation/deprecation
if (scope.getTransaction() === this) {
// eslint-disable-next-line deprecation/deprecation
scope.setSpan(undefined);

@@ -231,3 +237,3 @@ }

this.spanRecorder = new IdleTransactionSpanRecorder(pushActivity, popActivity, this.spanId, maxlen);
this.spanRecorder = new IdleTransactionSpanRecorder(pushActivity, popActivity, this.spanContext().spanId, maxlen);

@@ -234,0 +240,0 @@ // Start heartbeat so that transactions do not run forever.

@@ -9,2 +9,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

function setMeasurement(name, value, unit) {
// eslint-disable-next-line deprecation/deprecation
const transaction = utils.getActiveTransaction();

@@ -11,0 +12,0 @@ if (transaction) {

@@ -5,3 +5,5 @@ Object.defineProperty(exports, '__esModule', { value: true });

const debugBuild = require('../debug-build.js');
const semanticAttributes = require('../semanticAttributes.js');
const hasTracingEnabled = require('../utils/hasTracingEnabled.js');
const spanUtils = require('../utils/spanUtils.js');

@@ -24,2 +26,3 @@ /**

if (!hasTracingEnabled.hasTracingEnabled(options)) {
// eslint-disable-next-line deprecation/deprecation
transaction.sampled = false;

@@ -30,6 +33,6 @@ return transaction;

// if the user has forced a sampling decision by passing a `sampled` value in their transaction context, go with that
// eslint-disable-next-line deprecation/deprecation
if (transaction.sampled !== undefined) {
transaction.setMetadata({
sampleRate: Number(transaction.sampled),
});
// eslint-disable-next-line deprecation/deprecation
transaction.setAttribute(semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, Number(transaction.sampled));
return transaction;

@@ -43,5 +46,3 @@ }

sampleRate = options.tracesSampler(samplingContext);
transaction.setMetadata({
sampleRate: Number(sampleRate),
});
transaction.setAttribute(semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, Number(sampleRate));
} else if (samplingContext.parentSampled !== undefined) {

@@ -51,11 +52,7 @@ sampleRate = samplingContext.parentSampled;

sampleRate = options.tracesSampleRate;
transaction.setMetadata({
sampleRate: Number(sampleRate),
});
transaction.setAttribute(semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, Number(sampleRate));
} else {
// When `enableTracing === true`, we use a sample rate of 100%
sampleRate = 1;
transaction.setMetadata({
sampleRate,
});
transaction.setAttribute(semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, sampleRate);
}

@@ -67,2 +64,3 @@

debugBuild.DEBUG_BUILD && utils.logger.warn('[Tracing] Discarding transaction because of invalid sample rate.');
// eslint-disable-next-line deprecation/deprecation
transaction.sampled = false;

@@ -82,2 +80,3 @@ return transaction;

);
// eslint-disable-next-line deprecation/deprecation
transaction.sampled = false;

@@ -89,5 +88,7 @@ return transaction;

// a boolean, the < comparison will cause it to be automatically cast to 1 if it's true and 0 if it's false.
// eslint-disable-next-line deprecation/deprecation
transaction.sampled = Math.random() < (sampleRate );
// if we're not going to keep it, we're done
// eslint-disable-next-line deprecation/deprecation
if (!transaction.sampled) {

@@ -103,3 +104,4 @@ debugBuild.DEBUG_BUILD &&

debugBuild.DEBUG_BUILD && utils.logger.log(`[Tracing] starting ${transaction.op} transaction - ${transaction.name}`);
debugBuild.DEBUG_BUILD &&
utils.logger.log(`[Tracing] starting ${transaction.op} transaction - ${spanUtils.spanToJSON(transaction).description}`);
return transaction;

@@ -106,0 +108,0 @@ }

@@ -6,3 +6,2 @@ Object.defineProperty(exports, '__esModule', { value: true });

const spanUtils = require('../utils/spanUtils.js');
const utils$1 = require('./utils.js');

@@ -46,10 +45,2 @@ /**

/**
* @inheritDoc
*/
/**
* @inheritDoc
*/
/**
* Internal keeper of the status

@@ -59,6 +50,2 @@ */

/**
* @inheritDoc
*/
/**
* Timestamp in seconds when the span was created.

@@ -76,19 +63,13 @@ */

/**
* @inheritDoc
* Tags for the span.
* @deprecated Use `getSpanAttributes(span)` instead.
*/
/**
* @inheritDoc
* Data for the span.
* @deprecated Use `getSpanAttributes(span)` instead.
*/
/**
* @inheritDoc
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
/**
* @inheritDoc
*/
/**
* List of spans that were finalized

@@ -117,10 +98,14 @@ */

constructor(spanContext = {}) {
this.traceId = spanContext.traceId || utils.uuid4();
this.spanId = spanContext.spanId || utils.uuid4().substring(16);
this._traceId = spanContext.traceId || utils.uuid4();
this._spanId = spanContext.spanId || utils.uuid4().substring(16);
this.startTimestamp = spanContext.startTimestamp || utils.timestampInSeconds();
this.tags = spanContext.tags || {};
this.data = spanContext.data || {};
this.attributes = spanContext.attributes || {};
// eslint-disable-next-line deprecation/deprecation
this.tags = spanContext.tags ? { ...spanContext.tags } : {};
// eslint-disable-next-line deprecation/deprecation
this.data = spanContext.data ? { ...spanContext.data } : {};
this._attributes = spanContext.attributes ? { ...spanContext.attributes } : {};
this.instrumenter = spanContext.instrumenter || 'sentry';
this.origin = spanContext.origin || 'manual';
// eslint-disable-next-line deprecation/deprecation
this._name = spanContext.name || spanContext.description;

@@ -132,3 +117,3 @@ if (spanContext.parentSpanId) {

if ('sampled' in spanContext) {
this.sampled = spanContext.sampled;
this._sampled = spanContext.sampled;
}

@@ -138,8 +123,2 @@ if (spanContext.op) {

}
if (spanContext.description) {
this.description = spanContext.description;
}
if (spanContext.name) {
this.description = spanContext.name;
}
if (spanContext.status) {

@@ -153,8 +132,16 @@ this.status = spanContext.status;

/** An alias for `description` of the Span. */
// This rule conflicts with another eslint rule :(
/* eslint-disable @typescript-eslint/member-ordering */
/**
* An alias for `description` of the Span.
* @deprecated Use `spanToJSON(span).description` instead.
*/
get name() {
return this.description || '';
return this._name || '';
}
/**
* Update the name of the span.
* @deprecated Use `spanToJSON(span).description` instead.
*/

@@ -166,4 +153,99 @@ set name(name) {

/**
* @inheritDoc
* Get the description of the Span.
* @deprecated Use `spanToJSON(span).description` instead.
*/
get description() {
return this._name;
}
/**
* Get the description of the Span.
* @deprecated Use `spanToJSON(span).description` instead.
*/
set description(description) {
this._name = description;
}
/**
* The ID of the trace.
* @deprecated Use `spanContext().traceId` instead.
*/
get traceId() {
return this._traceId;
}
/**
* The ID of the trace.
* @deprecated You cannot update the traceId of a span after span creation.
*/
set traceId(traceId) {
this._traceId = traceId;
}
/**
* The ID of the span.
* @deprecated Use `spanContext().spanId` instead.
*/
get spanId() {
return this._spanId;
}
/**
* The ID of the span.
* @deprecated You cannot update the spanId of a span after span creation.
*/
set spanId(spanId) {
this._spanId = spanId;
}
/**
* Was this span chosen to be sent as part of the sample?
* @deprecated Use `isRecording()` instead.
*/
get sampled() {
return this._sampled;
}
/**
* Was this span chosen to be sent as part of the sample?
* @deprecated You cannot update the sampling decision of a span after span creation.
*/
set sampled(sampled) {
this._sampled = sampled;
}
/**
* Attributes for the span.
* @deprecated Use `getSpanAttributes(span)` instead.
*/
get attributes() {
return this._attributes;
}
/**
* Attributes for the span.
* @deprecated Use `setAttributes()` instead.
*/
set attributes(attributes) {
this._attributes = attributes;
}
/* eslint-enable @typescript-eslint/member-ordering */
/** @inheritdoc */
spanContext() {
const { _spanId: spanId, _traceId: traceId, _sampled: sampled } = this;
return {
spanId,
traceId,
traceFlags: sampled ? spanUtils.TRACE_FLAG_SAMPLED : spanUtils.TRACE_FLAG_NONE,
};
}
/**
* Creates a new `Span` while setting the current `Span.id` as `parentSpanId`.
* Also the `sampled` decision will be inherited.
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/
startChild(

@@ -174,5 +256,5 @@ spanContext,

...spanContext,
parentSpanId: this.spanId,
sampled: this.sampled,
traceId: this.traceId,
parentSpanId: this._spanId,
sampled: this._sampled,
traceId: this._traceId,
});

@@ -189,8 +271,8 @@

const opStr = (spanContext && spanContext.op) || '< unknown op >';
const nameStr = childSpan.transaction.name || '< unknown name >';
const idStr = childSpan.transaction.spanId;
const nameStr = spanUtils.spanToJSON(childSpan).description || '< unknown name >';
const idStr = childSpan.transaction.spanContext().spanId;
const logMessage = `[Tracing] Starting '${opStr}' span on transaction '${nameStr}' (${idStr}).`;
childSpan.transaction.metadata.spanMetadata[childSpan.spanId] = { logMessage };
utils.logger.log(logMessage);
this._logMessage = logMessage;
}

@@ -202,5 +284,12 @@

/**
* @inheritDoc
* Sets the tag attribute on the current span.
*
* Can also be used to unset a tag, by passing `undefined`.
*
* @param key Tag key
* @param value Tag value
* @deprecated Use `setAttribute()` instead.
*/
setTag(key, value) {
// eslint-disable-next-line deprecation/deprecation
this.tags = { ...this.tags, [key]: value };

@@ -211,6 +300,10 @@ return this;

/**
* @inheritDoc
* Sets the data attribute on the current span
* @param key Data key
* @param value Data value
* @deprecated Use `setAttribute()` instead.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
setData(key, value) {
// eslint-disable-next-line deprecation/deprecation
this.data = { ...this.data, [key]: value };

@@ -224,5 +317,5 @@ return this;

// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete this.attributes[key];
delete this._attributes[key];
} else {
this.attributes[key] = value;
this._attributes[key] = value;
}

@@ -248,3 +341,5 @@ }

setHttpStatus(httpStatus) {
// eslint-disable-next-line deprecation/deprecation
this.setTag('http.status_code', String(httpStatus));
// eslint-disable-next-line deprecation/deprecation
this.setData('http.response.status_code', httpStatus);

@@ -267,3 +362,3 @@ const spanStatus = spanStatusfromHttpCode(httpStatus);

updateName(name) {
this.description = name;
this._name = name;
return this;

@@ -294,5 +389,5 @@ }

this.transaction &&
this.transaction.spanId !== this.spanId
this.transaction.spanContext().spanId !== this._spanId
) {
const { logMessage } = this.transaction.metadata.spanMetadata[this.spanId];
const logMessage = this._logMessage;
if (logMessage) {

@@ -303,4 +398,3 @@ utils.logger.log((logMessage ).replace('Starting', 'Finishing'));

this.endTimestamp =
typeof endTimestamp === 'number' ? utils$1.ensureTimestampInSeconds(endTimestamp) : utils.timestampInSeconds();
this.endTimestamp = spanUtils.spanTimeInputToSeconds(endTimestamp);
}

@@ -321,12 +415,13 @@

data: this._getData(),
description: this.description,
description: this._name,
endTimestamp: this.endTimestamp,
op: this.op,
parentSpanId: this.parentSpanId,
sampled: this.sampled,
spanId: this.spanId,
sampled: this._sampled,
spanId: this._spanId,
startTimestamp: this.startTimestamp,
status: this.status,
// eslint-disable-next-line deprecation/deprecation
tags: this.tags,
traceId: this.traceId,
traceId: this._traceId,
});

@@ -339,13 +434,16 @@ }

updateWithContext(spanContext) {
// eslint-disable-next-line deprecation/deprecation
this.data = spanContext.data || {};
this.description = spanContext.description;
// eslint-disable-next-line deprecation/deprecation
this._name = spanContext.name || spanContext.description;
this.endTimestamp = spanContext.endTimestamp;
this.op = spanContext.op;
this.parentSpanId = spanContext.parentSpanId;
this.sampled = spanContext.sampled;
this.spanId = spanContext.spanId || this.spanId;
this._sampled = spanContext.sampled;
this._spanId = spanContext.spanId || this._spanId;
this.startTimestamp = spanContext.startTimestamp || this.startTimestamp;
this.status = spanContext.status;
// eslint-disable-next-line deprecation/deprecation
this.tags = spanContext.tags || {};
this.traceId = spanContext.traceId || this.traceId;
this._traceId = spanContext.traceId || this._traceId;

@@ -363,18 +461,17 @@ return this;

/**
* @inheritDoc
* Get JSON representation of this span.
*/
toJSON()
{
getSpanJSON() {
return utils.dropUndefinedKeys({
data: this._getData(),
description: this.description,
description: this._name,
op: this.op,
parent_span_id: this.parentSpanId,
span_id: this.spanId,
span_id: this._spanId,
start_timestamp: this.startTimestamp,
status: this.status,
// eslint-disable-next-line deprecation/deprecation
tags: Object.keys(this.tags).length > 0 ? this.tags : undefined,
timestamp: this.endTimestamp,
trace_id: this.traceId,
trace_id: this._traceId,
origin: this.origin,

@@ -384,3 +481,16 @@ });

/** @inheritdoc */
isRecording() {
return !this.endTimestamp && !!this._sampled;
}
/**
* Convert the object to JSON.
* @deprecated Use `spanToJSON(span)` instead.
*/
toJSON() {
return this.getSpanJSON();
}
/**
* Get the merged data for this span.

@@ -393,3 +503,4 @@ * For now, this combines `data` and `attributes` together,

{
const { data, attributes } = this;
// eslint-disable-next-line deprecation/deprecation
const { data, _attributes: attributes } = this;

@@ -396,0 +507,0 @@ const hasData = Object.keys(data).length > 0;

@@ -9,2 +9,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

const hasTracingEnabled = require('../utils/hasTracingEnabled.js');
const spanUtils = require('../utils/spanUtils.js');

@@ -33,10 +34,11 @@ /**

) {
const ctx = normalizeContext(context);
const hub$1 = hub.getCurrentHub();
const scope = exports$1.getCurrentScope();
// eslint-disable-next-line deprecation/deprecation
const parentSpan = scope.getSpan();
const ctx = normalizeContext(context);
const activeSpan = createChildSpanOrTransaction(hub$1, parentSpan, ctx);
// eslint-disable-next-line deprecation/deprecation
scope.setSpan(activeSpan);

@@ -52,2 +54,3 @@

activeSpan && activeSpan.end();
// eslint-disable-next-line deprecation/deprecation
scope.setSpan(parentSpan);

@@ -73,7 +76,9 @@ afterFinish();

return exports$1.withScope(scope => {
return exports$1.withScope(context.scope, scope => {
const hub$1 = hub.getCurrentHub();
// eslint-disable-next-line deprecation/deprecation
const parentSpan = scope.getSpan();
const activeSpan = createChildSpanOrTransaction(hub$1, parentSpan, ctx);
// eslint-disable-next-line deprecation/deprecation
scope.setSpan(activeSpan);

@@ -116,7 +121,9 @@

return exports$1.withScope(scope => {
return exports$1.withScope(context.scope, scope => {
const hub$1 = hub.getCurrentHub();
// eslint-disable-next-line deprecation/deprecation
const parentSpan = scope.getSpan();
const activeSpan = createChildSpanOrTransaction(hub$1, parentSpan, ctx);
// eslint-disable-next-line deprecation/deprecation
scope.setSpan(activeSpan);

@@ -155,11 +162,13 @@

const ctx = { ...context };
// If a name is set and a description is not, set the description to the name.
if (ctx.name !== undefined && ctx.description === undefined) {
ctx.description = ctx.name;
}
const ctx = normalizeContext(context);
const hub$1 = hub.getCurrentHub();
const parentSpan = getActiveSpan();
return parentSpan ? parentSpan.startChild(ctx) : hub$1.startTransaction(ctx);
const parentSpan = context.scope
? // eslint-disable-next-line deprecation/deprecation
context.scope.getSpan()
: getActiveSpan();
return parentSpan
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub$1.startTransaction(ctx);
}

@@ -171,2 +180,3 @@

function getActiveSpan() {
// eslint-disable-next-line deprecation/deprecation
return exports$1.getCurrentScope().getSpan();

@@ -226,13 +236,25 @@ }

}
return parentSpan ? parentSpan.startChild(ctx) : hub.startTransaction(ctx);
return parentSpan
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
/**
* This converts StartSpanOptions to TransactionContext.
* For the most part (for now) we accept the same options,
* but some of them need to be transformed.
*
* Eventually the StartSpanOptions will be more aligned with OpenTelemetry.
*/
function normalizeContext(context) {
const ctx = { ...context };
// If a name is set and a description is not, set the description to the name.
if (ctx.name !== undefined && ctx.description === undefined) {
ctx.description = ctx.name;
if (context.startTime) {
const ctx = { ...context };
ctx.startTimestamp = spanUtils.spanTimeInputToSeconds(context.startTime);
delete ctx.startTime;
return ctx;
}
return ctx;
return context;
}

@@ -239,0 +261,0 @@

Object.defineProperty(exports, '__esModule', { value: true });
const utils$1 = require('@sentry/utils');
const utils = require('@sentry/utils');
const debugBuild = require('../debug-build.js');
const hub = require('../hub.js');
const semanticAttributes = require('../semanticAttributes.js');
const spanUtils = require('../utils/spanUtils.js');
const dynamicSamplingContext = require('./dynamicSamplingContext.js');
const span = require('./span.js');
const utils = require('./utils.js');
/** JSDoc */
class Transaction extends span.Span {
/**

@@ -18,2 +17,4 @@ * The reference to the current hub.

// DO NOT yet remove this property, it is used in a hack for v7 backwards compatibility.
/**

@@ -25,9 +26,7 @@ * This constructor should never be called manually. Those instrumenting tracing should use

* @hidden
*
* @deprecated Transactions will be removed in v8. Use spans instead.
*/
constructor(transactionContext, hub$1) {
super(transactionContext);
// We need to delete description since it's set by the Span class constructor
// but not needed for transactions.
delete this.description;
this._measurements = {};

@@ -40,6 +39,5 @@ this._contexts = {};

this.metadata = {
source: 'custom',
this._metadata = {
// eslint-disable-next-line deprecation/deprecation
...transactionContext.metadata,
spanMetadata: {},
};

@@ -54,3 +52,3 @@

// there is incoming Dynamic Sampling Context. (Either through an incoming request, a baggage meta-tag, or other means)
const incomingDynamicSamplingContext = this.metadata.dynamicSamplingContext;
const incomingDynamicSamplingContext = this._metadata.dynamicSamplingContext;
if (incomingDynamicSamplingContext) {

@@ -62,3 +60,9 @@ // We shallow copy this in case anything writes to the original reference of the passed in `dynamicSamplingContext`

/** Getter for `name` property */
// This sadly conflicts with the getter/setter ordering :(
/* eslint-disable @typescript-eslint/member-ordering */
/**
* Getter for `name` property.
* @deprecated Use `spanToJSON(span).description` instead.
*/
get name() {

@@ -70,2 +74,3 @@ return this._name;

* Setter for `name` property, which also sets `source` as custom.
* @deprecated Use `updateName()` and `setMetadata()` instead.
*/

@@ -78,2 +83,37 @@ set name(newName) {

/**
* Get the metadata for this transaction.
* @deprecated Use `spanGetMetadata(transaction)` instead.
*/
get metadata() {
// We merge attributes in for backwards compatibility
return {
// Defaults
// eslint-disable-next-line deprecation/deprecation
source: 'custom',
spanMetadata: {},
// Legacy metadata
...this._metadata,
// From attributes
...(this._attributes[semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] && {
source: this._attributes[semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] ,
}),
...(this._attributes[semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE] && {
sampleRate: this._attributes[semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE] ,
}),
};
}
/**
* Update the metadata for this transaction.
* @deprecated Use `spanGetMetadata(transaction)` instead.
*/
set metadata(metadata) {
this._metadata = metadata;
}
/* eslint-enable @typescript-eslint/member-ordering */
/**
* Setter for `name` property, which also sets `source` on the metadata.

@@ -85,3 +125,3 @@ *

this._name = name;
this.metadata.source = source;
this.setAttribute(semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);
}

@@ -107,3 +147,4 @@

/**
* @inheritDoc
* Set the context of a transaction event.
* @deprecated Use either `.setAttribute()`, or set the context on the scope before creating the transaction.
*/

@@ -127,6 +168,7 @@ setContext(key, context) {

/**
* @inheritDoc
* Store metadata on this transaction.
* @deprecated Use attributes or store data on the scope instead.
*/
setMetadata(newMetadata) {
this.metadata = { ...this.metadata, ...newMetadata };
this._metadata = { ...this._metadata, ...newMetadata };
}

@@ -138,4 +180,3 @@

end(endTimestamp) {
const timestampInS =
typeof endTimestamp === 'number' ? utils.ensureTimestampInSeconds(endTimestamp) : utils$1.timestampInSeconds();
const timestampInS = spanUtils.spanTimeInputToSeconds(endTimestamp);
const transaction = this._finishTransaction(timestampInS);

@@ -145,2 +186,3 @@ if (!transaction) {

}
// eslint-disable-next-line deprecation/deprecation
return this._hub.captureEvent(transaction);

@@ -156,5 +198,5 @@ }

return utils$1.dropUndefinedKeys({
return utils.dropUndefinedKeys({
...spanContext,
name: this.name,
name: this._name,
trimEnd: this._trimEnd,

@@ -171,4 +213,3 @@ });

this.name = transactionContext.name || '';
this._name = transactionContext.name || '';
this._trimEnd = transactionContext.trimEnd;

@@ -183,35 +224,7 @@

* @experimental
*
* @deprecated Use top-level `getDynamicSamplingContextFromSpan` instead.
*/
getDynamicSamplingContext() {
if (this._frozenDynamicSamplingContext) {
return this._frozenDynamicSamplingContext;
}
const hub$1 = this._hub || hub.getCurrentHub();
const client = hub$1.getClient();
if (!client) return {};
const scope = hub$1.getScope();
const dsc = dynamicSamplingContext.getDynamicSamplingContextFromClient(this.traceId, client, scope);
const maybeSampleRate = this.metadata.sampleRate;
if (maybeSampleRate !== undefined) {
dsc.sample_rate = `${maybeSampleRate}`;
}
// We don't want to have a transaction name in the DSC if the source is "url" because URLs might contain PII
const source = this.metadata.source;
if (source && source !== 'url') {
dsc.transaction = this.name;
}
if (this.sampled !== undefined) {
dsc.sampled = String(this.sampled);
}
// Uncomment if we want to make DSC immutable
// this._frozenDynamicSamplingContext = dsc;
return dsc;
return dynamicSamplingContext.getDynamicSamplingContextFromSpan(this);
}

@@ -238,5 +251,5 @@

if (!this.name) {
debugBuild.DEBUG_BUILD && utils$1.logger.warn('Transaction has no name, falling back to `<unlabeled transaction>`.');
this.name = '<unlabeled transaction>';
if (!this._name) {
debugBuild.DEBUG_BUILD && utils.logger.warn('Transaction has no name, falling back to `<unlabeled transaction>`.');
this._name = '<unlabeled transaction>';
}

@@ -252,5 +265,5 @@

if (this.sampled !== true) {
if (this._sampled !== true) {
// At this point if `sampled !== true` we want to discard the transaction.
debugBuild.DEBUG_BUILD && utils$1.logger.log('[Tracing] Discarding transaction because its trace was not chosen to be sampled.');
debugBuild.DEBUG_BUILD && utils.logger.log('[Tracing] Discarding transaction because its trace was not chosen to be sampled.');

@@ -275,3 +288,6 @@ if (client) {

const metadata = this.metadata;
// eslint-disable-next-line deprecation/deprecation
const { metadata } = this;
// eslint-disable-next-line deprecation/deprecation
const { source } = metadata;

@@ -284,15 +300,17 @@ const transaction = {

},
// TODO: Pass spans serialized via `spanToJSON()` here instead in v8.
spans: finishedSpans,
start_timestamp: this.startTimestamp,
// eslint-disable-next-line deprecation/deprecation
tags: this.tags,
timestamp: this.endTimestamp,
transaction: this.name,
transaction: this._name,
type: 'transaction',
sdkProcessingMetadata: {
...metadata,
dynamicSamplingContext: this.getDynamicSamplingContext(),
dynamicSamplingContext: dynamicSamplingContext.getDynamicSamplingContextFromSpan(this),
},
...(metadata.source && {
...(source && {
transaction_info: {
source: metadata.source,
source,
},

@@ -306,3 +324,3 @@ }),

debugBuild.DEBUG_BUILD &&
utils$1.logger.log(
utils.logger.log(
'[Measurements] Adding measurements to transaction',

@@ -314,3 +332,3 @@ JSON.stringify(this._measurements, undefined, 2),

debugBuild.DEBUG_BUILD && utils$1.logger.log(`[Tracing] Finishing ${this.op} transaction: ${this.name}.`);
debugBuild.DEBUG_BUILD && utils.logger.log(`[Tracing] Finishing ${this.op} transaction: ${this._name}.`);

@@ -317,0 +335,0 @@ return transaction;

@@ -6,6 +6,11 @@ Object.defineProperty(exports, '__esModule', { value: true });

/** Grabs active transaction off scope, if any */
/**
* Grabs active transaction off scope.
*
* @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
*/
function getActiveTransaction(maybeHub) {
const hub$1 = maybeHub || hub.getCurrentHub();
const scope = hub$1.getScope();
// eslint-disable-next-line deprecation/deprecation
return scope.getTransaction() ;

@@ -28,14 +33,5 @@ }

/**
* Converts a timestamp to second, if it was in milliseconds, or keeps it as second.
*/
function ensureTimestampInSeconds(timestamp) {
const isMs = timestamp > 9999999999;
return isMs ? timestamp / 1000 : timestamp;
}
exports.stripUrlQueryAndFragment = utils.stripUrlQueryAndFragment;
exports.ensureTimestampInSeconds = ensureTimestampInSeconds;
exports.extractTraceparentData = extractTraceparentData;
exports.getActiveTransaction = getActiveTransaction;
//# sourceMappingURL=utils.js.map
Object.defineProperty(exports, '__esModule', { value: true });
const utils = require('@sentry/utils');
const dynamicSamplingContext = require('../tracing/dynamicSamplingContext.js');
const spanUtils = require('./spanUtils.js');

@@ -41,2 +42,3 @@

propagationContext,
// eslint-disable-next-line deprecation/deprecation
transactionName,

@@ -57,2 +59,3 @@ span,

if (transactionName) {
// eslint-disable-next-line deprecation/deprecation
data.transactionName = transactionName;

@@ -97,3 +100,11 @@ }

function applyDataToEvent(event, data) {
const { extra, tags, user, contexts, level, transactionName } = data;
const {
extra,
tags,
user,
contexts,
level,
// eslint-disable-next-line deprecation/deprecation
transactionName,
} = data;

@@ -142,6 +153,6 @@ if (extra && Object.keys(extra).length) {

event.sdkProcessingMetadata = {
dynamicSamplingContext: transaction.getDynamicSamplingContext(),
dynamicSamplingContext: dynamicSamplingContext.getDynamicSamplingContextFromSpan(span),
...event.sdkProcessingMetadata,
};
const transactionName = transaction.name;
const transactionName = spanUtils.spanToJSON(transaction).description;
if (transactionName) {

@@ -148,0 +159,0 @@ event.tags = { transaction: transactionName, ...event.tags };

@@ -8,2 +8,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

const applyScopeDataToEvent = require('./applyScopeDataToEvent.js');
const spanUtils = require('./spanUtils.js');

@@ -317,6 +318,10 @@ /**

normalized.spans = event.spans.map(span => {
// We cannot use the spread operator here because `toJSON` on `span` is non-enumerable
if (span.data) {
span.data = utils.normalize(span.data, depth, maxBreadth);
const data = spanUtils.spanToJSON(span).data;
if (data) {
// This is a bit weird, as we generally have `Span` instances here, but to be safe we do not assume so
// eslint-disable-next-line deprecation/deprecation
span.data = utils.normalize(data, depth, maxBreadth);
}
return span;

@@ -323,0 +328,0 @@ });

@@ -5,2 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });

// These are aligned with OpenTelemetry trace flags
const TRACE_FLAG_NONE = 0x0;
const TRACE_FLAG_SAMPLED = 0x1;
/**

@@ -10,7 +14,7 @@ * Convert a span to a trace context, which can be sent as the `trace` context in an event.

function spanToTraceContext(span) {
const { data, description, op, parent_span_id, span_id, status, tags, trace_id, origin } = span.toJSON();
const { spanId: span_id, traceId: trace_id } = span.spanContext();
const { data, op, parent_span_id, status, tags, origin } = spanToJSON(span);
return utils.dropUndefinedKeys({
data,
description,
op,

@@ -30,7 +34,88 @@ parent_span_id,

function spanToTraceHeader(span) {
return utils.generateSentryTraceHeader(span.traceId, span.spanId, span.sampled);
const { traceId, spanId } = span.spanContext();
const sampled = spanIsSampled(span);
return utils.generateSentryTraceHeader(traceId, spanId, sampled);
}
/**
* Convert a span time input intp a timestamp in seconds.
*/
function spanTimeInputToSeconds(input) {
if (typeof input === 'number') {
return ensureTimestampInSeconds(input);
}
if (Array.isArray(input)) {
// See {@link HrTime} for the array-based time format
return input[0] + input[1] / 1e9;
}
if (input instanceof Date) {
return ensureTimestampInSeconds(input.getTime());
}
return utils.timestampInSeconds();
}
/**
* Converts a timestamp to second, if it was in milliseconds, or keeps it as second.
*/
function ensureTimestampInSeconds(timestamp) {
const isMs = timestamp > 9999999999;
return isMs ? timestamp / 1000 : timestamp;
}
/**
* Convert a span to a JSON representation.
* Note that all fields returned here are optional and need to be guarded against.
*
* Note: Because of this, we currently have a circular type dependency (which we opted out of in package.json).
* This is not avoidable as we need `spanToJSON` in `spanUtils.ts`, which in turn is needed by `span.ts` for backwards compatibility.
* And `spanToJSON` needs the Span class from `span.ts` to check here.
* TODO v8: When we remove the deprecated stuff from `span.ts`, we can remove the circular dependency again.
*/
function spanToJSON(span) {
if (spanIsSpanClass(span)) {
return span.getSpanJSON();
}
// Fallback: We also check for `.toJSON()` here...
// eslint-disable-next-line deprecation/deprecation
if (typeof span.toJSON === 'function') {
// eslint-disable-next-line deprecation/deprecation
return span.toJSON();
}
return {};
}
/**
* Sadly, due to circular dependency checks we cannot actually import the Span class here and check for instanceof.
* :( So instead we approximate this by checking if it has the `getSpanJSON` method.
*/
function spanIsSpanClass(span) {
return typeof (span ).getSpanJSON === 'function';
}
/**
* Returns true if a span is sampled.
* In most cases, you should just use `span.isRecording()` instead.
* However, this has a slightly different semantic, as it also returns false if the span is finished.
* So in the case where this distinction is important, use this method.
*/
function spanIsSampled(span) {
// We align our trace flags with the ones OpenTelemetry use
// So we also check for sampled the same way they do.
const { traceFlags } = span.spanContext();
// eslint-disable-next-line no-bitwise
return Boolean(traceFlags & TRACE_FLAG_SAMPLED);
}
exports.TRACE_FLAG_NONE = TRACE_FLAG_NONE;
exports.TRACE_FLAG_SAMPLED = TRACE_FLAG_SAMPLED;
exports.spanIsSampled = spanIsSampled;
exports.spanTimeInputToSeconds = spanTimeInputToSeconds;
exports.spanToJSON = spanToJSON;
exports.spanToTraceContext = spanToTraceContext;
exports.spanToTraceHeader = spanToTraceHeader;
//# sourceMappingURL=spanUtils.js.map
Object.defineProperty(exports, '__esModule', { value: true });
const SDK_VERSION = '7.92.0';
const SDK_VERSION = '7.93.0';
exports.SDK_VERSION = SDK_VERSION;
//# sourceMappingURL=version.js.map

@@ -1,2 +0,2 @@

import { makeDsn, logger, checkOrSetAlreadyCaught, isPrimitive, resolvedSyncPromise, addItemToEnvelope, createAttachmentEnvelopeItem, SyncPromise, rejectedSyncPromise, SentryError, isThenable, isPlainObject } from '@sentry/utils';
import { makeDsn, logger, checkOrSetAlreadyCaught, isParameterizedString, isPrimitive, resolvedSyncPromise, addItemToEnvelope, createAttachmentEnvelopeItem, SyncPromise, rejectedSyncPromise, SentryError, isThenable, isPlainObject } from '@sentry/utils';
import { getEnvelopeEndpointWithUrlEncodedAuth } from './api.js';

@@ -133,4 +133,6 @@ import { DEBUG_BUILD } from './debug-build.js';

const eventMessage = isParameterizedString(message) ? message : String(message);
const promisedEvent = isPrimitive(message)
? this.eventFromMessage(String(message), level, hint)
? this.eventFromMessage(eventMessage, level, hint)
: this.eventFromException(message, hint);

@@ -137,0 +139,0 @@

@@ -1,17 +0,14 @@

import { logger, uuid4, timestampInSeconds, isThenable } from '@sentry/utils';
import { logger, uuid4, timestampInSeconds, isThenable, GLOBAL_OBJ } from '@sentry/utils';
import { DEFAULT_ENVIRONMENT } from './constants.js';
import { DEBUG_BUILD } from './debug-build.js';
import { getCurrentHub } from './hub.js';
import { getCurrentHub, getIsolationScope } from './hub.js';
import { makeSession, updateSession, closeSession } from './session.js';
import { parseEventHintOrCaptureContext } from './utils/prepareEvent.js';
// Note: All functions in this file are typed with a return value of `ReturnType<Hub[HUB_FUNCTION]>`,
// where HUB_FUNCTION is some method on the Hub class.
//
// This is done to make sure the top level SDK methods stay in sync with the hub methods.
// Although every method here has an explicit return type, some of them (that map to void returns) do not
// contain `return` keywords. This is done to save on bundle size, as `return` is not minifiable.
/**
* Captures an exception event and sends it to Sentry.
* This accepts an event hint as optional second parameter.
* Alternatively, you can also pass a CaptureContext directly as second parameter.
*
* @param exception The exception to capture.
* @param hint Optinal additional data to attach to the Sentry event.
* @returns the id of the captured Sentry event.
*/

@@ -23,2 +20,3 @@ function captureException(

) {
// eslint-disable-next-line deprecation/deprecation
return getCurrentHub().captureException(exception, parseEventHintOrCaptureContext(hint));

@@ -30,5 +28,5 @@ }

*
* @param message The message to send to Sentry.
* @param Severity Define the level of the message.
* @returns The generated eventId.
* @param exception The exception to capture.
* @param captureContext Define the level of the message or pass in additional data to attach to the message.
* @returns the id of the captured message.
*/

@@ -44,2 +42,3 @@ function captureMessage(

const context = typeof captureContext !== 'string' ? { captureContext } : undefined;
// eslint-disable-next-line deprecation/deprecation
return getCurrentHub().captureMessage(message, level, context);

@@ -51,6 +50,8 @@ }

*
* @param event The event to send to Sentry.
* @returns The generated eventId.
* @param exception The event to send to Sentry.
* @param hint Optional additional data to attach to the Sentry event.
* @returns the id of the captured event.
*/
function captureEvent(event, hint) {
// eslint-disable-next-line deprecation/deprecation
return getCurrentHub().captureEvent(event, hint);

@@ -148,7 +149,25 @@ }

* popScope();
*
* @param callback that will be enclosed into push/popScope.
*/
function withScope(callback) {
return getCurrentHub().withScope(callback);
/**
* Either creates a new active scope, or sets the given scope as active scope in the given callback.
*/
function withScope(
...rest
) {
// If a scope is defined, we want to make this the active scope instead of the default one
if (rest.length === 2) {
const [scope, callback] = rest;
if (!scope) {
return getCurrentHub().withScope(callback);
}
const hub = getCurrentHub();
return hub.withScope(() => {
hub.getStackTop().scope = scope ;
return callback(scope );
});
}
return getCurrentHub().withScope(rest[0]);
}

@@ -175,2 +194,4 @@

* @returns The transaction which was just started
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/

@@ -181,2 +202,3 @@ function startTransaction(

) {
// eslint-disable-next-line deprecation/deprecation
return getCurrentHub().startTransaction({ ...context }, customSamplingContext);

@@ -307,3 +329,99 @@ }

export { addBreadcrumb, captureCheckIn, captureEvent, captureException, captureMessage, close, configureScope, flush, getClient, getCurrentScope, lastEventId, setContext, setExtra, setExtras, setTag, setTags, setUser, startTransaction, withMonitor, withScope };
/**
* Start a session on the current isolation scope.
*
* @param context (optional) additional properties to be applied to the returned session object
*
* @returns the new active session
*/
function startSession(context) {
const client = getClient();
const isolationScope = getIsolationScope();
const currentScope = getCurrentScope();
const { release, environment = DEFAULT_ENVIRONMENT } = (client && client.getOptions()) || {};
// Will fetch userAgent if called from browser sdk
const { userAgent } = GLOBAL_OBJ.navigator || {};
const session = makeSession({
release,
environment,
user: isolationScope.getUser(),
...(userAgent && { userAgent }),
...context,
});
// End existing session if there's one
const currentSession = isolationScope.getSession();
if (currentSession && currentSession.status === 'ok') {
updateSession(currentSession, { status: 'exited' });
}
endSession();
// Afterwards we set the new session on the scope
isolationScope.setSession(session);
// TODO (v8): Remove this and only use the isolation scope(?).
// For v7 though, we can't "soft-break" people using getCurrentHub().getScope().setSession()
currentScope.setSession(session);
return session;
}
/**
* End the session on the current isolation scope.
*/
function endSession() {
const isolationScope = getIsolationScope();
const currentScope = getCurrentScope();
const session = isolationScope.getSession();
if (session) {
closeSession(session);
}
_sendSessionUpdate();
// the session is over; take it off of the scope
isolationScope.setSession();
// TODO (v8): Remove this and only use the isolation scope(?).
// For v7 though, we can't "soft-break" people using getCurrentHub().getScope().setSession()
currentScope.setSession();
}
/**
* Sends the current Session on the scope
*/
function _sendSessionUpdate() {
const isolationScope = getIsolationScope();
const currentScope = getCurrentScope();
const client = getClient();
// TODO (v8): Remove currentScope and only use the isolation scope(?).
// For v7 though, we can't "soft-break" people using getCurrentHub().getScope().setSession()
const session = currentScope.getSession() || isolationScope.getSession();
if (session && client && client.captureSession) {
client.captureSession(session);
}
}
/**
* Sends the current session on the scope to Sentry
*
* @param end If set the session will be marked as exited and removed from the scope.
* Defaults to `false`.
*/
function captureSession(end = false) {
// both send the update and pull the session from the scope
if (end) {
endSession();
return;
}
// only send the update
_sendSessionUpdate();
}
export { addBreadcrumb, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, configureScope, endSession, flush, getClient, getCurrentScope, lastEventId, setContext, setExtra, setExtras, setTag, setTags, setUser, startSession, startTransaction, withMonitor, withScope };
//# sourceMappingURL=exports.js.map

@@ -84,2 +84,3 @@ import { isThenable, uuid4, dateTimestampInSeconds, consoleSandbox, logger, GLOBAL_OBJ, getGlobalSingleton } from '@sentry/utils';

top.client = client;
top.scope.setClient(client);
if (client && client.setupIntegrations) {

@@ -181,2 +182,4 @@ client.setupIntegrations();

* @inheritDoc
*
* @deprecated Use `Sentry.captureException()` instead.
*/

@@ -186,14 +189,9 @@ captureException(exception, hint) {

const syntheticException = new Error('Sentry syntheticException');
this._withClient((client, scope) => {
client.captureException(
exception,
{
originalException: exception,
syntheticException,
...hint,
event_id: eventId,
},
scope,
);
this.getScope().captureException(exception, {
originalException: exception,
syntheticException,
...hint,
event_id: eventId,
});
return eventId;

@@ -204,2 +202,4 @@ }

* @inheritDoc
*
* @deprecated Use `Sentry.captureMessage()` instead.
*/

@@ -214,15 +214,9 @@ captureMessage(

const syntheticException = new Error(message);
this._withClient((client, scope) => {
client.captureMessage(
message,
level,
{
originalException: message,
syntheticException,
...hint,
event_id: eventId,
},
scope,
);
this.getScope().captureMessage(message, level, {
originalException: message,
syntheticException,
...hint,
event_id: eventId,
});
return eventId;

@@ -233,2 +227,4 @@ }

* @inheritDoc
*
* @deprecated Use `Sentry.captureEvent()` instead.
*/

@@ -241,5 +237,3 @@ captureEvent(event, hint) {

this._withClient((client, scope) => {
client.captureEvent(event, { ...hint, event_id: eventId }, scope);
});
this.getScope().captureEvent(event, { ...hint, event_id: eventId });
return eventId;

@@ -365,3 +359,19 @@ }

/**
* @inheritDoc
* Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.
*
* A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a
* new child span within the transaction or any span, call the respective `.startChild()` method.
*
* Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.
*
* The transaction must be finished with a call to its `.end()` method, at which point the transaction with all its
* finished child spans will be sent to Sentry.
*
* @param context Properties of the new `Transaction`.
* @param customSamplingContext Information given to the transaction sampling function (along with context-dependent
* default values). See {@link Options.tracesSampler}.
*
* @returns The transaction which was just started
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/

@@ -397,2 +407,4 @@ startTransaction(context, customSamplingContext) {

* @inheritDoc
*
* @deprecated Use top level `captureSession` instead.
*/

@@ -402,2 +414,3 @@ captureSession(endSession = false) {

if (endSession) {
// eslint-disable-next-line deprecation/deprecation
return this.endSession();

@@ -412,2 +425,3 @@ }

* @inheritDoc
* @deprecated Use top level `endSession` instead.
*/

@@ -429,2 +443,3 @@ endSession() {

* @inheritDoc
* @deprecated Use top level `startSession` instead.
*/

@@ -451,2 +466,3 @@ startSession(context) {

}
// eslint-disable-next-line deprecation/deprecation
this.endSession();

@@ -463,2 +479,5 @@

* when Tracing is used.
*
* @deprecated Use top-level `getClient().getOptions().sendDefaultPii` instead. This function
* only unnecessarily increased API surface but only wrapped accessing the option.
*/

@@ -465,0 +484,0 @@ shouldSendDefaultPii() {

@@ -8,6 +8,7 @@ export { addTracingExtensions, startIdleTransaction } from './tracing/hubextensions.js';

export { continueTrace, getActiveSpan, startActiveSpan, startInactiveSpan, startSpan, startSpanManual, trace } from './tracing/trace.js';
export { getDynamicSamplingContextFromClient } from './tracing/dynamicSamplingContext.js';
export { getDynamicSamplingContextFromClient, getDynamicSamplingContextFromSpan } from './tracing/dynamicSamplingContext.js';
export { setMeasurement } from './tracing/measurement.js';
export { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from './semanticAttributes.js';
export { createEventEnvelope, createSessionEnvelope } from './envelope.js';
export { addBreadcrumb, captureCheckIn, captureEvent, captureException, captureMessage, close, configureScope, flush, getClient, getCurrentScope, lastEventId, setContext, setExtra, setExtras, setTag, setTags, setUser, startTransaction, withMonitor, withScope } from './exports.js';
export { addBreadcrumb, captureCheckIn, captureEvent, captureException, captureMessage, captureSession, close, configureScope, endSession, flush, getClient, getCurrentScope, lastEventId, setContext, setExtra, setExtras, setTag, setTags, setUser, startSession, startTransaction, withMonitor, withScope } from './exports.js';
export { Hub, ensureHubOnCarrier, getCurrentHub, getHubFromCarrier, getIsolationScope, getMainCarrier, makeMain, runWithAsyncContext, setAsyncContextStrategy, setHubOnCarrier } from './hub.js';

@@ -35,3 +36,3 @@ export { closeSession, makeSession, updateSession } from './session.js';

export { handleCallbackErrors } from './utils/handleCallbackErrors.js';
export { spanToTraceHeader } from './utils/spanUtils.js';
export { spanIsSampled, spanToJSON, spanToTraceHeader } from './utils/spanUtils.js';
export { DEFAULT_ENVIRONMENT } from './constants.js';

@@ -38,0 +39,0 @@ export { ModuleMetadata } from './integrations/metadata.js';

@@ -93,2 +93,6 @@ import { arrayify, logger } from '@sentry/utils';

function setupIntegration(client, integration, integrationIndex) {
if (integrationIndex[integration.name]) {
DEBUG_BUILD && logger.log(`Integration skipped because it was already installed: ${integration.name}`);
return;
}
integrationIndex[integration.name] = integration;

@@ -95,0 +99,0 @@

import { extractPathForTransaction, addRequestDataToEvent } from '@sentry/utils';
import { convertIntegrationFnToClass } from '../integration.js';
import { spanToJSON } from '../utils/spanUtils.js';

@@ -82,2 +83,4 @@ const DEFAULT_OPTIONS = {

if (transaction) {
const name = spanToJSON(transaction).description || '';
// TODO (v8): Remove the nextjs check and just base it on `transactionNamingScheme` for all SDKs. (We have to

@@ -88,3 +91,3 @@ // keep it the way it is for the moment, because changing the names of transactions in Sentry has the potential

getSDKName(client) === 'sentry.javascript.nextjs'
? transaction.name.startsWith('/api')
? name.startsWith('/api')
: transactionNamingScheme !== 'path';

@@ -95,3 +98,3 @@

method: shouldIncludeMethodInTransactionName,
customRoute: transaction.name,
customRoute: name,
});

@@ -98,0 +101,0 @@

import { logger } from '@sentry/utils';
import { DEBUG_BUILD } from '../debug-build.js';
import { getClient, getCurrentScope } from '../exports.js';
import { spanToJSON } from '../utils/spanUtils.js';
import { COUNTER_METRIC_TYPE, DISTRIBUTION_METRIC_TYPE, SET_METRIC_TYPE, GAUGE_METRIC_TYPE } from './constants.js';

@@ -23,2 +24,3 @@ import { MetricsAggregator } from './integration.js';

const { release, environment } = client.getOptions();
// eslint-disable-next-line deprecation/deprecation
const transaction = scope.getTransaction();

@@ -33,3 +35,3 @@ const metricTags = {};

if (transaction) {
metricTags.transaction = transaction.name;
metricTags.transaction = spanToJSON(transaction).description || '';
}

@@ -36,0 +38,0 @@

@@ -1,2 +0,2 @@

import { isPlainObject, dateTimestampInSeconds, uuid4 } from '@sentry/utils';
import { isPlainObject, dateTimestampInSeconds, uuid4, logger } from '@sentry/utils';
import { getGlobalEventProcessors, notifyEventProcessors } from './eventProcessors.js';

@@ -52,3 +52,5 @@ import { updateSession } from './session.js';

/** Transaction Name */
/**
* Transaction Name
*/

@@ -240,3 +242,4 @@ /** Span */

/**
* @inheritDoc
* Sets the transaction name on the scope for future events.
* @deprecated Use extra or tags instead.
*/

@@ -265,3 +268,5 @@ setTransactionName(name) {

/**
* @inheritDoc
* Sets the Span on the scope.
* @param span Span
* @deprecated Instead of setting a span on a scope, use `startSpan()`/`startSpanManual()` instead.
*/

@@ -275,3 +280,4 @@ setSpan(span) {

/**
* @inheritDoc
* Returns the `Span` if there is one.
* @deprecated Use `getActiveSpan()` instead.
*/

@@ -283,3 +289,4 @@ getSpan() {

/**
* @inheritDoc
* Returns the `Transaction` attached to the scope (if there is one).
* @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
*/

@@ -289,3 +296,3 @@ getTransaction() {

// have a pointer to the currently-active transaction.
const span = this.getSpan();
const span = this._span;
return span && span.transaction;

@@ -546,2 +553,86 @@ }

/**
* Capture an exception for this scope.
*
* @param exception The exception to capture.
* @param hint Optinal additional data to attach to the Sentry event.
* @returns the id of the captured Sentry event.
*/
captureException(exception, hint) {
const eventId = hint && hint.event_id ? hint.event_id : uuid4();
if (!this._client) {
logger.warn('No client configured on scope - will not capture exception!');
return eventId;
}
const syntheticException = new Error('Sentry syntheticException');
this._client.captureException(
exception,
{
originalException: exception,
syntheticException,
...hint,
event_id: eventId,
},
this,
);
return eventId;
}
/**
* Capture a message for this scope.
*
* @param message The message to capture.
* @param level An optional severity level to report the message with.
* @param hint Optional additional data to attach to the Sentry event.
* @returns the id of the captured message.
*/
captureMessage(message, level, hint) {
const eventId = hint && hint.event_id ? hint.event_id : uuid4();
if (!this._client) {
logger.warn('No client configured on scope - will not capture message!');
return eventId;
}
const syntheticException = new Error(message);
this._client.captureMessage(
message,
level,
{
originalException: message,
syntheticException,
...hint,
event_id: eventId,
},
this,
);
return eventId;
}
/**
* Captures a manually created event for this scope and sends it to Sentry.
*
* @param exception The event to capture.
* @param hint Optional additional data to attach to the Sentry event.
* @returns the id of the captured event.
*/
captureEvent(event, hint) {
const eventId = hint && hint.event_id ? hint.event_id : uuid4();
if (!this._client) {
logger.warn('No client configured on scope - will not capture event!');
return eventId;
}
this._client.captureEvent(event, { ...hint, event_id: eventId }, this);
return eventId;
}
/**
* This will be called on every set call.

@@ -548,0 +639,0 @@ */

@@ -10,3 +10,3 @@ import { resolvedSyncPromise, eventFromUnknownInput, eventFromMessage, logger, uuid4 } from '@sentry/utils';

import { spanToTraceContext } from './utils/spanUtils.js';
import { getDynamicSamplingContextFromClient } from './tracing/dynamicSamplingContext.js';
import { getDynamicSamplingContextFromSpan, getDynamicSamplingContextFromClient } from './tracing/dynamicSamplingContext.js';
import './tracing/spanstatus.js';

@@ -238,5 +238,6 @@

// eslint-disable-next-line deprecation/deprecation
const span = scope.getSpan();
if (span) {
const samplingContext = span.transaction ? span.transaction.getDynamicSamplingContext() : undefined;
const samplingContext = span.transaction ? getDynamicSamplingContextFromSpan(span) : undefined;
return [samplingContext, spanToTraceContext(span)];

@@ -243,0 +244,0 @@ }

import { dropUndefinedKeys } from '@sentry/utils';
import { DEFAULT_ENVIRONMENT } from '../constants.js';
import { getClient, getCurrentScope } from '../exports.js';
import { spanToJSON, spanIsSampled } from '../utils/spanUtils.js';

@@ -7,3 +9,3 @@ /**

*
* Dispatchs the `createDsc` lifecycle hook as a side effect.
* Dispatches the `createDsc` lifecycle hook as a side effect.
*/

@@ -33,3 +35,61 @@ function getDynamicSamplingContextFromClient(

export { getDynamicSamplingContextFromClient };
/**
* A Span with a frozen dynamic sampling context.
*/
/**
* Creates a dynamic sampling context from a span (and client and scope)
*
* @param span the span from which a few values like the root span name and sample rate are extracted.
*
* @returns a dynamic sampling context
*/
function getDynamicSamplingContextFromSpan(span) {
const client = getClient();
if (!client) {
return {};
}
// passing emit=false here to only emit later once the DSC is actually populated
const dsc = getDynamicSamplingContextFromClient(spanToJSON(span).trace_id || '', client, getCurrentScope());
// As long as we use `Transaction`s internally, this should be fine.
// TODO: We need to replace this with a `getRootSpan(span)` function though
const txn = span.transaction ;
if (!txn) {
return dsc;
}
// TODO (v8): Remove v7FrozenDsc as a Transaction will no longer have _frozenDynamicSamplingContext
// For now we need to avoid breaking users who directly created a txn with a DSC, where this field is still set.
// @see Transaction class constructor
const v7FrozenDsc = txn && txn._frozenDynamicSamplingContext;
if (v7FrozenDsc) {
return v7FrozenDsc;
}
// TODO (v8): Replace txn.metadata with txn.attributes[]
// We can't do this yet because attributes aren't always set yet.
// eslint-disable-next-line deprecation/deprecation
const { sampleRate: maybeSampleRate, source } = txn.metadata;
if (maybeSampleRate != null) {
dsc.sample_rate = `${maybeSampleRate}`;
}
// We don't want to have a transaction name in the DSC if the source is "url" because URLs might contain PII
const jsonSpan = spanToJSON(txn);
// after JSON conversion, txn.name becomes jsonSpan.description
if (source && source !== 'url') {
dsc.transaction = jsonSpan.description;
}
dsc.sampled = String(spanIsSampled(txn));
client.emit && client.emit('createDsc', dsc);
return dsc;
}
export { getDynamicSamplingContextFromClient, getDynamicSamplingContextFromSpan };
//# sourceMappingURL=dynamicSamplingContext.js.map

@@ -24,2 +24,3 @@ import { addGlobalErrorInstrumentationHandler, addGlobalUnhandledRejectionInstrumentationHandler, logger } from '@sentry/utils';

function errorCallback() {
// eslint-disable-next-line deprecation/deprecation
const activeTransaction = getActiveTransaction();

@@ -26,0 +27,0 @@ if (activeTransaction) {

@@ -13,2 +13,3 @@ import { logger } from '@sentry/utils';

const scope = this.getScope();
// eslint-disable-next-line deprecation/deprecation
const span = scope.getSpan();

@@ -56,5 +57,7 @@

// eslint-disable-next-line deprecation/deprecation
transactionContext.sampled = false;
}
// eslint-disable-next-line deprecation/deprecation
let transaction = new Transaction(transactionContext, this);

@@ -66,3 +69,3 @@ transaction = sampleTransaction(transaction, options, {

});
if (transaction.sampled) {
if (transaction.isRecording()) {
transaction.initSpanRecorder(options._experiments && (options._experiments.maxSpans ));

@@ -91,2 +94,3 @@ }

// eslint-disable-next-line deprecation/deprecation
let transaction = new IdleTransaction(transactionContext, hub, idleTimeout, finalTimeout, heartbeatInterval, onScope);

@@ -98,3 +102,3 @@ transaction = sampleTransaction(transaction, options, {

});
if (transaction.sampled) {
if (transaction.isRecording()) {
transaction.initSpanRecorder(options._experiments && (options._experiments.maxSpans ));

@@ -101,0 +105,0 @@ }

import { logger, timestampInSeconds } from '@sentry/utils';
import { DEBUG_BUILD } from '../debug-build.js';
import { spanTimeInputToSeconds } from '../utils/spanUtils.js';
import { SpanRecorder } from './span.js';
import { Transaction } from './transaction.js';
import { ensureTimestampInSeconds } from './utils.js';

@@ -42,3 +42,3 @@ const TRACING_DEFAULTS = {

// the transaction that this span recorder belongs to.
if (span.spanId !== this.transactionSpanId) {
if (span.spanContext().spanId !== this.transactionSpanId) {
// We patch span.end() to pop an activity after setting an endTimestamp.

@@ -48,3 +48,3 @@ // eslint-disable-next-line @typescript-eslint/unbound-method

span.end = (...rest) => {
this._popActivity(span.spanId);
this._popActivity(span.spanContext().spanId);
return originalEnd.apply(span, rest);

@@ -55,3 +55,3 @@ };

if (span.endTimestamp === undefined) {
this._pushActivity(span.spanId);
this._pushActivity(span.spanContext().spanId);
}

@@ -84,2 +84,5 @@ }

/**
* @deprecated Transactions will be removed in v8. Use spans instead.
*/
constructor(

@@ -112,3 +115,4 @@ transactionContext,

// context and attach it to the error.
DEBUG_BUILD && logger.log(`Setting idle transaction on scope. Span ID: ${this.spanId}`);
DEBUG_BUILD && logger.log(`Setting idle transaction on scope. Span ID: ${this.spanContext().spanId}`);
// eslint-disable-next-line deprecation/deprecation
_idleHub.getScope().setSpan(this);

@@ -128,4 +132,4 @@ }

/** {@inheritDoc} */
end(endTimestamp = timestampInSeconds()) {
const endTimestampInS = ensureTimestampInSeconds(endTimestamp);
end(endTimestamp) {
const endTimestampInS = spanTimeInputToSeconds(endTimestamp);

@@ -136,3 +140,3 @@ this._finished = true;

if (this.op === 'ui.action.click') {
this.setTag(FINISH_REASON_TAG, this._finishReason);
this.setAttribute(FINISH_REASON_TAG, this._finishReason);
}

@@ -145,3 +149,3 @@

for (const callback of this._beforeFinishCallbacks) {
callback(this, endTimestamp);
callback(this, endTimestampInS);
}

@@ -151,3 +155,3 @@

// If we are dealing with the transaction itself, we just return it
if (span.spanId === this.spanId) {
if (span.spanContext().spanId === this.spanContext().spanId) {
return true;

@@ -190,3 +194,5 @@ }

const scope = this._idleHub.getScope();
// eslint-disable-next-line deprecation/deprecation
if (scope.getTransaction() === this) {
// eslint-disable-next-line deprecation/deprecation
scope.setSpan(undefined);

@@ -228,3 +234,3 @@ }

this.spanRecorder = new IdleTransactionSpanRecorder(pushActivity, popActivity, this.spanId, maxlen);
this.spanRecorder = new IdleTransactionSpanRecorder(pushActivity, popActivity, this.spanContext().spanId, maxlen);

@@ -231,0 +237,0 @@ // Start heartbeat so that transactions do not run forever.

@@ -7,2 +7,3 @@ import { getActiveTransaction } from './utils.js';

function setMeasurement(name, value, unit) {
// eslint-disable-next-line deprecation/deprecation
const transaction = getActiveTransaction();

@@ -9,0 +10,0 @@ if (transaction) {

import { logger, isNaN } from '@sentry/utils';
import { DEBUG_BUILD } from '../debug-build.js';
import { SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '../semanticAttributes.js';
import { hasTracingEnabled } from '../utils/hasTracingEnabled.js';
import { spanToJSON } from '../utils/spanUtils.js';

@@ -21,2 +23,3 @@ /**

if (!hasTracingEnabled(options)) {
// eslint-disable-next-line deprecation/deprecation
transaction.sampled = false;

@@ -27,6 +30,6 @@ return transaction;

// if the user has forced a sampling decision by passing a `sampled` value in their transaction context, go with that
// eslint-disable-next-line deprecation/deprecation
if (transaction.sampled !== undefined) {
transaction.setMetadata({
sampleRate: Number(transaction.sampled),
});
// eslint-disable-next-line deprecation/deprecation
transaction.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, Number(transaction.sampled));
return transaction;

@@ -40,5 +43,3 @@ }

sampleRate = options.tracesSampler(samplingContext);
transaction.setMetadata({
sampleRate: Number(sampleRate),
});
transaction.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, Number(sampleRate));
} else if (samplingContext.parentSampled !== undefined) {

@@ -48,11 +49,7 @@ sampleRate = samplingContext.parentSampled;

sampleRate = options.tracesSampleRate;
transaction.setMetadata({
sampleRate: Number(sampleRate),
});
transaction.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, Number(sampleRate));
} else {
// When `enableTracing === true`, we use a sample rate of 100%
sampleRate = 1;
transaction.setMetadata({
sampleRate,
});
transaction.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, sampleRate);
}

@@ -64,2 +61,3 @@

DEBUG_BUILD && logger.warn('[Tracing] Discarding transaction because of invalid sample rate.');
// eslint-disable-next-line deprecation/deprecation
transaction.sampled = false;

@@ -79,2 +77,3 @@ return transaction;

);
// eslint-disable-next-line deprecation/deprecation
transaction.sampled = false;

@@ -86,5 +85,7 @@ return transaction;

// a boolean, the < comparison will cause it to be automatically cast to 1 if it's true and 0 if it's false.
// eslint-disable-next-line deprecation/deprecation
transaction.sampled = Math.random() < (sampleRate );
// if we're not going to keep it, we're done
// eslint-disable-next-line deprecation/deprecation
if (!transaction.sampled) {

@@ -100,3 +101,4 @@ DEBUG_BUILD &&

DEBUG_BUILD && logger.log(`[Tracing] starting ${transaction.op} transaction - ${transaction.name}`);
DEBUG_BUILD &&
logger.log(`[Tracing] starting ${transaction.op} transaction - ${spanToJSON(transaction).description}`);
return transaction;

@@ -103,0 +105,0 @@ }

import { uuid4, timestampInSeconds, logger, dropUndefinedKeys } from '@sentry/utils';
import { DEBUG_BUILD } from '../debug-build.js';
import { spanToTraceHeader, spanToTraceContext } from '../utils/spanUtils.js';
import { ensureTimestampInSeconds } from './utils.js';
import { TRACE_FLAG_SAMPLED, TRACE_FLAG_NONE, spanToJSON, spanTimeInputToSeconds, spanToTraceHeader, spanToTraceContext } from '../utils/spanUtils.js';

@@ -43,10 +42,2 @@ /**

/**
* @inheritDoc
*/
/**
* @inheritDoc
*/
/**
* Internal keeper of the status

@@ -56,6 +47,2 @@ */

/**
* @inheritDoc
*/
/**
* Timestamp in seconds when the span was created.

@@ -73,19 +60,13 @@ */

/**
* @inheritDoc
* Tags for the span.
* @deprecated Use `getSpanAttributes(span)` instead.
*/
/**
* @inheritDoc
* Data for the span.
* @deprecated Use `getSpanAttributes(span)` instead.
*/
/**
* @inheritDoc
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
/**
* @inheritDoc
*/
/**
* List of spans that were finalized

@@ -114,10 +95,14 @@ */

constructor(spanContext = {}) {
this.traceId = spanContext.traceId || uuid4();
this.spanId = spanContext.spanId || uuid4().substring(16);
this._traceId = spanContext.traceId || uuid4();
this._spanId = spanContext.spanId || uuid4().substring(16);
this.startTimestamp = spanContext.startTimestamp || timestampInSeconds();
this.tags = spanContext.tags || {};
this.data = spanContext.data || {};
this.attributes = spanContext.attributes || {};
// eslint-disable-next-line deprecation/deprecation
this.tags = spanContext.tags ? { ...spanContext.tags } : {};
// eslint-disable-next-line deprecation/deprecation
this.data = spanContext.data ? { ...spanContext.data } : {};
this._attributes = spanContext.attributes ? { ...spanContext.attributes } : {};
this.instrumenter = spanContext.instrumenter || 'sentry';
this.origin = spanContext.origin || 'manual';
// eslint-disable-next-line deprecation/deprecation
this._name = spanContext.name || spanContext.description;

@@ -129,3 +114,3 @@ if (spanContext.parentSpanId) {

if ('sampled' in spanContext) {
this.sampled = spanContext.sampled;
this._sampled = spanContext.sampled;
}

@@ -135,8 +120,2 @@ if (spanContext.op) {

}
if (spanContext.description) {
this.description = spanContext.description;
}
if (spanContext.name) {
this.description = spanContext.name;
}
if (spanContext.status) {

@@ -150,8 +129,16 @@ this.status = spanContext.status;

/** An alias for `description` of the Span. */
// This rule conflicts with another eslint rule :(
/* eslint-disable @typescript-eslint/member-ordering */
/**
* An alias for `description` of the Span.
* @deprecated Use `spanToJSON(span).description` instead.
*/
get name() {
return this.description || '';
return this._name || '';
}
/**
* Update the name of the span.
* @deprecated Use `spanToJSON(span).description` instead.
*/

@@ -163,4 +150,99 @@ set name(name) {

/**
* @inheritDoc
* Get the description of the Span.
* @deprecated Use `spanToJSON(span).description` instead.
*/
get description() {
return this._name;
}
/**
* Get the description of the Span.
* @deprecated Use `spanToJSON(span).description` instead.
*/
set description(description) {
this._name = description;
}
/**
* The ID of the trace.
* @deprecated Use `spanContext().traceId` instead.
*/
get traceId() {
return this._traceId;
}
/**
* The ID of the trace.
* @deprecated You cannot update the traceId of a span after span creation.
*/
set traceId(traceId) {
this._traceId = traceId;
}
/**
* The ID of the span.
* @deprecated Use `spanContext().spanId` instead.
*/
get spanId() {
return this._spanId;
}
/**
* The ID of the span.
* @deprecated You cannot update the spanId of a span after span creation.
*/
set spanId(spanId) {
this._spanId = spanId;
}
/**
* Was this span chosen to be sent as part of the sample?
* @deprecated Use `isRecording()` instead.
*/
get sampled() {
return this._sampled;
}
/**
* Was this span chosen to be sent as part of the sample?
* @deprecated You cannot update the sampling decision of a span after span creation.
*/
set sampled(sampled) {
this._sampled = sampled;
}
/**
* Attributes for the span.
* @deprecated Use `getSpanAttributes(span)` instead.
*/
get attributes() {
return this._attributes;
}
/**
* Attributes for the span.
* @deprecated Use `setAttributes()` instead.
*/
set attributes(attributes) {
this._attributes = attributes;
}
/* eslint-enable @typescript-eslint/member-ordering */
/** @inheritdoc */
spanContext() {
const { _spanId: spanId, _traceId: traceId, _sampled: sampled } = this;
return {
spanId,
traceId,
traceFlags: sampled ? TRACE_FLAG_SAMPLED : TRACE_FLAG_NONE,
};
}
/**
* Creates a new `Span` while setting the current `Span.id` as `parentSpanId`.
* Also the `sampled` decision will be inherited.
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/
startChild(

@@ -171,5 +253,5 @@ spanContext,

...spanContext,
parentSpanId: this.spanId,
sampled: this.sampled,
traceId: this.traceId,
parentSpanId: this._spanId,
sampled: this._sampled,
traceId: this._traceId,
});

@@ -186,8 +268,8 @@

const opStr = (spanContext && spanContext.op) || '< unknown op >';
const nameStr = childSpan.transaction.name || '< unknown name >';
const idStr = childSpan.transaction.spanId;
const nameStr = spanToJSON(childSpan).description || '< unknown name >';
const idStr = childSpan.transaction.spanContext().spanId;
const logMessage = `[Tracing] Starting '${opStr}' span on transaction '${nameStr}' (${idStr}).`;
childSpan.transaction.metadata.spanMetadata[childSpan.spanId] = { logMessage };
logger.log(logMessage);
this._logMessage = logMessage;
}

@@ -199,5 +281,12 @@

/**
* @inheritDoc
* Sets the tag attribute on the current span.
*
* Can also be used to unset a tag, by passing `undefined`.
*
* @param key Tag key
* @param value Tag value
* @deprecated Use `setAttribute()` instead.
*/
setTag(key, value) {
// eslint-disable-next-line deprecation/deprecation
this.tags = { ...this.tags, [key]: value };

@@ -208,6 +297,10 @@ return this;

/**
* @inheritDoc
* Sets the data attribute on the current span
* @param key Data key
* @param value Data value
* @deprecated Use `setAttribute()` instead.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
setData(key, value) {
// eslint-disable-next-line deprecation/deprecation
this.data = { ...this.data, [key]: value };

@@ -221,5 +314,5 @@ return this;

// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete this.attributes[key];
delete this._attributes[key];
} else {
this.attributes[key] = value;
this._attributes[key] = value;
}

@@ -245,3 +338,5 @@ }

setHttpStatus(httpStatus) {
// eslint-disable-next-line deprecation/deprecation
this.setTag('http.status_code', String(httpStatus));
// eslint-disable-next-line deprecation/deprecation
this.setData('http.response.status_code', httpStatus);

@@ -264,3 +359,3 @@ const spanStatus = spanStatusfromHttpCode(httpStatus);

updateName(name) {
this.description = name;
this._name = name;
return this;

@@ -291,5 +386,5 @@ }

this.transaction &&
this.transaction.spanId !== this.spanId
this.transaction.spanContext().spanId !== this._spanId
) {
const { logMessage } = this.transaction.metadata.spanMetadata[this.spanId];
const logMessage = this._logMessage;
if (logMessage) {

@@ -300,4 +395,3 @@ logger.log((logMessage ).replace('Starting', 'Finishing'));

this.endTimestamp =
typeof endTimestamp === 'number' ? ensureTimestampInSeconds(endTimestamp) : timestampInSeconds();
this.endTimestamp = spanTimeInputToSeconds(endTimestamp);
}

@@ -318,12 +412,13 @@

data: this._getData(),
description: this.description,
description: this._name,
endTimestamp: this.endTimestamp,
op: this.op,
parentSpanId: this.parentSpanId,
sampled: this.sampled,
spanId: this.spanId,
sampled: this._sampled,
spanId: this._spanId,
startTimestamp: this.startTimestamp,
status: this.status,
// eslint-disable-next-line deprecation/deprecation
tags: this.tags,
traceId: this.traceId,
traceId: this._traceId,
});

@@ -336,13 +431,16 @@ }

updateWithContext(spanContext) {
// eslint-disable-next-line deprecation/deprecation
this.data = spanContext.data || {};
this.description = spanContext.description;
// eslint-disable-next-line deprecation/deprecation
this._name = spanContext.name || spanContext.description;
this.endTimestamp = spanContext.endTimestamp;
this.op = spanContext.op;
this.parentSpanId = spanContext.parentSpanId;
this.sampled = spanContext.sampled;
this.spanId = spanContext.spanId || this.spanId;
this._sampled = spanContext.sampled;
this._spanId = spanContext.spanId || this._spanId;
this.startTimestamp = spanContext.startTimestamp || this.startTimestamp;
this.status = spanContext.status;
// eslint-disable-next-line deprecation/deprecation
this.tags = spanContext.tags || {};
this.traceId = spanContext.traceId || this.traceId;
this._traceId = spanContext.traceId || this._traceId;

@@ -360,18 +458,17 @@ return this;

/**
* @inheritDoc
* Get JSON representation of this span.
*/
toJSON()
{
getSpanJSON() {
return dropUndefinedKeys({
data: this._getData(),
description: this.description,
description: this._name,
op: this.op,
parent_span_id: this.parentSpanId,
span_id: this.spanId,
span_id: this._spanId,
start_timestamp: this.startTimestamp,
status: this.status,
// eslint-disable-next-line deprecation/deprecation
tags: Object.keys(this.tags).length > 0 ? this.tags : undefined,
timestamp: this.endTimestamp,
trace_id: this.traceId,
trace_id: this._traceId,
origin: this.origin,

@@ -381,3 +478,16 @@ });

/** @inheritdoc */
isRecording() {
return !this.endTimestamp && !!this._sampled;
}
/**
* Convert the object to JSON.
* @deprecated Use `spanToJSON(span)` instead.
*/
toJSON() {
return this.getSpanJSON();
}
/**
* Get the merged data for this span.

@@ -390,3 +500,4 @@ * For now, this combines `data` and `attributes` together,

{
const { data, attributes } = this;
// eslint-disable-next-line deprecation/deprecation
const { data, _attributes: attributes } = this;

@@ -393,0 +504,0 @@ const hasData = Object.keys(data).length > 0;

@@ -7,2 +7,3 @@ import { tracingContextFromHeaders, logger, dropUndefinedKeys } from '@sentry/utils';

import { hasTracingEnabled } from '../utils/hasTracingEnabled.js';
import { spanTimeInputToSeconds } from '../utils/spanUtils.js';

@@ -31,10 +32,11 @@ /**

) {
const ctx = normalizeContext(context);
const hub = getCurrentHub();
const scope = getCurrentScope();
// eslint-disable-next-line deprecation/deprecation
const parentSpan = scope.getSpan();
const ctx = normalizeContext(context);
const activeSpan = createChildSpanOrTransaction(hub, parentSpan, ctx);
// eslint-disable-next-line deprecation/deprecation
scope.setSpan(activeSpan);

@@ -50,2 +52,3 @@

activeSpan && activeSpan.end();
// eslint-disable-next-line deprecation/deprecation
scope.setSpan(parentSpan);

@@ -71,7 +74,9 @@ afterFinish();

return withScope(scope => {
return withScope(context.scope, scope => {
const hub = getCurrentHub();
// eslint-disable-next-line deprecation/deprecation
const parentSpan = scope.getSpan();
const activeSpan = createChildSpanOrTransaction(hub, parentSpan, ctx);
// eslint-disable-next-line deprecation/deprecation
scope.setSpan(activeSpan);

@@ -114,7 +119,9 @@

return withScope(scope => {
return withScope(context.scope, scope => {
const hub = getCurrentHub();
// eslint-disable-next-line deprecation/deprecation
const parentSpan = scope.getSpan();
const activeSpan = createChildSpanOrTransaction(hub, parentSpan, ctx);
// eslint-disable-next-line deprecation/deprecation
scope.setSpan(activeSpan);

@@ -153,11 +160,13 @@

const ctx = { ...context };
// If a name is set and a description is not, set the description to the name.
if (ctx.name !== undefined && ctx.description === undefined) {
ctx.description = ctx.name;
}
const ctx = normalizeContext(context);
const hub = getCurrentHub();
const parentSpan = getActiveSpan();
return parentSpan ? parentSpan.startChild(ctx) : hub.startTransaction(ctx);
const parentSpan = context.scope
? // eslint-disable-next-line deprecation/deprecation
context.scope.getSpan()
: getActiveSpan();
return parentSpan
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}

@@ -169,2 +178,3 @@

function getActiveSpan() {
// eslint-disable-next-line deprecation/deprecation
return getCurrentScope().getSpan();

@@ -224,13 +234,25 @@ }

}
return parentSpan ? parentSpan.startChild(ctx) : hub.startTransaction(ctx);
return parentSpan
? // eslint-disable-next-line deprecation/deprecation
parentSpan.startChild(ctx)
: // eslint-disable-next-line deprecation/deprecation
hub.startTransaction(ctx);
}
/**
* This converts StartSpanOptions to TransactionContext.
* For the most part (for now) we accept the same options,
* but some of them need to be transformed.
*
* Eventually the StartSpanOptions will be more aligned with OpenTelemetry.
*/
function normalizeContext(context) {
const ctx = { ...context };
// If a name is set and a description is not, set the description to the name.
if (ctx.name !== undefined && ctx.description === undefined) {
ctx.description = ctx.name;
if (context.startTime) {
const ctx = { ...context };
ctx.startTimestamp = spanTimeInputToSeconds(context.startTime);
delete ctx.startTime;
return ctx;
}
return ctx;
return context;
}

@@ -237,0 +259,0 @@

@@ -1,12 +0,11 @@

import { timestampInSeconds, dropUndefinedKeys, logger } from '@sentry/utils';
import { dropUndefinedKeys, logger } from '@sentry/utils';
import { DEBUG_BUILD } from '../debug-build.js';
import { getCurrentHub } from '../hub.js';
import { spanToTraceContext } from '../utils/spanUtils.js';
import { getDynamicSamplingContextFromClient } from './dynamicSamplingContext.js';
import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE } from '../semanticAttributes.js';
import { spanTimeInputToSeconds, spanToTraceContext } from '../utils/spanUtils.js';
import { getDynamicSamplingContextFromSpan } from './dynamicSamplingContext.js';
import { Span, SpanRecorder } from './span.js';
import { ensureTimestampInSeconds } from './utils.js';
/** JSDoc */
class Transaction extends Span {
/**

@@ -16,2 +15,4 @@ * The reference to the current hub.

// DO NOT yet remove this property, it is used in a hack for v7 backwards compatibility.
/**

@@ -23,9 +24,7 @@ * This constructor should never be called manually. Those instrumenting tracing should use

* @hidden
*
* @deprecated Transactions will be removed in v8. Use spans instead.
*/
constructor(transactionContext, hub) {
super(transactionContext);
// We need to delete description since it's set by the Span class constructor
// but not needed for transactions.
delete this.description;
this._measurements = {};

@@ -38,6 +37,5 @@ this._contexts = {};

this.metadata = {
source: 'custom',
this._metadata = {
// eslint-disable-next-line deprecation/deprecation
...transactionContext.metadata,
spanMetadata: {},
};

@@ -52,3 +50,3 @@

// there is incoming Dynamic Sampling Context. (Either through an incoming request, a baggage meta-tag, or other means)
const incomingDynamicSamplingContext = this.metadata.dynamicSamplingContext;
const incomingDynamicSamplingContext = this._metadata.dynamicSamplingContext;
if (incomingDynamicSamplingContext) {

@@ -60,3 +58,9 @@ // We shallow copy this in case anything writes to the original reference of the passed in `dynamicSamplingContext`

/** Getter for `name` property */
// This sadly conflicts with the getter/setter ordering :(
/* eslint-disable @typescript-eslint/member-ordering */
/**
* Getter for `name` property.
* @deprecated Use `spanToJSON(span).description` instead.
*/
get name() {

@@ -68,2 +72,3 @@ return this._name;

* Setter for `name` property, which also sets `source` as custom.
* @deprecated Use `updateName()` and `setMetadata()` instead.
*/

@@ -76,2 +81,37 @@ set name(newName) {

/**
* Get the metadata for this transaction.
* @deprecated Use `spanGetMetadata(transaction)` instead.
*/
get metadata() {
// We merge attributes in for backwards compatibility
return {
// Defaults
// eslint-disable-next-line deprecation/deprecation
source: 'custom',
spanMetadata: {},
// Legacy metadata
...this._metadata,
// From attributes
...(this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] && {
source: this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] ,
}),
...(this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE] && {
sampleRate: this._attributes[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE] ,
}),
};
}
/**
* Update the metadata for this transaction.
* @deprecated Use `spanGetMetadata(transaction)` instead.
*/
set metadata(metadata) {
this._metadata = metadata;
}
/* eslint-enable @typescript-eslint/member-ordering */
/**
* Setter for `name` property, which also sets `source` on the metadata.

@@ -83,3 +123,3 @@ *

this._name = name;
this.metadata.source = source;
this.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);
}

@@ -105,3 +145,4 @@

/**
* @inheritDoc
* Set the context of a transaction event.
* @deprecated Use either `.setAttribute()`, or set the context on the scope before creating the transaction.
*/

@@ -125,6 +166,7 @@ setContext(key, context) {

/**
* @inheritDoc
* Store metadata on this transaction.
* @deprecated Use attributes or store data on the scope instead.
*/
setMetadata(newMetadata) {
this.metadata = { ...this.metadata, ...newMetadata };
this._metadata = { ...this._metadata, ...newMetadata };
}

@@ -136,4 +178,3 @@

end(endTimestamp) {
const timestampInS =
typeof endTimestamp === 'number' ? ensureTimestampInSeconds(endTimestamp) : timestampInSeconds();
const timestampInS = spanTimeInputToSeconds(endTimestamp);
const transaction = this._finishTransaction(timestampInS);

@@ -143,2 +184,3 @@ if (!transaction) {

}
// eslint-disable-next-line deprecation/deprecation
return this._hub.captureEvent(transaction);

@@ -156,3 +198,3 @@ }

...spanContext,
name: this.name,
name: this._name,
trimEnd: this._trimEnd,

@@ -169,4 +211,3 @@ });

this.name = transactionContext.name || '';
this._name = transactionContext.name || '';
this._trimEnd = transactionContext.trimEnd;

@@ -181,35 +222,7 @@

* @experimental
*
* @deprecated Use top-level `getDynamicSamplingContextFromSpan` instead.
*/
getDynamicSamplingContext() {
if (this._frozenDynamicSamplingContext) {
return this._frozenDynamicSamplingContext;
}
const hub = this._hub || getCurrentHub();
const client = hub.getClient();
if (!client) return {};
const scope = hub.getScope();
const dsc = getDynamicSamplingContextFromClient(this.traceId, client, scope);
const maybeSampleRate = this.metadata.sampleRate;
if (maybeSampleRate !== undefined) {
dsc.sample_rate = `${maybeSampleRate}`;
}
// We don't want to have a transaction name in the DSC if the source is "url" because URLs might contain PII
const source = this.metadata.source;
if (source && source !== 'url') {
dsc.transaction = this.name;
}
if (this.sampled !== undefined) {
dsc.sampled = String(this.sampled);
}
// Uncomment if we want to make DSC immutable
// this._frozenDynamicSamplingContext = dsc;
return dsc;
return getDynamicSamplingContextFromSpan(this);
}

@@ -236,5 +249,5 @@

if (!this.name) {
if (!this._name) {
DEBUG_BUILD && logger.warn('Transaction has no name, falling back to `<unlabeled transaction>`.');
this.name = '<unlabeled transaction>';
this._name = '<unlabeled transaction>';
}

@@ -250,3 +263,3 @@

if (this.sampled !== true) {
if (this._sampled !== true) {
// At this point if `sampled !== true` we want to discard the transaction.

@@ -273,3 +286,6 @@ DEBUG_BUILD && logger.log('[Tracing] Discarding transaction because its trace was not chosen to be sampled.');

const metadata = this.metadata;
// eslint-disable-next-line deprecation/deprecation
const { metadata } = this;
// eslint-disable-next-line deprecation/deprecation
const { source } = metadata;

@@ -282,15 +298,17 @@ const transaction = {

},
// TODO: Pass spans serialized via `spanToJSON()` here instead in v8.
spans: finishedSpans,
start_timestamp: this.startTimestamp,
// eslint-disable-next-line deprecation/deprecation
tags: this.tags,
timestamp: this.endTimestamp,
transaction: this.name,
transaction: this._name,
type: 'transaction',
sdkProcessingMetadata: {
...metadata,
dynamicSamplingContext: this.getDynamicSamplingContext(),
dynamicSamplingContext: getDynamicSamplingContextFromSpan(this),
},
...(metadata.source && {
...(source && {
transaction_info: {
source: metadata.source,
source,
},

@@ -311,3 +329,3 @@ }),

DEBUG_BUILD && logger.log(`[Tracing] Finishing ${this.op} transaction: ${this.name}.`);
DEBUG_BUILD && logger.log(`[Tracing] Finishing ${this.op} transaction: ${this._name}.`);

@@ -314,0 +332,0 @@ return transaction;

@@ -5,6 +5,11 @@ import { extractTraceparentData as extractTraceparentData$1 } from '@sentry/utils';

/** Grabs active transaction off scope, if any */
/**
* Grabs active transaction off scope.
*
* @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
*/
function getActiveTransaction(maybeHub) {
const hub = maybeHub || getCurrentHub();
const scope = hub.getScope();
// eslint-disable-next-line deprecation/deprecation
return scope.getTransaction() ;

@@ -27,11 +32,3 @@ }

/**
* Converts a timestamp to second, if it was in milliseconds, or keeps it as second.
*/
function ensureTimestampInSeconds(timestamp) {
const isMs = timestamp > 9999999999;
return isMs ? timestamp / 1000 : timestamp;
}
export { ensureTimestampInSeconds, extractTraceparentData, getActiveTransaction };
export { extractTraceparentData, getActiveTransaction };
//# sourceMappingURL=utils.js.map
import { arrayify } from '@sentry/utils';
import { spanToTraceContext } from './spanUtils.js';
import { getDynamicSamplingContextFromSpan } from '../tracing/dynamicSamplingContext.js';
import { spanToTraceContext, spanToJSON } from './spanUtils.js';

@@ -39,2 +40,3 @@ /**

propagationContext,
// eslint-disable-next-line deprecation/deprecation
transactionName,

@@ -55,2 +57,3 @@ span,

if (transactionName) {
// eslint-disable-next-line deprecation/deprecation
data.transactionName = transactionName;

@@ -95,3 +98,11 @@ }

function applyDataToEvent(event, data) {
const { extra, tags, user, contexts, level, transactionName } = data;
const {
extra,
tags,
user,
contexts,
level,
// eslint-disable-next-line deprecation/deprecation
transactionName,
} = data;

@@ -140,6 +151,6 @@ if (extra && Object.keys(extra).length) {

event.sdkProcessingMetadata = {
dynamicSamplingContext: transaction.getDynamicSamplingContext(),
dynamicSamplingContext: getDynamicSamplingContextFromSpan(span),
...event.sdkProcessingMetadata,
};
const transactionName = transaction.name;
const transactionName = spanToJSON(transaction).description;
if (transactionName) {

@@ -146,0 +157,0 @@ event.tags = { transaction: transactionName, ...event.tags };

@@ -6,2 +6,3 @@ import { uuid4, dateTimestampInSeconds, addExceptionMechanism, truncate, GLOBAL_OBJ, normalize } from '@sentry/utils';

import { mergeScopeData, applyScopeDataToEvent } from './applyScopeDataToEvent.js';
import { spanToJSON } from './spanUtils.js';

@@ -315,6 +316,10 @@ /**

normalized.spans = event.spans.map(span => {
// We cannot use the spread operator here because `toJSON` on `span` is non-enumerable
if (span.data) {
span.data = normalize(span.data, depth, maxBreadth);
const data = spanToJSON(span).data;
if (data) {
// This is a bit weird, as we generally have `Span` instances here, but to be safe we do not assume so
// eslint-disable-next-line deprecation/deprecation
span.data = normalize(data, depth, maxBreadth);
}
return span;

@@ -321,0 +326,0 @@ });

@@ -1,3 +0,7 @@

import { generateSentryTraceHeader, dropUndefinedKeys } from '@sentry/utils';
import { generateSentryTraceHeader, dropUndefinedKeys, timestampInSeconds } from '@sentry/utils';
// These are aligned with OpenTelemetry trace flags
const TRACE_FLAG_NONE = 0x0;
const TRACE_FLAG_SAMPLED = 0x1;
/**

@@ -7,7 +11,7 @@ * Convert a span to a trace context, which can be sent as the `trace` context in an event.

function spanToTraceContext(span) {
const { data, description, op, parent_span_id, span_id, status, tags, trace_id, origin } = span.toJSON();
const { spanId: span_id, traceId: trace_id } = span.spanContext();
const { data, op, parent_span_id, status, tags, origin } = spanToJSON(span);
return dropUndefinedKeys({
data,
description,
op,

@@ -27,6 +31,82 @@ parent_span_id,

function spanToTraceHeader(span) {
return generateSentryTraceHeader(span.traceId, span.spanId, span.sampled);
const { traceId, spanId } = span.spanContext();
const sampled = spanIsSampled(span);
return generateSentryTraceHeader(traceId, spanId, sampled);
}
export { spanToTraceContext, spanToTraceHeader };
/**
* Convert a span time input intp a timestamp in seconds.
*/
function spanTimeInputToSeconds(input) {
if (typeof input === 'number') {
return ensureTimestampInSeconds(input);
}
if (Array.isArray(input)) {
// See {@link HrTime} for the array-based time format
return input[0] + input[1] / 1e9;
}
if (input instanceof Date) {
return ensureTimestampInSeconds(input.getTime());
}
return timestampInSeconds();
}
/**
* Converts a timestamp to second, if it was in milliseconds, or keeps it as second.
*/
function ensureTimestampInSeconds(timestamp) {
const isMs = timestamp > 9999999999;
return isMs ? timestamp / 1000 : timestamp;
}
/**
* Convert a span to a JSON representation.
* Note that all fields returned here are optional and need to be guarded against.
*
* Note: Because of this, we currently have a circular type dependency (which we opted out of in package.json).
* This is not avoidable as we need `spanToJSON` in `spanUtils.ts`, which in turn is needed by `span.ts` for backwards compatibility.
* And `spanToJSON` needs the Span class from `span.ts` to check here.
* TODO v8: When we remove the deprecated stuff from `span.ts`, we can remove the circular dependency again.
*/
function spanToJSON(span) {
if (spanIsSpanClass(span)) {
return span.getSpanJSON();
}
// Fallback: We also check for `.toJSON()` here...
// eslint-disable-next-line deprecation/deprecation
if (typeof span.toJSON === 'function') {
// eslint-disable-next-line deprecation/deprecation
return span.toJSON();
}
return {};
}
/**
* Sadly, due to circular dependency checks we cannot actually import the Span class here and check for instanceof.
* :( So instead we approximate this by checking if it has the `getSpanJSON` method.
*/
function spanIsSpanClass(span) {
return typeof (span ).getSpanJSON === 'function';
}
/**
* Returns true if a span is sampled.
* In most cases, you should just use `span.isRecording()` instead.
* However, this has a slightly different semantic, as it also returns false if the span is finished.
* So in the case where this distinction is important, use this method.
*/
function spanIsSampled(span) {
// We align our trace flags with the ones OpenTelemetry use
// So we also check for sampled the same way they do.
const { traceFlags } = span.spanContext();
// eslint-disable-next-line no-bitwise
return Boolean(traceFlags & TRACE_FLAG_SAMPLED);
}
export { TRACE_FLAG_NONE, TRACE_FLAG_SAMPLED, spanIsSampled, spanTimeInputToSeconds, spanToJSON, spanToTraceContext, spanToTraceHeader };
//# sourceMappingURL=spanUtils.js.map

@@ -1,4 +0,4 @@

const SDK_VERSION = '7.92.0';
const SDK_VERSION = '7.93.0';
export { SDK_VERSION };
//# sourceMappingURL=version.js.map
{
"name": "@sentry/core",
"version": "7.92.0",
"version": "7.93.0",
"description": "Base implementation for all Sentry JavaScript SDKs",

@@ -32,6 +32,13 @@ "repository": "git://github.com/getsentry/sentry-javascript.git",

"dependencies": {
"@sentry/types": "7.92.0",
"@sentry/utils": "7.92.0"
"@sentry/types": "7.93.0",
"@sentry/utils": "7.93.0"
},
"madge": {
"detectiveOptions": {
"ts": {
"skipTypeImports": true
}
}
},
"sideEffects": false
}

@@ -1,2 +0,2 @@

import { Breadcrumb, BreadcrumbHint, Client, ClientOptions, DataCategory, DsnComponents, DynamicSamplingContext, Envelope, Event, EventDropReason, EventHint, EventProcessor, FeedbackEvent, Integration, IntegrationClass, MetricBucketItem, MetricsAggregator, Outcome, SdkMetadata, Session, SessionAggregates, Severity, SeverityLevel, Transaction, Transport, TransportMakeRequestResponse } from '@sentry/types';
import { Breadcrumb, BreadcrumbHint, Client, ClientOptions, DataCategory, DsnComponents, DynamicSamplingContext, Envelope, Event, EventDropReason, EventHint, EventProcessor, FeedbackEvent, Integration, IntegrationClass, MetricBucketItem, MetricsAggregator, Outcome, ParameterizedString, SdkMetadata, Session, SessionAggregates, Severity, SeverityLevel, Transaction, Transport, TransportMakeRequestResponse } from '@sentry/types';
import { IntegrationIndex } from './integration';

@@ -70,3 +70,3 @@ import { Scope } from './scope';

*/
captureMessage(message: string, level?: Severity | SeverityLevel, hint?: EventHint, scope?: Scope): string | undefined;
captureMessage(message: ParameterizedString, level?: Severity | SeverityLevel, hint?: EventHint, scope?: Scope): string | undefined;
/**

@@ -262,3 +262,3 @@ * @inheritDoc

*/
abstract eventFromMessage(_message: string, _level?: Severity | SeverityLevel, _hint?: EventHint): PromiseLike<Event>;
abstract eventFromMessage(_message: ParameterizedString, _level?: Severity | SeverityLevel, _hint?: EventHint): PromiseLike<Event>;
}

@@ -265,0 +265,0 @@ /**

@@ -1,2 +0,2 @@

import { Breadcrumb, BreadcrumbHint, CaptureContext, CheckIn, Client, CustomSamplingContext, Event, EventHint, Extra, Extras, MonitorConfig, Primitive, Severity, SeverityLevel, TransactionContext, User } from '@sentry/types';
import { Breadcrumb, BreadcrumbHint, CaptureContext, CheckIn, Client, CustomSamplingContext, Event, EventHint, Extra, Extras, MonitorConfig, Primitive, Scope as ScopeInterface, Session, SessionContext, Severity, SeverityLevel, TransactionContext, User } from '@sentry/types';
import { Hub } from './hub';

@@ -7,21 +7,24 @@ import { Scope } from './scope';

* Captures an exception event and sends it to Sentry.
* This accepts an event hint as optional second parameter.
* Alternatively, you can also pass a CaptureContext directly as second parameter.
*
* @param exception The exception to capture.
* @param hint Optinal additional data to attach to the Sentry event.
* @returns the id of the captured Sentry event.
*/
export declare function captureException(exception: any, hint?: ExclusiveEventHintOrCaptureContext): ReturnType<Hub['captureException']>;
export declare function captureException(exception: any, hint?: ExclusiveEventHintOrCaptureContext): string;
/**
* Captures a message event and sends it to Sentry.
*
* @param message The message to send to Sentry.
* @param Severity Define the level of the message.
* @returns The generated eventId.
* @param exception The exception to capture.
* @param captureContext Define the level of the message or pass in additional data to attach to the message.
* @returns the id of the captured message.
*/
export declare function captureMessage(message: string, captureContext?: CaptureContext | Severity | SeverityLevel): ReturnType<Hub['captureMessage']>;
export declare function captureMessage(message: string, captureContext?: CaptureContext | Severity | SeverityLevel): string;
/**
* Captures a manually created event and sends it to Sentry.
*
* @param event The event to send to Sentry.
* @returns The generated eventId.
* @param exception The event to send to Sentry.
* @param hint Optional additional data to attach to the Sentry event.
* @returns the id of the captured event.
*/
export declare function captureEvent(event: Event, hint?: EventHint): ReturnType<Hub['captureEvent']>;
export declare function captureEvent(event: Event, hint?: EventHint): string;
/**

@@ -94,7 +97,9 @@ * Callback to set context information onto the scope.

* popScope();
*
* @param callback that will be enclosed into push/popScope.
*/
export declare function withScope<T>(callback: (scope: Scope) => T): T;
/**
* Set the given scope as the active scope in the callback.
*/
export declare function withScope<T>(scope: ScopeInterface | undefined, callback: (scope: Scope) => T): T;
/**
* Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.

@@ -118,2 +123,4 @@ *

* @returns The transaction which was just started
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/

@@ -170,2 +177,21 @@ export declare function startTransaction(context: TransactionContext, customSamplingContext?: CustomSamplingContext): ReturnType<Hub['startTransaction']>;

export declare function getCurrentScope(): Scope;
/**
* Start a session on the current isolation scope.
*
* @param context (optional) additional properties to be applied to the returned session object
*
* @returns the new active session
*/
export declare function startSession(context?: SessionContext): Session;
/**
* End the session on the current isolation scope.
*/
export declare function endSession(): void;
/**
* Sends the current session on the scope to Sentry
*
* @param end If set the session will be marked as exited and removed from the scope.
* Defaults to `false`.
*/
export declare function captureSession(end?: boolean): void;
//# sourceMappingURL=exports.d.ts.map

@@ -114,2 +114,4 @@ import { Breadcrumb, BreadcrumbHint, Client, CustomSamplingContext, Event, EventHint, Extra, Extras, Hub as HubInterface, Integration, IntegrationClass, Primitive, Session, SessionContext, Severity, SeverityLevel, Transaction, TransactionContext, User } from '@sentry/types';

* @inheritDoc
*
* @deprecated Use `Sentry.captureException()` instead.
*/

@@ -119,2 +121,4 @@ captureException(exception: unknown, hint?: EventHint): string;

* @inheritDoc
*
* @deprecated Use `Sentry.captureMessage()` instead.
*/

@@ -124,2 +128,4 @@ captureMessage(message: string, level?: Severity | SeverityLevel, hint?: EventHint): string;

* @inheritDoc
*
* @deprecated Use `Sentry.captureEvent()` instead.
*/

@@ -178,3 +184,19 @@ captureEvent(event: Event, hint?: EventHint): string;

/**
* @inheritDoc
* Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.
*
* A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a
* new child span within the transaction or any span, call the respective `.startChild()` method.
*
* Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.
*
* The transaction must be finished with a call to its `.end()` method, at which point the transaction with all its
* finished child spans will be sent to Sentry.
*
* @param context Properties of the new `Transaction`.
* @param customSamplingContext Information given to the transaction sampling function (along with context-dependent
* default values). See {@link Options.tracesSampler}.
*
* @returns The transaction which was just started
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/

@@ -190,2 +212,4 @@ startTransaction(context: TransactionContext, customSamplingContext?: CustomSamplingContext): Transaction;

* @inheritDoc
*
* @deprecated Use top level `captureSession` instead.
*/

@@ -195,2 +219,3 @@ captureSession(endSession?: boolean): void;

* @inheritDoc
* @deprecated Use top level `endSession` instead.
*/

@@ -200,2 +225,3 @@ endSession(): void;

* @inheritDoc
* @deprecated Use top level `startSession` instead.
*/

@@ -206,2 +232,5 @@ startSession(context?: SessionContext): Session;

* when Tracing is used.
*
* @deprecated Use top-level `getClient().getOptions().sendDefaultPii` instead. This function
* only unnecessarily increased API surface but only wrapped accessing the option.
*/

@@ -208,0 +237,0 @@ shouldSendDefaultPii(): boolean;

@@ -7,4 +7,5 @@ export { ClientClass } from './sdk';

export * from './tracing';
export * from './semanticAttributes';
export { createEventEnvelope, createSessionEnvelope } from './envelope';
export { addBreadcrumb, captureCheckIn, withMonitor, captureException, captureEvent, captureMessage, close, configureScope, flush, lastEventId, startTransaction, setContext, setExtra, setExtras, setTag, setTags, setUser, withScope, getClient, getCurrentScope, } from './exports';
export { addBreadcrumb, captureCheckIn, withMonitor, captureException, captureEvent, captureMessage, close, configureScope, flush, lastEventId, startTransaction, setContext, setExtra, setExtras, setTag, setTags, setUser, withScope, getClient, getCurrentScope, startSession, endSession, captureSession, } from './exports';
export { getCurrentHub, getIsolationScope, getHubFromCarrier, Hub, makeMain, getMainCarrier, runWithAsyncContext, setHubOnCarrier, ensureHubOnCarrier, setAsyncContextStrategy, } from './hub';

@@ -31,3 +32,3 @@ export { makeSession, closeSession, updateSession } from './session';

export { handleCallbackErrors } from './utils/handleCallbackErrors';
export { spanToTraceHeader } from './utils/spanUtils';
export { spanToTraceHeader, spanToJSON, spanIsSampled, } from './utils/spanUtils';
export { DEFAULT_ENVIRONMENT } from './constants';

@@ -34,0 +35,0 @@ export { ModuleMetadata } from './integrations/metadata';

@@ -40,3 +40,5 @@ import { Attachment, Breadcrumb, CaptureContext, Client, Context, Contexts, Event, EventHint, EventProcessor, Extra, Extras, Primitive, PropagationContext, RequestSession, Scope as ScopeInterface, ScopeData, Session, Severity, SeverityLevel, Span, Transaction, User } from '@sentry/types';

protected _level?: Severity | SeverityLevel;
/** Transaction Name */
/**
* Transaction Name
*/
protected _transactionName?: string;

@@ -121,3 +123,4 @@ /** Span */

/**
* @inheritDoc
* Sets the transaction name on the scope for future events.
* @deprecated Use extra or tags instead.
*/

@@ -130,11 +133,15 @@ setTransactionName(name?: string): this;

/**
* @inheritDoc
* Sets the Span on the scope.
* @param span Span
* @deprecated Instead of setting a span on a scope, use `startSpan()`/`startSpanManual()` instead.
*/
setSpan(span?: Span): this;
/**
* @inheritDoc
* Returns the `Span` if there is one.
* @deprecated Use `getActiveSpan()` instead.
*/
getSpan(): Span | undefined;
/**
* @inheritDoc
* Returns the `Transaction` attached to the scope (if there is one).
* @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
*/

@@ -209,2 +216,27 @@ getTransaction(): Transaction | undefined;

/**
* Capture an exception for this scope.
*
* @param exception The exception to capture.
* @param hint Optinal additional data to attach to the Sentry event.
* @returns the id of the captured Sentry event.
*/
captureException(exception: unknown, hint?: EventHint): string;
/**
* Capture a message for this scope.
*
* @param message The message to capture.
* @param level An optional severity level to report the message with.
* @param hint Optional additional data to attach to the Sentry event.
* @returns the id of the captured message.
*/
captureMessage(message: string, level?: SeverityLevel, hint?: EventHint): string;
/**
* Captures a manually created event for this scope and sends it to Sentry.
*
* @param exception The event to capture.
* @param hint Optional additional data to attach to the Sentry event.
* @returns the id of the captured event.
*/
captureEvent(event: Event, hint?: EventHint): string;
/**
* This will be called on every set call.

@@ -211,0 +243,0 @@ */

@@ -1,2 +0,2 @@

import { BaseTransportOptions, CheckIn, ClientOptions, Event, EventHint, MonitorConfig, Severity, SeverityLevel } from '@sentry/types';
import { BaseTransportOptions, CheckIn, ClientOptions, Event, EventHint, MonitorConfig, ParameterizedString, Severity, SeverityLevel } from '@sentry/types';
import { BaseClient } from './baseclient';

@@ -30,3 +30,3 @@ import { Scope } from './scope';

*/
eventFromMessage(message: string, level?: Severity | SeverityLevel, hint?: EventHint): PromiseLike<Event>;
eventFromMessage(message: ParameterizedString, level?: Severity | SeverityLevel, hint?: EventHint): PromiseLike<Event>;
/**

@@ -33,0 +33,0 @@ * @inheritDoc

@@ -1,8 +0,16 @@

import { Client, DynamicSamplingContext, Scope } from '@sentry/types';
import { Client, DynamicSamplingContext, Scope, Span } from '@sentry/types';
/**
* Creates a dynamic sampling context from a client.
*
* Dispatchs the `createDsc` lifecycle hook as a side effect.
* Dispatches the `createDsc` lifecycle hook as a side effect.
*/
export declare function getDynamicSamplingContextFromClient(trace_id: string, client: Client, scope?: Scope): DynamicSamplingContext;
/**
* Creates a dynamic sampling context from a span (and client and scope)
*
* @param span the span from which a few values like the root span name and sample rate are extracted.
*
* @returns a dynamic sampling context
*/
export declare function getDynamicSamplingContextFromSpan(span: Span): Readonly<Partial<DynamicSamplingContext>>;
//# sourceMappingURL=dynamicSamplingContext.d.ts.map

@@ -1,2 +0,2 @@

import { TransactionContext } from '@sentry/types';
import { SpanTimeInput, TransactionContext } from '@sentry/types';
import { Hub } from '../hub';

@@ -54,2 +54,5 @@ import { Span } from './span';

private _finishReason;
/**
* @deprecated Transactions will be removed in v8. Use spans instead.
*/
constructor(transactionContext: TransactionContext, _idleHub: Hub,

@@ -66,3 +69,3 @@ /**

/** {@inheritDoc} */
end(endTimestamp?: number): string | undefined;
end(endTimestamp?: SpanTimeInput): string | undefined;
/**

@@ -69,0 +72,0 @@ * Register a callback function that gets excecuted before the transaction finishes.

@@ -10,4 +10,4 @@ export { startIdleTransaction, addTracingExtensions } from './hubextensions';

export { trace, getActiveSpan, startSpan, startInactiveSpan, startActiveSpan, startSpanManual, continueTrace, } from './trace';
export { getDynamicSamplingContextFromClient } from './dynamicSamplingContext';
export { getDynamicSamplingContextFromClient, getDynamicSamplingContextFromSpan } from './dynamicSamplingContext';
export { setMeasurement } from './measurement';
//# sourceMappingURL=index.d.ts.map

@@ -1,2 +0,2 @@

import { Instrumenter, Primitive, Span as SpanInterface, SpanAttributeValue, SpanAttributes, SpanContext, SpanOrigin, TraceContext, Transaction } from '@sentry/types';
import { Instrumenter, Primitive, Span as SpanInterface, SpanAttributeValue, SpanAttributes, SpanContext, SpanContextData, SpanJSON, SpanOrigin, SpanTimeInput, TraceContext, Transaction } from '@sentry/types';
/**

@@ -27,10 +27,2 @@ * Keeps track of finished spans for a given transaction

*/
traceId: string;
/**
* @inheritDoc
*/
spanId: string;
/**
* @inheritDoc
*/
parentSpanId?: string;

@@ -42,6 +34,2 @@ /**

/**
* @inheritDoc
*/
sampled?: boolean;
/**
* Timestamp in seconds when the span was created.

@@ -59,8 +47,5 @@ */

/**
* @inheritDoc
* Tags for the span.
* @deprecated Use `getSpanAttributes(span)` instead.
*/
description?: string;
/**
* @inheritDoc
*/
tags: {

@@ -70,3 +55,4 @@ [key: string]: Primitive;

/**
* @inheritDoc
* Data for the span.
* @deprecated Use `getSpanAttributes(span)` instead.
*/

@@ -77,6 +63,2 @@ data: {

/**
* @inheritDoc
*/
attributes: SpanAttributes;
/**
* List of spans that were finalized

@@ -97,2 +79,8 @@ */

origin?: SpanOrigin;
protected _traceId: string;
protected _spanId: string;
protected _sampled: boolean | undefined;
protected _name?: string;
protected _attributes: SpanAttributes;
private _logMessage?;
/**

@@ -106,17 +94,80 @@ * You should never call the constructor manually, always use `Sentry.startTransaction()`

constructor(spanContext?: SpanContext);
/*An alias for `description` of the Span.
/*
* An alias for `description` of the Span.
* @deprecated Use `spanToJSON(span).description` instead.
* Update the name of the span.
* @deprecated Use `spanToJSON(span).description` instead.
*/
name: string;
/*
* Get the description of the Span.
* @deprecated Use `spanToJSON(span).description` instead.
* Get the description of the Span.
* @deprecated Use `spanToJSON(span).description` instead.
*/
description: string | undefined;
/*
* The ID of the trace.
* @deprecated Use `spanContext().traceId` instead.
* The ID of the trace.
* @deprecated You cannot update the traceId of a span after span creation.
*/
traceId: string;
/*
* The ID of the span.
* @deprecated Use `spanContext().spanId` instead.
* The ID of the span.
* @deprecated You cannot update the spanId of a span after span creation.
*/
spanId: string;
/*
* Was this span chosen to be sent as part of the sample?
* @deprecated Use `isRecording()` instead.
* Was this span chosen to be sent as part of the sample?
* @deprecated You cannot update the sampling decision of a span after span creation.
*/
sampled: boolean | undefined;
/*
* Attributes for the span.
* @deprecated Use `getSpanAttributes(span)` instead.
* Attributes for the span.
* @deprecated Use `setAttributes()` instead.
*/
attributes: SpanAttributes;
/** @inheritdoc */
spanContext(): SpanContextData;
/**
* @inheritDoc
* Creates a new `Span` while setting the current `Span.id` as `parentSpanId`.
* Also the `sampled` decision will be inherited.
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/
startChild(spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'sampled' | 'traceId' | 'parentSpanId'>>): Span;
/**
* @inheritDoc
* Sets the tag attribute on the current span.
*
* Can also be used to unset a tag, by passing `undefined`.
*
* @param key Tag key
* @param value Tag value
* @deprecated Use `setAttribute()` instead.
*/
setTag(key: string, value: Primitive): this;
/**
* @inheritDoc
* Sets the data attribute on the current span
* @param key Data key
* @param value Data value
* @deprecated Use `setAttribute()` instead.
*/

@@ -153,3 +204,3 @@ setData(key: string, value: any): this;

/** @inheritdoc */
end(endTimestamp?: number): void;
end(endTimestamp?: SpanTimeInput): void;
/**

@@ -172,22 +223,13 @@ * @inheritDoc

/**
* @inheritDoc
* Get JSON representation of this span.
*/
toJSON(): {
data?: {
[key: string]: any;
};
description?: string;
op?: string;
parent_span_id?: string;
span_id: string;
start_timestamp: number;
status?: string;
tags?: {
[key: string]: Primitive;
};
timestamp?: number;
trace_id: string;
origin?: SpanOrigin;
};
getSpanJSON(): SpanJSON;
/** @inheritdoc */
isRecording(): boolean;
/**
* Convert the object to JSON.
* @deprecated Use `spanToJSON(span)` instead.
*/
toJSON(): SpanJSON;
/**
* Get the merged data for this span.

@@ -194,0 +236,0 @@ * For now, this combines `data` and `attributes` together,

@@ -1,3 +0,85 @@

import { Span, TransactionContext } from '@sentry/types';
import { Instrumenter, Primitive, Scope, Span, SpanTimeInput, TransactionContext, TransactionMetadata } from '@sentry/types';
import { SpanAttributes } from '@sentry/types';
import { SpanOrigin } from '@sentry/types';
import { TransactionSource } from '@sentry/types';
import { tracingContextFromHeaders } from '@sentry/utils';
interface StartSpanOptions extends TransactionContext {
/** A manually specified start time for the created `Span` object. */
startTime?: SpanTimeInput;
/** If defined, start this span off this scope instead off the current scope. */
scope?: Scope;
/** The name of the span. */
name: string;
/** An op for the span. This is a categorization for spans. */
op?: string;
/** The origin of the span - if it comes from auto instrumenation or manual instrumentation. */
origin?: SpanOrigin;
/** Attributes for the span. */
attributes?: SpanAttributes;
/**
* @deprecated Manually set the end timestamp instead.
*/
trimEnd?: boolean;
/**
* @deprecated This cannot be set manually anymore.
*/
parentSampled?: boolean;
/**
* @deprecated Use attributes or set data on scopes instead.
*/
metadata?: Partial<TransactionMetadata>;
/**
* The name thingy.
* @deprecated Use `name` instead.
*/
description?: string;
/**
* @deprecated Use `span.setStatus()` instead.
*/
status?: string;
/**
* @deprecated Use `scope` instead.
*/
parentSpanId?: string;
/**
* @deprecated You cannot manually set the span to sampled anymore.
*/
sampled?: boolean;
/**
* @deprecated You cannot manually set the spanId anymore.
*/
spanId?: string;
/**
* @deprecated You cannot manually set the traceId anymore.
*/
traceId?: string;
/**
* @deprecated Use an attribute instead.
*/
source?: TransactionSource;
/**
* @deprecated Use attributes or set tags on the scope instead.
*/
tags?: {
[key: string]: Primitive;
};
/**
* @deprecated Use attributes instead.
*/
data?: {
[key: string]: any;
};
/**
* @deprecated Use `startTime` instead.
*/
startTimestamp?: number;
/**
* @deprecated Use `span.end()` instead.
*/
endTimestamp?: number;
/**
* @deprecated You cannot set the instrumenter manually anymore.
*/
instrumenter?: Instrumenter;
}
/**

@@ -29,3 +111,3 @@ * Wraps a function with a transaction/span and finishes the span after the function is done.

*/
export declare function startSpan<T>(context: TransactionContext, callback: (span: Span | undefined) => T): T;
export declare function startSpan<T>(context: StartSpanOptions, callback: (span: Span | undefined) => T): T;
/**

@@ -46,3 +128,3 @@ * @deprecated Use {@link startSpan} instead.

*/
export declare function startSpanManual<T>(context: TransactionContext, callback: (span: Span | undefined, finish: () => void) => T): T;
export declare function startSpanManual<T>(context: StartSpanOptions, callback: (span: Span | undefined, finish: () => void) => T): T;
/**

@@ -58,3 +140,3 @@ * Creates a span. This span is not set as active, so will not get automatic instrumentation spans

*/
export declare function startInactiveSpan(context: TransactionContext): Span | undefined;
export declare function startInactiveSpan(context: StartSpanOptions): Span | undefined;
/**

@@ -72,2 +154,3 @@ * Returns the currently active span.

}, callback: (transactionContext: Partial<TransactionContext>) => V): V;
export {};
//# sourceMappingURL=trace.d.ts.map

@@ -1,2 +0,2 @@

import { Context, DynamicSamplingContext, MeasurementUnit, Transaction as TransactionInterface, TransactionContext, TransactionEvent, TransactionMetadata } from '@sentry/types';
import { Context, DynamicSamplingContext, MeasurementUnit, SpanTimeInput, Transaction as TransactionInterface, TransactionContext, TransactionEvent, TransactionMetadata } from '@sentry/types';
import { Hub } from '../hub';

@@ -6,3 +6,2 @@ import { Span as SpanClass } from './span';

export declare class Transaction extends SpanClass implements TransactionInterface {
metadata: TransactionMetadata;
/**

@@ -12,3 +11,3 @@ * The reference to the current hub.

_hub: Hub;
private _name;
protected _name: string;
private _measurements;

@@ -18,2 +17,3 @@ private _contexts;

private _frozenDynamicSamplingContext;
private _metadata;
/**

@@ -25,9 +25,24 @@ * This constructor should never be called manually. Those instrumenting tracing should use

* @hidden
*
* @deprecated Transactions will be removed in v8. Use spans instead.
*/
constructor(transactionContext: TransactionContext, hub?: Hub);
/*Getter for `name` property
/*
* Getter for `name` property.
* @deprecated Use `spanToJSON(span).description` instead.
* Setter for `name` property, which also sets `source` as custom.
* @deprecated Use `updateName()` and `setMetadata()` instead.
*/
name: string;
/*
* Get the metadata for this transaction.
* @deprecated Use `spanGetMetadata(transaction)` instead.
* Update the metadata for this transaction.
* @deprecated Use `spanGetMetadata(transaction)` instead.
*/
metadata: TransactionMetadata;
/**

@@ -47,3 +62,4 @@ * Setter for `name` property, which also sets `source` on the metadata.

/**
* @inheritDoc
* Set the context of a transaction event.
* @deprecated Use either `.setAttribute()`, or set the context on the scope before creating the transaction.
*/

@@ -56,3 +72,4 @@ setContext(key: string, context: Context | null): void;

/**
* @inheritDoc
* Store metadata on this transaction.
* @deprecated Use attributes or store data on the scope instead.
*/

@@ -63,3 +80,3 @@ setMetadata(newMetadata: Partial<TransactionMetadata>): void;

*/
end(endTimestamp?: number): string | undefined;
end(endTimestamp?: SpanTimeInput): string | undefined;
/**

@@ -77,2 +94,4 @@ * @inheritDoc

* @experimental
*
* @deprecated Use top-level `getDynamicSamplingContextFromSpan` instead.
*/

@@ -79,0 +98,0 @@ getDynamicSamplingContext(): Readonly<Partial<DynamicSamplingContext>>;

import { Transaction } from '@sentry/types';
import { extractTraceparentData as _extractTraceparentData } from '@sentry/utils';
import { Hub } from '../hub';
/** Grabs active transaction off scope, if any */
/**
* Grabs active transaction off scope.
*
* @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
*/
export declare function getActiveTransaction<T extends Transaction>(maybeHub?: Hub): T | undefined;

@@ -20,6 +24,2 @@ export { stripUrlQueryAndFragment } from '@sentry/utils';

export declare const extractTraceparentData: typeof _extractTraceparentData;
/**
* Converts a timestamp to second, if it was in milliseconds, or keeps it as second.
*/
export declare function ensureTimestampInSeconds(timestamp: number): number;
//# sourceMappingURL=utils.d.ts.map

@@ -1,2 +0,4 @@

import { Span, TraceContext } from '@sentry/types';
import { Span, SpanJSON, SpanTimeInput, TraceContext } from '@sentry/types';
export declare const TRACE_FLAG_NONE = 0;
export declare const TRACE_FLAG_SAMPLED = 1;
/**

@@ -10,2 +12,23 @@ * Convert a span to a trace context, which can be sent as the `trace` context in an event.

export declare function spanToTraceHeader(span: Span): string;
/**
* Convert a span time input intp a timestamp in seconds.
*/
export declare function spanTimeInputToSeconds(input: SpanTimeInput | undefined): number;
/**
* Convert a span to a JSON representation.
* Note that all fields returned here are optional and need to be guarded against.
*
* Note: Because of this, we currently have a circular type dependency (which we opted out of in package.json).
* This is not avoidable as we need `spanToJSON` in `spanUtils.ts`, which in turn is needed by `span.ts` for backwards compatibility.
* And `spanToJSON` needs the Span class from `span.ts` to check here.
* TODO v8: When we remove the deprecated stuff from `span.ts`, we can remove the circular dependency again.
*/
export declare function spanToJSON(span: Span): Partial<SpanJSON>;
/**
* Returns true if a span is sampled.
* In most cases, you should just use `span.isRecording()` instead.
* However, this has a slightly different semantic, as it also returns false if the span is finished.
* So in the case where this distinction is important, use this method.
*/
export declare function spanIsSampled(span: Span): boolean;
//# sourceMappingURL=spanUtils.d.ts.map

@@ -1,2 +0,2 @@

export declare const SDK_VERSION = "7.92.0";
export declare const SDK_VERSION = "7.93.0";
//# sourceMappingURL=version.d.ts.map

@@ -1,2 +0,2 @@

import type { Breadcrumb, BreadcrumbHint, Client, ClientOptions, DataCategory, DsnComponents, DynamicSamplingContext, Envelope, Event, EventDropReason, EventHint, EventProcessor, FeedbackEvent, Integration, IntegrationClass, MetricBucketItem, MetricsAggregator, Outcome, SdkMetadata, Session, SessionAggregates, Severity, SeverityLevel, Transaction, Transport, TransportMakeRequestResponse } from '@sentry/types';
import type { Breadcrumb, BreadcrumbHint, Client, ClientOptions, DataCategory, DsnComponents, DynamicSamplingContext, Envelope, Event, EventDropReason, EventHint, EventProcessor, FeedbackEvent, Integration, IntegrationClass, MetricBucketItem, MetricsAggregator, Outcome, ParameterizedString, SdkMetadata, Session, SessionAggregates, Severity, SeverityLevel, Transaction, Transport, TransportMakeRequestResponse } from '@sentry/types';
import type { IntegrationIndex } from './integration';

@@ -70,3 +70,3 @@ import type { Scope } from './scope';

*/
captureMessage(message: string, level?: Severity | SeverityLevel, hint?: EventHint, scope?: Scope): string | undefined;
captureMessage(message: ParameterizedString, level?: Severity | SeverityLevel, hint?: EventHint, scope?: Scope): string | undefined;
/**

@@ -262,3 +262,3 @@ * @inheritDoc

*/
abstract eventFromMessage(_message: string, _level?: Severity | SeverityLevel, _hint?: EventHint): PromiseLike<Event>;
abstract eventFromMessage(_message: ParameterizedString, _level?: Severity | SeverityLevel, _hint?: EventHint): PromiseLike<Event>;
}

@@ -265,0 +265,0 @@ /**

@@ -1,2 +0,2 @@

import type { Breadcrumb, BreadcrumbHint, CaptureContext, CheckIn, Client, CustomSamplingContext, Event, EventHint, Extra, Extras, MonitorConfig, Primitive, Severity, SeverityLevel, TransactionContext, User } from '@sentry/types';
import type { Breadcrumb, BreadcrumbHint, CaptureContext, CheckIn, Client, CustomSamplingContext, Event, EventHint, Extra, Extras, MonitorConfig, Primitive, Scope as ScopeInterface, Session, SessionContext, Severity, SeverityLevel, TransactionContext, User } from '@sentry/types';
import type { Hub } from './hub';

@@ -7,21 +7,24 @@ import type { Scope } from './scope';

* Captures an exception event and sends it to Sentry.
* This accepts an event hint as optional second parameter.
* Alternatively, you can also pass a CaptureContext directly as second parameter.
*
* @param exception The exception to capture.
* @param hint Optinal additional data to attach to the Sentry event.
* @returns the id of the captured Sentry event.
*/
export declare function captureException(exception: any, hint?: ExclusiveEventHintOrCaptureContext): ReturnType<Hub['captureException']>;
export declare function captureException(exception: any, hint?: ExclusiveEventHintOrCaptureContext): string;
/**
* Captures a message event and sends it to Sentry.
*
* @param message The message to send to Sentry.
* @param Severity Define the level of the message.
* @returns The generated eventId.
* @param exception The exception to capture.
* @param captureContext Define the level of the message or pass in additional data to attach to the message.
* @returns the id of the captured message.
*/
export declare function captureMessage(message: string, captureContext?: CaptureContext | Severity | SeverityLevel): ReturnType<Hub['captureMessage']>;
export declare function captureMessage(message: string, captureContext?: CaptureContext | Severity | SeverityLevel): string;
/**
* Captures a manually created event and sends it to Sentry.
*
* @param event The event to send to Sentry.
* @returns The generated eventId.
* @param exception The event to send to Sentry.
* @param hint Optional additional data to attach to the Sentry event.
* @returns the id of the captured event.
*/
export declare function captureEvent(event: Event, hint?: EventHint): ReturnType<Hub['captureEvent']>;
export declare function captureEvent(event: Event, hint?: EventHint): string;
/**

@@ -94,7 +97,9 @@ * Callback to set context information onto the scope.

* popScope();
*
* @param callback that will be enclosed into push/popScope.
*/
export declare function withScope<T>(callback: (scope: Scope) => T): T;
/**
* Set the given scope as the active scope in the callback.
*/
export declare function withScope<T>(scope: ScopeInterface | undefined, callback: (scope: Scope) => T): T;
/**
* Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.

@@ -118,2 +123,4 @@ *

* @returns The transaction which was just started
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/

@@ -170,2 +177,21 @@ export declare function startTransaction(context: TransactionContext, customSamplingContext?: CustomSamplingContext): ReturnType<Hub['startTransaction']>;

export declare function getCurrentScope(): Scope;
/**
* Start a session on the current isolation scope.
*
* @param context (optional) additional properties to be applied to the returned session object
*
* @returns the new active session
*/
export declare function startSession(context?: SessionContext): Session;
/**
* End the session on the current isolation scope.
*/
export declare function endSession(): void;
/**
* Sends the current session on the scope to Sentry
*
* @param end If set the session will be marked as exited and removed from the scope.
* Defaults to `false`.
*/
export declare function captureSession(end?: boolean): void;
//# sourceMappingURL=exports.d.ts.map

@@ -114,2 +114,4 @@ import type { Breadcrumb, BreadcrumbHint, Client, CustomSamplingContext, Event, EventHint, Extra, Extras, Hub as HubInterface, Integration, IntegrationClass, Primitive, Session, SessionContext, Severity, SeverityLevel, Transaction, TransactionContext, User } from '@sentry/types';

* @inheritDoc
*
* @deprecated Use `Sentry.captureException()` instead.
*/

@@ -119,2 +121,4 @@ captureException(exception: unknown, hint?: EventHint): string;

* @inheritDoc
*
* @deprecated Use `Sentry.captureMessage()` instead.
*/

@@ -124,2 +128,4 @@ captureMessage(message: string, level?: Severity | SeverityLevel, hint?: EventHint): string;

* @inheritDoc
*
* @deprecated Use `Sentry.captureEvent()` instead.
*/

@@ -178,3 +184,19 @@ captureEvent(event: Event, hint?: EventHint): string;

/**
* @inheritDoc
* Starts a new `Transaction` and returns it. This is the entry point to manual tracing instrumentation.
*
* A tree structure can be built by adding child spans to the transaction, and child spans to other spans. To start a
* new child span within the transaction or any span, call the respective `.startChild()` method.
*
* Every child span must be finished before the transaction is finished, otherwise the unfinished spans are discarded.
*
* The transaction must be finished with a call to its `.end()` method, at which point the transaction with all its
* finished child spans will be sent to Sentry.
*
* @param context Properties of the new `Transaction`.
* @param customSamplingContext Information given to the transaction sampling function (along with context-dependent
* default values). See {@link Options.tracesSampler}.
*
* @returns The transaction which was just started
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/

@@ -190,2 +212,4 @@ startTransaction(context: TransactionContext, customSamplingContext?: CustomSamplingContext): Transaction;

* @inheritDoc
*
* @deprecated Use top level `captureSession` instead.
*/

@@ -195,2 +219,3 @@ captureSession(endSession?: boolean): void;

* @inheritDoc
* @deprecated Use top level `endSession` instead.
*/

@@ -200,2 +225,3 @@ endSession(): void;

* @inheritDoc
* @deprecated Use top level `startSession` instead.
*/

@@ -206,2 +232,5 @@ startSession(context?: SessionContext): Session;

* when Tracing is used.
*
* @deprecated Use top-level `getClient().getOptions().sendDefaultPii` instead. This function
* only unnecessarily increased API surface but only wrapped accessing the option.
*/

@@ -208,0 +237,0 @@ shouldSendDefaultPii(): boolean;

@@ -7,4 +7,5 @@ export type { ClientClass } from './sdk';

export * from './tracing';
export * from './semanticAttributes';
export { createEventEnvelope, createSessionEnvelope } from './envelope';
export { addBreadcrumb, captureCheckIn, withMonitor, captureException, captureEvent, captureMessage, close, configureScope, flush, lastEventId, startTransaction, setContext, setExtra, setExtras, setTag, setTags, setUser, withScope, getClient, getCurrentScope, } from './exports';
export { addBreadcrumb, captureCheckIn, withMonitor, captureException, captureEvent, captureMessage, close, configureScope, flush, lastEventId, startTransaction, setContext, setExtra, setExtras, setTag, setTags, setUser, withScope, getClient, getCurrentScope, startSession, endSession, captureSession, } from './exports';
export { getCurrentHub, getIsolationScope, getHubFromCarrier, Hub, makeMain, getMainCarrier, runWithAsyncContext, setHubOnCarrier, ensureHubOnCarrier, setAsyncContextStrategy, } from './hub';

@@ -31,3 +32,3 @@ export { makeSession, closeSession, updateSession } from './session';

export { handleCallbackErrors } from './utils/handleCallbackErrors';
export { spanToTraceHeader } from './utils/spanUtils';
export { spanToTraceHeader, spanToJSON, spanIsSampled, } from './utils/spanUtils';
export { DEFAULT_ENVIRONMENT } from './constants';

@@ -34,0 +35,0 @@ export { ModuleMetadata } from './integrations/metadata';

@@ -40,3 +40,5 @@ import type { Attachment, Breadcrumb, CaptureContext, Client, Context, Contexts, Event, EventHint, EventProcessor, Extra, Extras, Primitive, PropagationContext, RequestSession, Scope as ScopeInterface, ScopeData, Session, Severity, SeverityLevel, Span, Transaction, User } from '@sentry/types';

protected _level?: Severity | SeverityLevel;
/** Transaction Name */
/**
* Transaction Name
*/
protected _transactionName?: string;

@@ -121,3 +123,4 @@ /** Span */

/**
* @inheritDoc
* Sets the transaction name on the scope for future events.
* @deprecated Use extra or tags instead.
*/

@@ -130,11 +133,15 @@ setTransactionName(name?: string): this;

/**
* @inheritDoc
* Sets the Span on the scope.
* @param span Span
* @deprecated Instead of setting a span on a scope, use `startSpan()`/`startSpanManual()` instead.
*/
setSpan(span?: Span): this;
/**
* @inheritDoc
* Returns the `Span` if there is one.
* @deprecated Use `getActiveSpan()` instead.
*/
getSpan(): Span | undefined;
/**
* @inheritDoc
* Returns the `Transaction` attached to the scope (if there is one).
* @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
*/

@@ -209,2 +216,27 @@ getTransaction(): Transaction | undefined;

/**
* Capture an exception for this scope.
*
* @param exception The exception to capture.
* @param hint Optinal additional data to attach to the Sentry event.
* @returns the id of the captured Sentry event.
*/
captureException(exception: unknown, hint?: EventHint): string;
/**
* Capture a message for this scope.
*
* @param message The message to capture.
* @param level An optional severity level to report the message with.
* @param hint Optional additional data to attach to the Sentry event.
* @returns the id of the captured message.
*/
captureMessage(message: string, level?: SeverityLevel, hint?: EventHint): string;
/**
* Captures a manually created event for this scope and sends it to Sentry.
*
* @param exception The event to capture.
* @param hint Optional additional data to attach to the Sentry event.
* @returns the id of the captured event.
*/
captureEvent(event: Event, hint?: EventHint): string;
/**
* This will be called on every set call.

@@ -211,0 +243,0 @@ */

@@ -1,2 +0,2 @@

import type { BaseTransportOptions, CheckIn, ClientOptions, Event, EventHint, MonitorConfig, Severity, SeverityLevel } from '@sentry/types';
import type { BaseTransportOptions, CheckIn, ClientOptions, Event, EventHint, MonitorConfig, ParameterizedString, Severity, SeverityLevel } from '@sentry/types';
import { BaseClient } from './baseclient';

@@ -30,3 +30,3 @@ import type { Scope } from './scope';

*/
eventFromMessage(message: string, level?: Severity | SeverityLevel, hint?: EventHint): PromiseLike<Event>;
eventFromMessage(message: ParameterizedString, level?: Severity | SeverityLevel, hint?: EventHint): PromiseLike<Event>;
/**

@@ -33,0 +33,0 @@ * @inheritDoc

@@ -1,8 +0,16 @@

import type { Client, DynamicSamplingContext, Scope } from '@sentry/types';
import type { Client, DynamicSamplingContext, Scope, Span } from '@sentry/types';
/**
* Creates a dynamic sampling context from a client.
*
* Dispatchs the `createDsc` lifecycle hook as a side effect.
* Dispatches the `createDsc` lifecycle hook as a side effect.
*/
export declare function getDynamicSamplingContextFromClient(trace_id: string, client: Client, scope?: Scope): DynamicSamplingContext;
/**
* Creates a dynamic sampling context from a span (and client and scope)
*
* @param span the span from which a few values like the root span name and sample rate are extracted.
*
* @returns a dynamic sampling context
*/
export declare function getDynamicSamplingContextFromSpan(span: Span): Readonly<Partial<DynamicSamplingContext>>;
//# sourceMappingURL=dynamicSamplingContext.d.ts.map

@@ -1,2 +0,2 @@

import type { TransactionContext } from '@sentry/types';
import type { SpanTimeInput, TransactionContext } from '@sentry/types';
import type { Hub } from '../hub';

@@ -54,2 +54,5 @@ import type { Span } from './span';

private _finishReason;
/**
* @deprecated Transactions will be removed in v8. Use spans instead.
*/
constructor(transactionContext: TransactionContext, _idleHub: Hub,

@@ -66,3 +69,3 @@ /**

/** {@inheritDoc} */
end(endTimestamp?: number): string | undefined;
end(endTimestamp?: SpanTimeInput): string | undefined;
/**

@@ -69,0 +72,0 @@ * Register a callback function that gets excecuted before the transaction finishes.

@@ -10,4 +10,4 @@ export { startIdleTransaction, addTracingExtensions } from './hubextensions';

export { trace, getActiveSpan, startSpan, startInactiveSpan, startActiveSpan, startSpanManual, continueTrace, } from './trace';
export { getDynamicSamplingContextFromClient } from './dynamicSamplingContext';
export { getDynamicSamplingContextFromClient, getDynamicSamplingContextFromSpan } from './dynamicSamplingContext';
export { setMeasurement } from './measurement';
//# sourceMappingURL=index.d.ts.map

@@ -1,2 +0,2 @@

import type { Instrumenter, Primitive, Span as SpanInterface, SpanAttributeValue, SpanAttributes, SpanContext, SpanOrigin, TraceContext, Transaction } from '@sentry/types';
import type { Instrumenter, Primitive, Span as SpanInterface, SpanAttributeValue, SpanAttributes, SpanContext, SpanContextData, SpanJSON, SpanOrigin, SpanTimeInput, TraceContext, Transaction } from '@sentry/types';
/**

@@ -27,10 +27,2 @@ * Keeps track of finished spans for a given transaction

*/
traceId: string;
/**
* @inheritDoc
*/
spanId: string;
/**
* @inheritDoc
*/
parentSpanId?: string;

@@ -42,6 +34,2 @@ /**

/**
* @inheritDoc
*/
sampled?: boolean;
/**
* Timestamp in seconds when the span was created.

@@ -59,8 +47,5 @@ */

/**
* @inheritDoc
* Tags for the span.
* @deprecated Use `getSpanAttributes(span)` instead.
*/
description?: string;
/**
* @inheritDoc
*/
tags: {

@@ -70,3 +55,4 @@ [key: string]: Primitive;

/**
* @inheritDoc
* Data for the span.
* @deprecated Use `getSpanAttributes(span)` instead.
*/

@@ -77,6 +63,2 @@ data: {

/**
* @inheritDoc
*/
attributes: SpanAttributes;
/**
* List of spans that were finalized

@@ -97,2 +79,8 @@ */

origin?: SpanOrigin;
protected _traceId: string;
protected _spanId: string;
protected _sampled: boolean | undefined;
protected _name?: string;
protected _attributes: SpanAttributes;
private _logMessage?;
/**

@@ -106,18 +94,86 @@ * You should never call the constructor manually, always use `Sentry.startTransaction()`

constructor(spanContext?: SpanContext);
/** An alias for `description` of the Span. */
/**
* An alias for `description` of the Span.
* @deprecated Use `spanToJSON(span).description` instead.
*/
get name(): string;
/**
* Update the name of the span.
* @deprecated Use `spanToJSON(span).description` instead.
*/
set name(name: string);
/**
* @inheritDoc
* Get the description of the Span.
* @deprecated Use `spanToJSON(span).description` instead.
*/
get description(): string | undefined;
/**
* Get the description of the Span.
* @deprecated Use `spanToJSON(span).description` instead.
*/
set description(description: string | undefined);
/**
* The ID of the trace.
* @deprecated Use `spanContext().traceId` instead.
*/
get traceId(): string;
/**
* The ID of the trace.
* @deprecated You cannot update the traceId of a span after span creation.
*/
set traceId(traceId: string);
/**
* The ID of the span.
* @deprecated Use `spanContext().spanId` instead.
*/
get spanId(): string;
/**
* The ID of the span.
* @deprecated You cannot update the spanId of a span after span creation.
*/
set spanId(spanId: string);
/**
* Was this span chosen to be sent as part of the sample?
* @deprecated Use `isRecording()` instead.
*/
get sampled(): boolean | undefined;
/**
* Was this span chosen to be sent as part of the sample?
* @deprecated You cannot update the sampling decision of a span after span creation.
*/
set sampled(sampled: boolean | undefined);
/**
* Attributes for the span.
* @deprecated Use `getSpanAttributes(span)` instead.
*/
get attributes(): SpanAttributes;
/**
* Attributes for the span.
* @deprecated Use `setAttributes()` instead.
*/
set attributes(attributes: SpanAttributes);
/** @inheritdoc */
spanContext(): SpanContextData;
/**
* Creates a new `Span` while setting the current `Span.id` as `parentSpanId`.
* Also the `sampled` decision will be inherited.
*
* @deprecated Use `startSpan()`, `startSpanManual()` or `startInactiveSpan()` instead.
*/
startChild(spanContext?: Pick<SpanContext, Exclude<keyof SpanContext, 'sampled' | 'traceId' | 'parentSpanId'>>): Span;
/**
* @inheritDoc
* Sets the tag attribute on the current span.
*
* Can also be used to unset a tag, by passing `undefined`.
*
* @param key Tag key
* @param value Tag value
* @deprecated Use `setAttribute()` instead.
*/
setTag(key: string, value: Primitive): this;
/**
* @inheritDoc
* Sets the data attribute on the current span
* @param key Data key
* @param value Data value
* @deprecated Use `setAttribute()` instead.
*/

@@ -154,3 +210,3 @@ setData(key: string, value: any): this;

/** @inheritdoc */
end(endTimestamp?: number): void;
end(endTimestamp?: SpanTimeInput): void;
/**

@@ -173,22 +229,13 @@ * @inheritDoc

/**
* @inheritDoc
* Get JSON representation of this span.
*/
toJSON(): {
data?: {
[key: string]: any;
};
description?: string;
op?: string;
parent_span_id?: string;
span_id: string;
start_timestamp: number;
status?: string;
tags?: {
[key: string]: Primitive;
};
timestamp?: number;
trace_id: string;
origin?: SpanOrigin;
};
getSpanJSON(): SpanJSON;
/** @inheritdoc */
isRecording(): boolean;
/**
* Convert the object to JSON.
* @deprecated Use `spanToJSON(span)` instead.
*/
toJSON(): SpanJSON;
/**
* Get the merged data for this span.

@@ -195,0 +242,0 @@ * For now, this combines `data` and `attributes` together,

@@ -1,3 +0,85 @@

import type { Span, TransactionContext } from '@sentry/types';
import type { Instrumenter, Primitive, Scope, Span, SpanTimeInput, TransactionContext, TransactionMetadata } from '@sentry/types';
import type { SpanAttributes } from '@sentry/types';
import type { SpanOrigin } from '@sentry/types';
import type { TransactionSource } from '@sentry/types';
import { tracingContextFromHeaders } from '@sentry/utils';
interface StartSpanOptions extends TransactionContext {
/** A manually specified start time for the created `Span` object. */
startTime?: SpanTimeInput;
/** If defined, start this span off this scope instead off the current scope. */
scope?: Scope;
/** The name of the span. */
name: string;
/** An op for the span. This is a categorization for spans. */
op?: string;
/** The origin of the span - if it comes from auto instrumenation or manual instrumentation. */
origin?: SpanOrigin;
/** Attributes for the span. */
attributes?: SpanAttributes;
/**
* @deprecated Manually set the end timestamp instead.
*/
trimEnd?: boolean;
/**
* @deprecated This cannot be set manually anymore.
*/
parentSampled?: boolean;
/**
* @deprecated Use attributes or set data on scopes instead.
*/
metadata?: Partial<TransactionMetadata>;
/**
* The name thingy.
* @deprecated Use `name` instead.
*/
description?: string;
/**
* @deprecated Use `span.setStatus()` instead.
*/
status?: string;
/**
* @deprecated Use `scope` instead.
*/
parentSpanId?: string;
/**
* @deprecated You cannot manually set the span to sampled anymore.
*/
sampled?: boolean;
/**
* @deprecated You cannot manually set the spanId anymore.
*/
spanId?: string;
/**
* @deprecated You cannot manually set the traceId anymore.
*/
traceId?: string;
/**
* @deprecated Use an attribute instead.
*/
source?: TransactionSource;
/**
* @deprecated Use attributes or set tags on the scope instead.
*/
tags?: {
[key: string]: Primitive;
};
/**
* @deprecated Use attributes instead.
*/
data?: {
[key: string]: any;
};
/**
* @deprecated Use `startTime` instead.
*/
startTimestamp?: number;
/**
* @deprecated Use `span.end()` instead.
*/
endTimestamp?: number;
/**
* @deprecated You cannot set the instrumenter manually anymore.
*/
instrumenter?: Instrumenter;
}
/**

@@ -29,3 +111,3 @@ * Wraps a function with a transaction/span and finishes the span after the function is done.

*/
export declare function startSpan<T>(context: TransactionContext, callback: (span: Span | undefined) => T): T;
export declare function startSpan<T>(context: StartSpanOptions, callback: (span: Span | undefined) => T): T;
/**

@@ -46,3 +128,3 @@ * @deprecated Use {@link startSpan} instead.

*/
export declare function startSpanManual<T>(context: TransactionContext, callback: (span: Span | undefined, finish: () => void) => T): T;
export declare function startSpanManual<T>(context: StartSpanOptions, callback: (span: Span | undefined, finish: () => void) => T): T;
/**

@@ -58,3 +140,3 @@ * Creates a span. This span is not set as active, so will not get automatic instrumentation spans

*/
export declare function startInactiveSpan(context: TransactionContext): Span | undefined;
export declare function startInactiveSpan(context: StartSpanOptions): Span | undefined;
/**

@@ -72,2 +154,3 @@ * Returns the currently active span.

}, callback: (transactionContext: Partial<TransactionContext>) => V): V;
export {};
//# sourceMappingURL=trace.d.ts.map

@@ -1,2 +0,2 @@

import type { Context, DynamicSamplingContext, MeasurementUnit, Transaction as TransactionInterface, TransactionContext, TransactionEvent, TransactionMetadata } from '@sentry/types';
import type { Context, DynamicSamplingContext, MeasurementUnit, SpanTimeInput, Transaction as TransactionInterface, TransactionContext, TransactionEvent, TransactionMetadata } from '@sentry/types';
import type { Hub } from '../hub';

@@ -6,3 +6,2 @@ import { Span as SpanClass } from './span';

export declare class Transaction extends SpanClass implements TransactionInterface {
metadata: TransactionMetadata;
/**

@@ -12,3 +11,3 @@ * The reference to the current hub.

_hub: Hub;
private _name;
protected _name: string;
private _measurements;

@@ -18,2 +17,3 @@ private _contexts;

private _frozenDynamicSamplingContext;
private _metadata;
/**

@@ -25,11 +25,27 @@ * This constructor should never be called manually. Those instrumenting tracing should use

* @hidden
*
* @deprecated Transactions will be removed in v8. Use spans instead.
*/
constructor(transactionContext: TransactionContext, hub?: Hub);
/** Getter for `name` property */
/**
* Getter for `name` property.
* @deprecated Use `spanToJSON(span).description` instead.
*/
get name(): string;
/**
* Setter for `name` property, which also sets `source` as custom.
* @deprecated Use `updateName()` and `setMetadata()` instead.
*/
set name(newName: string);
/**
* Get the metadata for this transaction.
* @deprecated Use `spanGetMetadata(transaction)` instead.
*/
get metadata(): TransactionMetadata;
/**
* Update the metadata for this transaction.
* @deprecated Use `spanGetMetadata(transaction)` instead.
*/
set metadata(metadata: TransactionMetadata);
/**
* Setter for `name` property, which also sets `source` on the metadata.

@@ -48,3 +64,4 @@ *

/**
* @inheritDoc
* Set the context of a transaction event.
* @deprecated Use either `.setAttribute()`, or set the context on the scope before creating the transaction.
*/

@@ -57,3 +74,4 @@ setContext(key: string, context: Context | null): void;

/**
* @inheritDoc
* Store metadata on this transaction.
* @deprecated Use attributes or store data on the scope instead.
*/

@@ -64,3 +82,3 @@ setMetadata(newMetadata: Partial<TransactionMetadata>): void;

*/
end(endTimestamp?: number): string | undefined;
end(endTimestamp?: SpanTimeInput): string | undefined;
/**

@@ -78,2 +96,4 @@ * @inheritDoc

* @experimental
*
* @deprecated Use top-level `getDynamicSamplingContextFromSpan` instead.
*/

@@ -80,0 +100,0 @@ getDynamicSamplingContext(): Readonly<Partial<DynamicSamplingContext>>;

import type { Transaction } from '@sentry/types';
import { extractTraceparentData as _extractTraceparentData } from '@sentry/utils';
import type { Hub } from '../hub';
/** Grabs active transaction off scope, if any */
/**
* Grabs active transaction off scope.
*
* @deprecated You should not rely on the transaction, but just use `startSpan()` APIs instead.
*/
export declare function getActiveTransaction<T extends Transaction>(maybeHub?: Hub): T | undefined;

@@ -20,6 +24,2 @@ export { stripUrlQueryAndFragment } from '@sentry/utils';

export declare const extractTraceparentData: typeof _extractTraceparentData;
/**
* Converts a timestamp to second, if it was in milliseconds, or keeps it as second.
*/
export declare function ensureTimestampInSeconds(timestamp: number): number;
//# sourceMappingURL=utils.d.ts.map

@@ -1,2 +0,4 @@

import type { Span, TraceContext } from '@sentry/types';
import type { Span, SpanJSON, SpanTimeInput, TraceContext } from '@sentry/types';
export declare const TRACE_FLAG_NONE = 0;
export declare const TRACE_FLAG_SAMPLED = 1;
/**

@@ -10,2 +12,23 @@ * Convert a span to a trace context, which can be sent as the `trace` context in an event.

export declare function spanToTraceHeader(span: Span): string;
/**
* Convert a span time input intp a timestamp in seconds.
*/
export declare function spanTimeInputToSeconds(input: SpanTimeInput | undefined): number;
/**
* Convert a span to a JSON representation.
* Note that all fields returned here are optional and need to be guarded against.
*
* Note: Because of this, we currently have a circular type dependency (which we opted out of in package.json).
* This is not avoidable as we need `spanToJSON` in `spanUtils.ts`, which in turn is needed by `span.ts` for backwards compatibility.
* And `spanToJSON` needs the Span class from `span.ts` to check here.
* TODO v8: When we remove the deprecated stuff from `span.ts`, we can remove the circular dependency again.
*/
export declare function spanToJSON(span: Span): Partial<SpanJSON>;
/**
* Returns true if a span is sampled.
* In most cases, you should just use `span.isRecording()` instead.
* However, this has a slightly different semantic, as it also returns false if the span is finished.
* So in the case where this distinction is important, use this method.
*/
export declare function spanIsSampled(span: Span): boolean;
//# sourceMappingURL=spanUtils.d.ts.map

@@ -1,2 +0,2 @@

export declare const SDK_VERSION = "7.92.0";
export declare const SDK_VERSION = "7.93.0";
//# sourceMappingURL=version.d.ts.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc