-
Notifications
You must be signed in to change notification settings - Fork 5
Feature/extensible event sources #16
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
Open
antweiss
wants to merge
11
commits into
main
Choose a base branch
from
feature/extensible-event-sources
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+5,227
−199
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bafdeb2 to
59e560c
Compare
Signed-off-by: Ant Weiss <anton@otomato.io>
- Fixed signature calculation to include source.events prompts - Added retry mechanism for hook status updates to handle resource version conflicts - Added comprehensive tests for signature calculation - Added debug logging for signature comparison Signed-off-by: Ant Weiss <anton@otomato.io>
- Changed Event.Metadata from map[string]string to map[string]interface{} for flexibility
- All Kubernetes-specific fields (ResourceName, Namespace, Reason) are now optional
- Smart deduplication: prefers UID, falls back to resource/namespace keys
- Enhanced template system: full access to metadata via {{.Metadata.fieldName}}
- Flexible logging: only logs fields that are present
- Added comprehensive documentation and examples
- All tests passing, fully backward compatible
Signed-off-by: Ant Weiss <anton@otomato.io>
- Changed 'context canceled' error log to info log - This is expected behavior when hooks are updated and workflows restart - Reduces log noise and confusion Signed-off-by: Ant Weiss <anton@otomato.io>
…n logging - Redis event source now automatically moves unknown fields to metadata - Added debug logging to show original and expanded prompts - Fixed syntax error in Redis event source Signed-off-by: Ant Weiss <anton@otomato.io>
- Removed logic that was skipping text/template expansion for metadata fields
- Now {{.Metadata.fieldName}} will be properly expanded
- Added tests for metadata and nested metadata access
- Unknown fields now render as '<no value>' instead of being preserved
Signed-off-by: Ant Weiss <anton@otomato.io>
- Reject events with empty type to prevent invalid processing - Validate agent reference is not empty before calling - Validate prompt is not empty before template expansion - Prevents attempting to call non-existent agents with invalid configurations Signed-off-by: Ant Weiss <anton@otomato.io>
- Events now deduplicated by content hash instead of ResourceName - Hash includes: Type, ResourceName, Namespace, Reason, Message, and Metadata - Metadata keys sorted for deterministic hashing - Works for any event source (Kubernetes, Redis, IoT, financial, etc.) - Events with UID still use UID for perfect identification - Added comprehensive tests for hash stability and collision avoidance Signed-off-by: Ant Weiss <anton@otomato.io>
Signed-off-by: Ant Weiss <anton@otomato.io>
Signed-off-by: Ant Weiss <anton@otomato.io>
Apply formatting fixes from go fmt: - Fix indentation in test cases and error handling - Remove trailing whitespace - Standardize code formatting across files Signed-off-by: Ant Weiss <anton@otomato.io>
59e560c to
3ee8954
Compare
Collaborator
Author
|
@EItanya please take a look |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This finally brings the ability to support multiple event sources.
the implementation is described here: https://github.com/kagent-dev/khook/blob/feature/extensible-event-sources/docs/flexible-event-sources.md
This is a big change, so let's take it slowly.
An example event source for redis pub/sub is implemented here: https://github.com/kagent-dev/khook/tree/feature/extensible-event-sources/examples/redis-event-source and is demoed here: https://www.youtube.com/watch?v=qdRUvlAs5CI