fix: add feature flag retry circuit breaker#247
Conversation
posthog-dotnet Compliance ReportDate: 2026-06-27 10:48:18 UTC
|
| Test | Status | Duration |
|---|---|---|
| Request Payload.Request With Person Properties Device Id | ❌ | 47ms |
| Request Payload.Flags Request Uses V2 Query Param | ❌ | 23ms |
| Request Payload.Flags Request Hits Flags Path Not Decide | ❌ | 6ms |
| Request Payload.Flags Request Omits Authorization Header | ❌ | 5ms |
| Request Payload.Token In Flags Body Matches Init | ❌ | 5ms |
| Request Payload.Groups Round Trip | ❌ | 5ms |
| Request Payload.Groups Default To Empty Object | ❌ | 5ms |
| Request Payload.Person Properties Distinct Id Auto Populated When Caller Omits It | ❌ | 5ms |
| Request Payload.Disable Geoip False Propagates As Geoip Disable False | ❌ | 5ms |
| Request Payload.Disable Geoip Omitted Defaults To False | ❌ | 5ms |
| Request Payload.Flag Keys To Evaluate Contains Only Requested Key | ❌ | 5ms |
| Request Lifecycle.No Flags Request On Init Alone | ✅ | 4ms |
| Request Lifecycle.No Flags Request On Normal Capture | ✅ | 188ms |
| Request Lifecycle.Two Flag Calls Produce Two Remote Requests | ❌ | 8ms |
| Request Lifecycle.Mock Response Value Is Returned To Caller | ❌ | 6ms |
| Side Effect Events.Get Feature Flag Captures Feature Flag Called Event | ❌ | 5ms |
Failures
request_payload.request_with_person_properties_device_id
404, message='Not Found', url='http://sdk-adapter:8080/get_feature_flag'
request_payload.flags_request_uses_v2_query_param
404, message='Not Found', url='http://sdk-adapter:8080/get_feature_flag'
request_payload.flags_request_hits_flags_path_not_decide
404, message='Not Found', url='http://sdk-adapter:8080/get_feature_flag'
request_payload.flags_request_omits_authorization_header
404, message='Not Found', url='http://sdk-adapter:8080/get_feature_flag'
request_payload.token_in_flags_body_matches_init
404, message='Not Found', url='http://sdk-adapter:8080/get_feature_flag'
request_payload.groups_round_trip
404, message='Not Found', url='http://sdk-adapter:8080/get_feature_flag'
request_payload.groups_default_to_empty_object
404, message='Not Found', url='http://sdk-adapter:8080/get_feature_flag'
request_payload.person_properties_distinct_id_auto_populated_when_caller_omits_it
404, message='Not Found', url='http://sdk-adapter:8080/get_feature_flag'
request_payload.disable_geoip_false_propagates_as_geoip_disable_false
404, message='Not Found', url='http://sdk-adapter:8080/get_feature_flag'
request_payload.disable_geoip_omitted_defaults_to_false
404, message='Not Found', url='http://sdk-adapter:8080/get_feature_flag'
request_payload.flag_keys_to_evaluate_contains_only_requested_key
404, message='Not Found', url='http://sdk-adapter:8080/get_feature_flag'
request_lifecycle.two_flag_calls_produce_two_remote_requests
404, message='Not Found', url='http://sdk-adapter:8080/get_feature_flag'
request_lifecycle.mock_response_value_is_returned_to_caller
404, message='Not Found', url='http://sdk-adapter:8080/get_feature_flag'
side_effect_events.get_feature_flag_captures_feature_flag_called_event
404, message='Not Found', url='http://sdk-adapter:8080/get_feature_flag'
|
@haacked wdyt about this circuit break approach? (we can also make the 30s configurable) |
|
Reviews (1): Last reviewed commit: "fix: add feature flag retry circuit brea..." | Re-trigger Greptile |
|
@marandaneto I meant to submit the review as a comment, not approval! But I trust you to do the right thing. 😄 |
thx for the review, yeah it was just a draft with a concept, will check and work on it on monday, then i can port this change across other sdks that have a similar situation |
|
i re-requested review to remove the approval, but no need to re-review until i address the comments and make it ready for review |
💡 Motivation and Context
Stacked on top of #245 to prototype a circuit breaker for
/flagsretry behavior in a multithreaded/stateless SDK.The existing retry is bounded per call, but during a broad connectivity issue many concurrent request threads can each sleep and retry independently. This adds a shared circuit breaker so repeated transient
/flagstransport failures put the SDK into a short cooldown and subsequent calls fail fast instead of all sleeping/retrying.💚 How did you test it?
dotnet test tests/UnitTests/UnitTests.csproj --filter FullyQualifiedName~HttpClientExtensionsTestsgit diff --check📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Implemented as a draft stacked PR for review. The circuit opens after consecutive transient
/flagsfailures, fails fast during cooldown, and allows a half-open probe after cooldown. HTTP/API status failures remain non-retryable and do not trip the transient-failure circuit.