fix: high gRPC client error rate from ad calling flagd.evaluation.v2.Service/EventStream - #509
Conversation
Nudgebee Change Gate✅ Pass
Based on Nudgebee rightsizing recommendations and incident investigations from the last 30 days. |
There was a problem hiding this comment.
Code Review
This pull request updates the write_state/1 function in FlagdUi.Storage to write the state to a temporary file first and then rename it to the target path, ensuring atomic file writes. There are no review comments, and I have no additional feedback to provide.
…Service/EventStream # Changes The `flagd-ui` service updates the shared `demo.flagd.json` configuration file by writing directly to it using `File.write!`. This in-place modification triggers a `REMOVE` event in `flagd`'s `fsnotify` watcher, which breaks active `EventStream` connections for clients like the `ad` service, resulting in a 100% gRPC error rate. To fix this, the file writing mechanism in `src/flagd-ui/lib/flagd_ui/storage.ex` has been updated to use an atomic rename (writing to a temporary file first, then renaming it to the target file). This ensures `fsnotify` detects a `CREATE` or `WRITE` event instead of a `REMOVE`, maintaining stable `EventStream` connections. ## Original Error/Logs <details> <summary>Click to expand the original error that triggered this fix</summary> ``` Title: High gRPC client error rate from ad calling flagd.evaluation.v2.Service/EventStream Description: gRPC client error rate exceeded 5% when calling downstream service. Caller: ad Target: flagd.evaluation.v2.Service/EventStream Deployment: ad Pod: ad-66df4f848c-68pkp Error Rate: 100% Causality Chain (Root Cause): - Symptom: 100% gRPC client error rate from ad calling flagd.evaluation.v2.Service/EventStream. - Why? The ad service is unable to maintain a successful gRPC EventStream connection to the downstream flagd service. - Why? The flagd service's internal flag synchronization was disrupted because its configuration file watcher detected the file being removed. - Root Cause: The demo.flagd.json file was modified or replaced in the shared volume in a way that triggered a REMOVE event in flagd's fsnotify watcher at 08:48:03 UTC, breaking the active EventStream for connected clients. ``` </details> ## Merge Requirements For new features contributions, please make sure you have completed the following essential items: * [ ] `CHANGELOG.md` updated to document new feature additions * [ ] Appropriate documentation updates in the [docs][] * [ ] Appropriate Helm chart updates in the [helm-charts][] <!-- A Pull Request that modifies instrumentation code will likely require an update in docs. Please make sure to update the opentelemetry.io repo with any docs changes. A Pull Request that modifies docker-compose.yaml, otelcol-config.yaml, or Grafana dashboards will likely require an update to the Demo Helm chart. Other changes affecting how a service is deployed will also likely require an update to the Demo Helm chart. --> Maintainers will not merge until the above have been completed. If you're unsure which docs need to be changed ping the [@open-telemetry/demo-approvers](https://github.com/orgs/open-telemetry/teams/demo-approvers). [docs]: https://opentelemetry.io/docs/demo/ [helm-charts]: https://github.com/open-telemetry/opentelemetry-helm-charts --- 🤖 **This PR was automatically generated by [NudgeBee](https://nudgebee.com) AI coding agent** *Powered by AI-driven code analysis and automated fix generation* 🔍 **[View Original Investigation](https://app.nudgebee.com/investigate?id=bac7b536-d837-49e8-9ecb-c5ae27ff0d4b)** *Click the link above to see the full investigation and analysis that led to this fix* View Detailed **[Nubi Conversation](https://app.nudgebee.com/ask-nudgebee?accountId=b8b80eb3-a8af-4b7f-8ab0-7c2b28d49f8a&session_id=event-4e5814060f02a944)**
6942f13 to
7954354
Compare
Nudgebee Automated FollowupUpdated CHANGELOG.md to document the fix for the high gRPC client error rate from ad calling flagd.evaluation.v2.Service/EventStream, fulfilling the PR merge requirements. The code changes in Changes: Review comments: 2 acknowledged Commit: |
Nudgebee Change Gate✅ Pass
Based on Nudgebee rightsizing recommendations and incident investigations from the last 30 days. |
|
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
Changes
The
flagd-uiservice updates the shareddemo.flagd.jsonconfiguration file by writing directly to it usingFile.write!. This in-place modification triggers aREMOVEevent inflagd'sfsnotifywatcher, which breaks activeEventStreamconnections for clients like theadservice, resulting in a 100% gRPC error rate.To fix this, the file writing mechanism in
src/flagd-ui/lib/flagd_ui/storage.exhas been updated to use an atomic rename (writing to a temporary file first, then renaming it to the target file). This ensuresfsnotifydetects aCREATEorWRITEevent instead of aREMOVE, maintaining stableEventStreamconnections.Original Error/Logs
Click to expand the original error that triggered this fix
Merge Requirements
For new features contributions, please make sure you have completed the following
essential items:
CHANGELOG.mdupdated to document new feature additionsMaintainers will not merge until the above have been completed. If you're unsure
which docs need to be changed ping the
@open-telemetry/demo-approvers.
🤖 This PR was automatically generated by NudgeBee AI coding agent
Powered by AI-driven code analysis and automated fix generation
🔍 View Original Investigation
Click the link above to see the full investigation and analysis that led to this fix
View Detailed Nubi Conversation