vtex / node-vtex-api

VTEX IO API Client for Node
76 stars 16 forks source link

Fix error details not being logged in the tracing's span event #543

Closed filipewl closed 1 year ago

filipewl commented 1 year ago

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.

Before After
CleanShot 2023-09-14 at 14 01 28@2x CleanShot 2023-09-19 at 12 24 19

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?

  1. Visit https://filipelimaxtracing--storecomponents.myvtex.com/ where I have yarn-linked this branch to a vtex-linked pages-graphql and render-server apps.
  2. To avoid being sampled, use a browser extension to include the header jaeger-debug-id=ANY_ID_YOU_WANT_USE_TO_QUERY_HONEYCOMB.
  3. Navigate through the store to send some traces to Honeycomb.
  4. In Honeycomb's Query page, add a WHERE filter to 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

filipewl commented 1 year ago

@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?

@mairatma, I figured out this with @arturpimentel. There's a header jaeger-debug-id that you can include in the requests so they won't be sampled and that can be later used on Honeycomb to find your traces. I've updated the PR's description to explain how to test and added a link to a tracing example.