MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / clear

Method clear

packages/core/src/scope.ts:553–575  ·  view source on GitHub ↗

* Clears the current scope and resets its properties. * Note: The client will not be cleared.

()

Source from the content-addressed store, hash-verified

551 * Note: The client will not be cleared.
552 */
553 public clear(): this {
554 // client is not cleared here on purpose!
555 this._breadcrumbs = [];
556 this._tags = {};
557 this._attributes = {};
558 this._extra = {};
559 this._user = {};
560 this._contexts = {};
561 this._level = undefined;
562 this._transactionName = undefined;
563 this._fingerprint = undefined;
564 this._session = undefined;
565 this._conversationId = undefined;
566 _setSpanForScope(this, undefined);
567 this._attachments = [];
568 this.setPropagationContext({
569 traceId: generateTraceId(),
570 sampleRand: safeMathRandom(),
571 });
572
573 this._notifyScopeListeners();
574 return this;
575 }
576
577 /**
578 * Adds a breadcrumb to the scope.

Callers

nothing calls this directly

Calls 5

setPropagationContextMethod · 0.95
_notifyScopeListenersMethod · 0.95
_setSpanForScopeFunction · 0.90
generateTraceIdFunction · 0.90
safeMathRandomFunction · 0.90

Tested by

no test coverage detected