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

Function _prepareEvent

packages/core/src/client.ts:1335–1374  ·  view source on GitHub ↗

* Adds common information to events. * * The information includes release and environment from `options`, * breadcrumbs and context (extra, tags and user) from the scope. * * Information that is already present in the event is never overwritten. For * nested objects, such as the co

(
    event: Event,
    hint: EventHint,
    currentScope: Scope,
    isolationScope: Scope,
  )

Source from the content-addressed store, hash-verified

1333 * @returns A new event with more information.
1334 */
1335 protected _prepareEvent(
1336 event: Event,
1337 hint: EventHint,
1338 currentScope: Scope,
1339 isolationScope: Scope,
1340 ): PromiseLike<Event | null> {
1341 const options = this.getOptions();
1342 const integrations = this.getIntegrationNames();
1343 if (!hint.integrations && integrations.length) {
1344 hint.integrations = integrations;
1345 }
1346
1347 this.emit('preprocessEvent', event, hint);
1348
1349 if (!event.type) {
1350 isolationScope.setLastEventId(event.event_id || hint.event_id);
1351 }
1352
1353 return prepareEvent(options, event, hint, currentScope, this, isolationScope).then(evt => {
1354 if (evt === null) {
1355 return evt;
1356 }
1357
1358 this.emit('postprocessEvent', evt, hint);
1359
1360 evt.contexts = {
1361 trace: { ...evt.contexts?.trace, ...getTraceContextFromScope(currentScope) },
1362 ...evt.contexts,
1363 };
1364
1365 const dynamicSamplingContext = getDynamicSamplingContextFromScope(this, currentScope);
1366
1367 evt.sdkProcessingMetadata = {
1368 dynamicSamplingContext,
1369 ...evt.sdkProcessingMetadata,
1370 };
1371
1372 return evt;
1373 });
1374 }
1375
1376 /**
1377 * Processes the event and logs an error in case of rejection

Callers

nothing calls this directly

Calls 7

prepareEventFunction · 0.90
getTraceContextFromScopeFunction · 0.90
setLastEventIdMethod · 0.80
getOptionsMethod · 0.65
emitMethod · 0.65
thenMethod · 0.45

Tested by

no test coverage detected