Skip to content

Recording an error may carry attributes #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 8, 2023
Merged

Recording an error may carry attributes #90

merged 4 commits into from
Mar 8, 2023

Conversation

ktoso
Copy link
Member

@ktoso ktoso commented Feb 24, 2023

Motivation:
It can be used to attach more information bout the error, like its stacktrace and similar information.

This is also supported by the otel spec, so we're aligning closer with it here.

Modifications:

Change the recordError to accept optional span attributes

Result:

more powerful record error API

resolves #45

**Motivation:**
It can be used to attach more information bout the error, like its
stacktrace and similar information.

This is also supported by the otel spec, so we're aligning closer with
it here.

**Modifications:**

Change the recordError to accept optional span attributes

**Result:**

more powerful record error API
Copy link
Collaborator

@slashmo slashmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this 👍

Comment on lines +278 to +283
XCTAssertTrue(endedSpan != nil)
XCTAssertEqual(endedSpan!.recordedErrors.count, 1)
let error = endedSpan!.recordedErrors.first!.0
XCTAssertEqual(error as! ExampleSpanError, errorToThrow)
let attrs = endedSpan!.recordedErrors.first!.1
XCTAssertEqual(attrs, attrsForError)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to use XCTUnwrap here instead of the force unwraps?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meh, tbh I don't mind those !, thank you for the review!

@ktoso ktoso merged commit d633b17 into main Mar 8, 2023
@ktoso ktoso deleted the wip-error-attrs branch March 13, 2023 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Span.recordError should take optional SpanAttributes
2 participants