-
Notifications
You must be signed in to change notification settings - Fork 15
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
Server SDKs resilient to network/http errors #307
Comments
Hey @devnev thanks for the issue. I agree we should do a better job of handling failures and likely provide a fallback/default value. I think we could just go ahead and implement this and create new versions of the sdks. Alternatively we could do it in an iterative way by introducing methods with fallbacks like you described in addition to the existing methods and deprecate the existing ones and then do major version updates to swap to those with defaults. Wdyt? |
@markphelps For myself, I would like to get to SDKs that require a fallback parameter as quickly as possible, so a new version with breaking changes would be fine. But I don't know about your general userbase or your release policies, you will have to make the call on how you wish to procede. |
Ironically, my PHP example somewhat confirms the issue, as catching |
@devnev would it help If we add the |
@erka My "immediate" fix has been to wrap the client I'm using and expose the wrapper instead. IIUC the annotation would require PHPStan to have any effect, is that correct? I'd definitely prefer not having to integrate another tool, and finding out which editors support it. Additionally, as shown in the initial example, exception handling in PHP (and most languages with exceptions) is quite clunky. |
@devnev you are a happy person. Company usually requires to have such tools during the PR review and PHPStan could help with those findings. It would be great if you could check #308 and share your feedback about if ($flipt->booleanValue('flag1', true, ...)) { ... } wdyt? |
@erka thanks for the PR. The new methods make sense for me, and the annotations mean with the right tooling it would check my box on visibility.
|
@devnev Thank you for your feedback!
I think the constructor has too much params already so I don't want to change it. Also PSR-3 has
Great catch! I have addressed it. Sorry that I force pushed into the branch and it's hard to see the changes. |
Thanks. Browsing through the clients, it still feels like the question applies to most of them. The Java client is even throwing RuntimeExceptions to avoid having checked exceptions. And in discussionf of most languages I've generally heard engineers preferring to not have checked exceptions. |
@devnev Thank you for pointing that out. I will take a look on it and apply the same patterns. |
For my use-case, I would like to avoid having Flipt on the critical path to request handling, i.e. high latency or errors from Flipt should not fail a request. This can already be accomplished, but in some languages it requires awareness and a bunch of surrounding code at every location where flipt is invoked.
e.g. its OK in Rust:
but in PHP, its easy to miss, and noisy to fix:
So I'm wondering if SDKs where this is relevant could include aids to make callers of flipt more resilient.
I can imagine a few approaches:
The text was updated successfully, but these errors were encountered: