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

Method clone

packages/core/src/scope.ts:184–215  ·  view source on GitHub ↗

* Clone all data from this scope into a new scope.

()

Source from the content-addressed store, hash-verified

182 * Clone all data from this scope into a new scope.
183 */
184 public clone(): Scope {
185 const newScope = new Scope();
186 newScope._breadcrumbs = [...this._breadcrumbs];
187 newScope._tags = { ...this._tags };
188 newScope._attributes = { ...this._attributes };
189 newScope._extra = { ...this._extra };
190 newScope._contexts = { ...this._contexts };
191 if (this._contexts.flags) {
192 // We need to copy the `values` array so insertions on a cloned scope
193 // won't affect the original array.
194 newScope._contexts.flags = {
195 values: [...this._contexts.flags.values],
196 };
197 }
198
199 newScope._user = this._user;
200 newScope._level = this._level;
201 newScope._session = this._session;
202 newScope._transactionName = this._transactionName;
203 newScope._fingerprint = this._fingerprint;
204 newScope._eventProcessors = [...this._eventProcessors];
205 newScope._attachments = [...this._attachments];
206 newScope._sdkProcessingMetadata = { ...this._sdkProcessingMetadata };
207 newScope._propagationContext = { ...this._propagationContext };
208 newScope._client = this._client;
209 newScope._lastEventId = this._lastEventId;
210 newScope._conversationId = this._conversationId;
211
212 _setSpanForScope(newScope, _getSpanForScope(this));
213
214 return newScope;
215 }
216
217 /**
218 * Update the client assigned to this scope.

Callers

nothing calls this directly

Calls 2

_setSpanForScopeFunction · 0.90
_getSpanForScopeFunction · 0.90

Tested by

no test coverage detected