Skip to content
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

feat: Add additional fields collected by the TraceKit package for stack traces #383

Merged
merged 7 commits into from
Nov 13, 2024

Conversation

jairo-mendoza
Copy link
Contributor

@jairo-mendoza jairo-mendoza commented Nov 7, 2024

Short description of the changes

Introduces the TraceKit package to the web distro. Adds additional fields with the help of the TraceKit package. These additional fields are prefixed with exception.structured_stacktrace. Additional fields will be sent by GlobalErrorsInstrumentation.

How to verify that this has the expected result

I tested locally using the hello-world-web example provided by the web-distro. Made the example to throw a simple error. This was the result I received on Honeycomb:

Screenshot 2024-11-07 at 3 34 27 PM

Big thanks to @pkanal for helping with this change!

@jairo-mendoza jairo-mendoza changed the title feat(errors): Add additional fields collected by the TraceKit package for StackTraces feat(errors): Add additional fields collected by the TraceKit package for stack traces Nov 7, 2024
@jairo-mendoza jairo-mendoza marked this pull request as ready for review November 7, 2024 23:37
@jairo-mendoza jairo-mendoza requested a review from a team as a code owner November 7, 2024 23:37
@jairo-mendoza jairo-mendoza changed the title feat(errors): Add additional fields collected by the TraceKit package for stack traces feat: Add additional fields collected by the TraceKit package for stack traces Nov 7, 2024

it('should return an object with structured stack trace information', () => {
expect(instr._computeStackTrace(new Error('This is an error'))).toEqual({
'exception.structured_stacktrace.columns': expect.any(Array),
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm happy to have this as a follow up PR but it would be great to assert on an actual transformation of a stack track here instead of checking that this returns an array. We would have to mock the Error.stack property and with a sample stack trace and then check that the results are the line numbers, column numbers and urls that we expect.

Copy link
Contributor Author

@jairo-mendoza jairo-mendoza Nov 12, 2024

Choose a reason for hiding this comment

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

I noticed a weird quirk with TraceKit, mocking Error.stack resulted in some lines being missing for certain stacks. Mocking Error.originalStack works perfectly though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha, I'm gonna approve this as is and we can tackle these tests separately. Can you leave a TODO comment here for that?

Copy link
Contributor

Choose a reason for hiding this comment

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

We can also do this through smoke tests!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding the TODO now

@jairo-mendoza jairo-mendoza merged commit 43ac2d7 into main Nov 13, 2024
16 checks passed
@jairo-mendoza jairo-mendoza deleted the jairo.integrate-TraceKit branch November 13, 2024 18:18
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.

2 participants