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

Function sendEvent

packages/core/src/client.ts:550–570  ·  view source on GitHub ↗

* Send a fully prepared event to Sentry.

(event: Event, hint: EventHint = {})

Source from the content-addressed store, hash-verified

548 * Send a fully prepared event to Sentry.
549 */
550 public sendEvent(event: Event, hint: EventHint = {}): void {
551 this.emit('beforeSendEvent', event, hint);
552
553 // Extract gen_ai spans from transaction and convert to span v2 format.
554 // This mutates event.spans to remove the extracted spans.
555 const genAiSpanItem = extractGenAiSpansFromEvent(event, this);
556
557 let env = createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);
558
559 for (const attachment of hint.attachments || []) {
560 env = addItemToEnvelope(env, createAttachmentEnvelopeItem(attachment));
561 }
562
563 if (genAiSpanItem) {
564 env = addItemToEnvelope(env, genAiSpanItem);
565 }
566
567 // sendEnvelope should not throw
568 // eslint-disable-next-line @typescript-eslint/no-floating-promises
569 this.sendEnvelope(env).then(sendResponse => this.emit('afterSendEvent', event, sendResponse));
570 }
571
572 /**
573 * Send a session or session aggregrates to Sentry.

Callers

nothing calls this directly

Calls 6

createEventEnvelopeFunction · 0.90
addItemToEnvelopeFunction · 0.90
emitMethod · 0.65
thenMethod · 0.45

Tested by

no test coverage detected