Conversation
✅ Deploy Preview for polite-licorice-3db33c canceled.
|
✅ Deploy Preview for polite-licorice-3db33c ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Summary of ChangesHello @toddbaert, 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 introduces robust caching capabilities to the OFREP bulk evaluation endpoint by implementing HTTP ETag support. This enhancement significantly optimizes performance for clients, particularly those using polling mechanisms, by preventing redundant data transfers when flag configurations remain unchanged. It's a critical step towards deprecating the Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request adds ETag-based caching to the OFREP bulk evaluation endpoint, which is a great feature for improving performance and reducing server load. The implementation is solid and includes good test coverage. I've provided a few suggestions to further improve performance by avoiding redundant JSON marshaling and to enhance logging by using structured fields, which will improve maintainability.
| } | ||
|
|
||
| // calculateETag generates an ETag from the bulk evaluation response | ||
| func calculateETag(response ofrep.BulkEvaluationResponse) (string, []byte, error) { |
There was a problem hiding this comment.
Q: For the ETag calculation the flags must be in the same order every time, is this guaranteed?
There was a problem hiding this comment.
Great point!
Ordering in maps in Go is intentionally non-deterministic so that devs cannot rely on it, but the JSON marshalling in Go does sort them:
https://github.com/golang/go/blob/master/src/encoding/json/encode.go#L183-L189
So we can rely on that.
There was a problem hiding this comment.
Okay good to know, thank you!
There was a problem hiding this comment.
TIL as well (the json marshall ordering bit). I know maps were purposely random in Go, so I was quite scared for a second.
I went back and forth on this as well. SHA-1 was my first thought. It's not spec'd or anything so we could change it later... I will go back to sha1 and save some CPU cycles. |
Did this and also added some minor docs. |
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: Roman Dmytrenko <rdmytrenko@gmail.com> Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
1c64261 to
73f07a4
Compare
|
|
Hey @erka @jonathannorris @jonathannorris @leakonvalinka If you have time, take a look at this alternative, which does something more like @jonathannorris suggested: #1858 |



Implement caching in bulk evaluations as per OFREP spec.
See: https://openfeature.dev/docs/reference/other-technologies/ofrep/openapi
This is a requirement for deprecating the flagd-web-provider, as without it, polling would be substantially more expensive.
Relates to: open-feature/js-sdk-contrib#1459