Skip to content

fix: Enhance error logs in store's Watch func#1865

Merged
toddbaert merged 7 commits intoopen-feature:mainfrom
open-feature-forking:fix/enhance-store-error-logs
Feb 9, 2026
Merged

fix: Enhance error logs in store's Watch func#1865
toddbaert merged 7 commits intoopen-feature:mainfrom
open-feature-forking:fix/enhance-store-error-logs

Conversation

@leakonvalinka
Copy link
Member

This PR

  • improves errror logs in the store's Watch function

Related Issues

#1863

Signed-off-by: Konvalinka <lea.konvalinka@dynatrace.com>
@leakonvalinka leakonvalinka requested review from a team as code owners February 5, 2026 11:05
@netlify
Copy link

netlify bot commented Feb 5, 2026

Deploy Preview for polite-licorice-3db33c ready!

Name Link
🔨 Latest commit b9a1998
🔍 Latest deploy log https://app.netlify.com/projects/polite-licorice-3db33c/deploys/69899b51b4f5c800082f36e6
😎 Deploy Preview https://deploy-preview-1865--polite-licorice-3db33c.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Feb 5, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @leakonvalinka, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on improving the diagnostic capabilities of the store's Watch function by enhancing its error logging. The changes ensure that error messages related to flag watching include specific selector information, making it significantly easier to understand the context of failures and debug issues more efficiently.

Highlights

  • Enhanced Error Logging: Introduced a selectorString variable to capture and format details of the selector being used in the Watch function.
  • Improved Error Context: Modified error messages within the Watch function to include the selectorString, providing more specific context when errors occur during flag retrieval or context-based watching.
Changelog
  • core/pkg/store/store.go
    • Added logic to extract and format selector details into a selectorString for use in error messages.
    • Updated the error log message for s.selectOrAll(selector) failures to include the newly formatted selectorString.
    • Updated the error log message for ws.WatchCtx(ctx) failures to include the selectorString for better context.
Activity
  • No human activity (comments, reviews) has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances error logging in the Watch function by including selector information. The change is a good improvement for debuggability. I've added one suggestion to make the selector string generation more robust by handling selectors with multiple constraints, which will prevent potentially misleading log messages.

Copy link
Member

@aepfli aepfli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes are simple and nice, some questions and suggestions from my side added. especially i think we should extract the generation of the string into an own method.

@toddbaert
Copy link
Member

toddbaert commented Feb 5, 2026

I think the reason this came up is because some client's like us internally use stream deadlines. Stream deadlines are sent from the client, but enforced both on the client and on the server. This error will fire when the context deadline is exceeded, which is perfectly expected in our case. You can test this by connecting a client with a 10s stream deadline to flagd, and you will see this basically every 10s, I think.

We may want to log this as debug if the error is a deadline exceeded.

EDIT:

You can do this with grpcurl

grpcurl -max-time 10   -plaintext   -import-path "$PROTO_DIR" -proto flagd/sync/v1/sync.proto   -d '{"selector": "flagSetId=app-flags"}'   localhost:8015   flagd.sync.v1.FlagSyncService/SyncFlags

10s later:

2026-02-05T07:46:04.414-0500    error   store/store.go:329      error watching flags: context canceled
github.com/open-feature/flagd/core/pkg/store.(*Store).Watch.func1
        /home/todd/git/flagd/core/pkg/store/store.go:329

Signed-off-by: Konvalinka <lea.konvalinka@dynatrace.com>
@leakonvalinka
Copy link
Member Author

If we go from log level error to debug, it might take users longer to notice the logs. If this is a transitive error then that's fine I think, but if it requires user/client action it would be good to have some error log. I'm not 100% grasping what the error is about so if that doesn't make sense forget about it :D

@toddbaert
Copy link
Member

toddbaert commented Feb 5, 2026

If we go from log level error to debug, it might take users longer to notice the logs. If this is a transitive error then that's fine I think, but if it requires user/client action it would be good to have some error log. I'm not 100% grasping what the error is about so if that doesn't make sense forget about it :D

Basically, if the error is one of these types, it's not an error: ctx.Err() == context.DeadlineExceeded || ctx.Err() == context.Canceled, it's totally expected behavior because either the client has disconnected cleanly (maybe the client is shutting down) or the client's deadline is up.

Other errors are really unexpected, but these are not (not every ergonomic, I know).

Signed-off-by: Konvalinka <lea.konvalinka@dynatrace.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: lea konvalinka <lea.konvalinka@dynatrace.com>
Signed-off-by: Konvalinka <lea.konvalinka@dynatrace.com>
@leakonvalinka leakonvalinka force-pushed the fix/enhance-store-error-logs branch from bd6252d to a1d5eea Compare February 5, 2026 13:32
Signed-off-by: Konvalinka <lea.konvalinka@dynatrace.com>
Signed-off-by: Konvalinka <lea.konvalinka@dynatrace.com>
@toddbaert toddbaert requested a review from erka February 6, 2026 13:33
@toddbaert toddbaert self-requested a review February 6, 2026 15:33
@toddbaert toddbaert requested review from toddbaert and removed request for toddbaert February 6, 2026 15:33
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 9, 2026

@toddbaert toddbaert merged commit a58a707 into open-feature:main Feb 9, 2026
17 checks passed
@toddbaert toddbaert deleted the fix/enhance-store-error-logs branch February 9, 2026 13:48
@github-actions github-actions bot mentioned this pull request Feb 6, 2026
toddbaert pushed a commit that referenced this pull request Feb 9, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>flagd: 0.13.3</summary>

##
[0.13.3](flagd/v0.13.2...flagd/v0.13.3)
(2026-02-09)


### 🐛 Bug Fixes

* case sensitivity in header context mapping
([#1855](#1855))
([be5c94f](be5c94f))
</details>

<details><summary>core: 0.13.3</summary>

##
[0.13.3](core/v0.13.2...core/v0.13.3)
(2026-02-09)


### 🐛 Bug Fixes

* correct parameter order in histogram bucket configuration ⚠️
([#1859](#1859))
([335af32](335af32))
* Enhance error logs in store's Watch func
([#1865](#1865))
([a58a707](a58a707))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Signed-off-by: OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants