Add FileSystemMessagingIntegration and related tests#1904
Merged
MikaKerman merged 3 commits intomasterfrom May 5, 2025
Merged
Conversation
- Implemented FileSystemMessagingIntegration for sending messages to files. - Added unit tests for message sending, file creation, and handling of the create_if_missing flag. - Updated messaging integrations __init__.py to include the new integration.
Contributor
|
👋 @MikaKerman |
ofek1weiss
reviewed
May 5, 2025
| try: | ||
| logger.info("Writing alert message to file %s", file_path) | ||
| with open(file_path, "a", encoding="utf-8") as fp: | ||
| fp.write(body.json()) |
Contributor
There was a problem hiding this comment.
add indent to the json, will make it much easier to debug
| if not os.path.exists(self.directory): | ||
| if self._create_if_missing: | ||
| logger.info( | ||
| "Creating directory for FileSystemMessagingIntegration: %s", |
Contributor
There was a problem hiding this comment.
why not direct formating? f"Creating directory for FileSystemMessagingIntegration: {self.directory}"
(relevant to all of the logs)
| BaseMessagingIntegration[str, EmptyMessageContext] | ||
| ): | ||
| def __init__(self, directory: str, create_if_missing: bool = True) -> None: | ||
| self.directory = os.path.abspath(directory) |
Contributor
There was a problem hiding this comment.
I'd much prefer usage pathlib.Path instead of os.path, much cleaner and more modern
…ngs and update tests to match new channel-directory JSON file behavior
ofek1weiss
approved these changes
May 5, 2025
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
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.
Uh oh!
There was an error while loading. Please reload this page.