diff --git a/src/trace/NonRecordingSpan.ts b/src/trace/NonRecordingSpan.ts index bd5e321e..7220e3cf 100644 --- a/src/trace/NonRecordingSpan.ts +++ b/src/trace/NonRecordingSpan.ts @@ -48,7 +48,11 @@ export class NonRecordingSpan implements Span { } // By default does nothing - addEvent(_name: string, _attributes?: SpanAttributes): this { + addEvent( + _name: string, + _attributesOrTime?: SpanAttributes | TimeInput, + _time?: TimeInput + ): this { return this; } @@ -71,5 +75,9 @@ export class NonRecordingSpan implements Span { } // By default does nothing - recordException(_exception: Exception, _time?: TimeInput): void {} + recordException( + _exception: Exception, + _attributesOrTime?: SpanAttributes | TimeInput, + _time?: TimeInput + ): void {} } diff --git a/src/trace/span.ts b/src/trace/span.ts index d80b8c26..f0954a80 100644 --- a/src/trace/span.ts +++ b/src/trace/span.ts @@ -65,14 +65,21 @@ export interface Span { * Adds an event to the Span. * * @param name the name of the event. - * @param [attributesOrStartTime] the attributes that will be added; these are - * associated with this event. Can be also a start time - * if type is {@type TimeInput} and 3rd param is undefined + * @param [startTime] start time of the event. + */ + addEvent(name: string, startTime?: TimeInput): this; + + /** + * Adds an event to the Span. + * + * @param name the name of the event. + * @param [attributes] the attributes that will be added; these are + * associated with this event. * @param [startTime] start time of the event. */ addEvent( name: string, - attributesOrStartTime?: SpanAttributes | TimeInput, + attributes?: SpanAttributes, startTime?: TimeInput ): this; @@ -120,10 +127,25 @@ export interface Span { isRecording(): boolean; /** - * Sets exception as a span event + * Sets exception as a span event. + * * @param exception the exception the only accepted values are string or Error * @param [time] the time to set as Span's event time. If not provided, * use the current time. */ recordException(exception: Exception, time?: TimeInput): void; + + /** + * Sets exception as a span event. + * + * @param exception the exception the only accepted values are string or Error + * @param [attributes] additional attributes to be associated with this event. + * @param [time] the time to set as Span's event time. If not provided, + * use the current time. + */ + recordException( + exception: Exception, + attributes?: SpanAttributes, + time?: TimeInput + ): void; }