Skip to content
This repository has been archived by the owner on Nov 10, 2022. It is now read-only.

Commit

Permalink
Merge 81fc4d3 into 7441fea
Browse files Browse the repository at this point in the history
  • Loading branch information
vreynolds authored Jun 24, 2021
2 parents 7441fea + 81fc4d3 commit 5f24c7e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
12 changes: 10 additions & 2 deletions src/trace/NonRecordingSpan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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 {}
}
32 changes: 27 additions & 5 deletions src/trace/span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}

0 comments on commit 5f24c7e

Please sign in to comment.