vtex / node-vtex-api

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

Add disk cache steps and retry count to tracing #550

Closed mairatma closed 1 year ago

mairatma commented 1 year ago

What is the purpose of this pull request?

Enhance our traces with useful information for tracking retries and disk cache improvements.

What problem is this solving?

We're investigating some problems within the pages-graphql Nodejs app, and have some hypotheses related to retries and disk cache delays/cpu usage causing the problems. This PR adds more information to our traces so that we can better investigate as well as better track improvements via Honeycomb.

How should this be manually tested?

Yarn linking @vtex/api on a locally vtex linked pages-graphql app. Example workspace here.

Screenshots or example usage

New disk cache spans Mostly MISS

Mostly HIT/STALE

Screenshot:

Screenshot 2023-10-10 at 10 25 44

Dash showing how to track count/times for disk cache steps for different clients.

Retry count and error code Trace with retry. For this trace I had to locally lower the timeout for vbase calls to 50ms, to reproduce timeouts and see them in the trace.

Screenshot:

Screenshot 2023-10-10 at 11 21 11

Types of changes