-
Notifications
You must be signed in to change notification settings - Fork 16
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
Fix error details not being logged in the tracing's span event #543
Conversation
@@ -61,7 +61,7 @@ export class ErrorReport extends ErrorReportBase { | |||
} | |||
|
|||
const serializableError = this.toObject() |
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.
toObject
returns some JS object with error details.
@@ -61,7 +61,7 @@ export class ErrorReport extends ErrorReportBase { | |||
} | |||
|
|||
const serializableError = this.toObject() | |||
span.log({ event: 'error', ...indexedLogs, error: serializableError }) | |||
span.log({ event: 'error', ...indexedLogs, 'error.details': serializableError }) |
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.
Instead of the JS object mentioned above, we're always getting a boolean for the field error
. I think by using a different key, that doesn't conflict with a general "error" name, should fix it.
The span event "error" logs a field called "error" that is expected to contain the error's details, but is instead displaying as a boolean on Honeycomb. This is causing us to miss some important information when debuging an error span. This issue seems to be that a field called "error" is already definded as boolean. A solution would be to rename this field, in this specific span event, to something like "error.details" (we already have "error.id" and "error.kind").
8dd6a12
to
0edfbe4
Compare
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.
@filipewl it might be worth talking to someone from the Observability team to see how to test this. Isn't there a way to force a trace to be created for a request to linked code?
event: 'error', | ||
...indexedLogs, | ||
[ErrorReportLogFields.ERROR_MESSAGE]: serializableError.message, | ||
[ErrorReportLogFields.ERROR_METADATA]: serializableError.metadata, |
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.
Do we need to manually serialize this as well? It returns an object from its type definition.
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.
Good call! I'll flatten this object.
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.
Done here.
@mairatma, I figured out this with @arturpimentel. There's a header |
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.
Awesome, thanks! Lgtm
Addresses this comment: #543 (comment)
@@ -65,7 +65,8 @@ export class ErrorReport extends ErrorReportBase { | |||
event: 'error', | |||
...indexedLogs, | |||
[ErrorReportLogFields.ERROR_MESSAGE]: serializableError.message, | |||
[ErrorReportLogFields.ERROR_METADATA]: serializableError.metadata, | |||
[ErrorReportLogFields.ERROR_METADATA_METRICS_INSTANTIATION_TIME]: serializableError.metadata.reportCount, |
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.
@filipewl is there any chance that metadata
may be null or undefined? Just making sure we won't throw here by mistake.
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.
Type-wise, it doesn't look like it can, but I'm afraid of runtime data... I added some optional chaining here to be safe.
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.
Also afraid, thanks!
Type-wise it cannot be null but I'm not sure we can trust with runtime data. Addresses this comment: #543 (comment)
Conflicts: CHANGELOG.md src/tracing/errorReporting/ErrorReport.ts
What is the purpose of this pull request?
Fix how the field "error" of an "error" span event is not displaying the error's details.
What problem is this solving?
It appears this "error" field is categorized as a boolean type, so the expected error details isn't being used. By renaming this field to "error.details", we expect to have it displayed on Honeycomb.
How should this be manually tested?
pages-graphql
andrender-server
apps.jaeger-debug-id=ANY_ID_YOU_WANT_USE_TO_QUERY_HONEYCOMB
.jaeger-debug-id = ANY_ID_YOU_WANT_USE_TO_QUERY_HONEYCOMB
to find your traces.Example of a trace with error span. Check the "Span events" tab on the side bar and expand the "error" event.
Types of changes