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

Exposing http statusCode to the error object #229

Open
thamcheongkit opened this issue Jan 18, 2024 · 0 comments
Open

Exposing http statusCode to the error object #229

thamcheongkit opened this issue Jan 18, 2024 · 0 comments

Comments

@thamcheongkit
Copy link

Hi, I'm trying to implement retry mechanism based on http response status code based on track events api reference doc:

  • Send data as quickly as possible with concurrent clients until the server returns 429. We see the best results with 10-20 concurrent clients sending 2K events per batch.
  • When you see 429s, employ an exponential backoff with jitter strategy. We recommend starting with a backoff of 2s and doubling backoff until 60s, with 1-5s of jitter.
  • We recommend gzip compression and using Content-Encoding: gzip to reduce network egress and transfer time.
  • In the rare event that our API returns a 502 or 503 status code, we recommend employing the same exponential backoff strategy as with 429s.
  • Please do not retry validation errors (400 status code), as they will consistently fail and count toward the rate limit.

excerpt from this wonderful doc

However, the generic Error thrown by the sdk today does not contains the statusCode structurally, making error handling difficult. I don't find similar issue being discussed in the past. Wondering if something can be done, I'm more than happy to contribute. Cheers!

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

No branches or pull requests

1 participant