-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Add support for hooks. #493
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
Conversation
d441c2d to
5cf0bcd
Compare
|
bugbot review |
| extern "C" { | ||
| #endif | ||
|
|
||
| typedef struct p_LDServerSDKEvaluationSeriesContext* LDServerSDKEvaluationSeriesContext; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, there was a mistake with the syntax of the clang-tidy suppression in the base binding implementations. Which result in suppressing all tidy messages.
We are not doing that here, and the result is that these opaque struct definitions were encountering: https://clang.llvm.org/extra/clang-tidy/checks/bugprone/reserved-identifier.html
Which isn't going to be a problem because the compiler isn't going to spontaneously reserve these very specific names.
But to appease it here I have started with p_. This first name isn't used by calling code, but we just want it to not look like it should be used either.
There are two primary aspects to this PR. The first is support for hooks, and the second is support for a Go context like addition to the variation API.
The reason for this addition is that it may not be possible in all environments to automatically get the current span parent using OTEL.
The default context management strategy in OTEL uses thread-local storage, which can cause problems when an async framework is handling multiple requests in a single thread. In that scenario the application manually determines the parent-child relationship (unless they have async aware custom context management).
BEGIN_COMMIT_OVERRIDE
feat: Add support for hooks.
fix: Discard track events when the associated context is invalid.
END_COMMIT_OVERRIDE
Note
Introduce a full hooks system (with hook context) across C++ and C APIs, integrate it into evaluations/tracking, add WithHookContext overloads, drop invalid-context track events, and update build/deps with extensive tests.
hooks::Hook,HookContext,EvaluationSeriesContext/Data(+Builder),TrackSeriesContextandhook_executorfor before/after evaluation and after track.ClientImplvariation/track paths with method names; execute hooks synchronously.Config/ConfigBuilderto acceptstd::shared_ptr<hooks::Hook>list.Trackand all*Variation*overloads acceptinghooks::HookContext.hook.h,hook_context.h,evaluation_series_context.h,evaluation_series_data.h,track_series_context.h.LDServerConfigBuilder_Hooks; bridge viaCHookWrapper.*_WithHookContextfunctions for track and all variation variants.Contextis invalid; log warning.CMakeLists.txt.redis-plus-plusFetchContent tag and disable shallow clone.Written by Cursor Bugbot for commit 4773e9e. This will update automatically on new commits. Configure here.