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

Method addEvent

packages/core/src/tracing/sentrySpan.ts:289–308  ·  view source on GitHub ↗

* @inheritdoc

(
    name: string,
    attributesOrStartTime?: SpanAttributes | SpanTimeInput,
    startTime?: SpanTimeInput,
  )

Source from the content-addressed store, hash-verified

287 * @inheritdoc
288 */
289 public addEvent(
290 name: string,
291 attributesOrStartTime?: SpanAttributes | SpanTimeInput,
292 startTime?: SpanTimeInput,
293 ): this {
294 DEBUG_BUILD && debug.log('[Tracing] Adding an event to span:', name);
295
296 const time = isSpanTimeInput(attributesOrStartTime) ? attributesOrStartTime : startTime || timestampInSeconds();
297 const attributes = isSpanTimeInput(attributesOrStartTime) ? {} : attributesOrStartTime || {};
298
299 const event: TimedEvent = {
300 name,
301 time: spanTimeInputToSeconds(time),
302 attributes,
303 };
304
305 this._events.push(event);
306
307 return this;
308 }
309
310 /**
311 * This method should generally not be used,

Callers

nothing calls this directly

Calls 5

timestampInSecondsFunction · 0.90
spanTimeInputToSecondsFunction · 0.90
isSpanTimeInputFunction · 0.85
pushMethod · 0.80
logMethod · 0.65

Tested by

no test coverage detected