-
Notifications
You must be signed in to change notification settings - Fork 47
feat: allow setting attributes when recording exceptions #97
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. strictly speaking this is a breaking change for a typescript user as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ha, that's an interseting edge case! Closing this PR either way, but thanks for catching. |
||||||
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( | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we use an overload here to be more specific? e.g. like this:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like that. For symmetry, I would change the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated in new commit |
||||||
exception: Exception, | ||||||
attributes?: SpanAttributes, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
time?: TimeInput | ||||||
): void; | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to make this optional here. The other overload allows already a call with name only.