Skip to content
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

feat: kafka message dispatcher #1641

Draft
wants to merge 106 commits into
base: main
Choose a base branch
from
Draft

Conversation

nas-tabchiche
Copy link
Contributor

@nas-tabchiche nas-tabchiche commented Mar 7, 2025

  • Draft kafka consumer specs
  • Consumer initial commit

Summary by CodeRabbit

  • New Features

    • Enhanced filtering options for querying controls and assessments.
    • Introduced a CLI tool for secure authentication and real-time message consumption.
    • Added a configuration command for easy setup and credentials management.
    • Rolled out a message handling system that supports object updates and attachment uploads.
    • Provided a containerized deployment option with a scalable Kafka-based environment and management console.
  • Documentation

    • Released an updated guide outlining event streaming architecture, consumer workflows, and error handling strategies.

Copy link
Contributor

coderabbitai bot commented Mar 7, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes enhance filtering in backend views, introduce a new CLI tool with authentication and Kafka consumption, and add functions for API pagination and message handling. New configuration files, Avro schemas, and Docker Compose files support deployment and dependency management. Additionally, a configuration management module and comprehensive documentation for event streaming have been included.

Changes

File(s) Change Summary
backend/core/views.py Added new filter field ref_id in AppliedControlFilterSet and additional filter fields (folder__name, requirement__ref_id, compliance_assessment__ref_id, compliance_assessment__assets__ref_id) in RequirementAssessmentViewSet.
dispatcher/.gitignore Introduced a new .gitignore with patterns for temporary, configuration, compiled files, logs, IDE files, and dependency management directories.
dispatcher/dispatcher.py Added a new CLI tool (CLICA) with auth and consume commands using Click for authentication and Kafka message consumption.
dispatcher/filtering.py Added the process_selector function to handle API requests with pagination and filtering logic.
dispatcher/messages.py Implemented a message handling system with MessageRegistry and functions for object updates, applied control updates, requirement assessments, and attachment uploads.
dispatcher/pyproject.toml Created a new project configuration file with metadata and dependency definitions for the CISO Assistant Dispatcher.
dispatcher/redpanda/docker-compose.yaml Added Docker Compose configuration for deploying Redpanda services and a console, configuring custom networks, volumes, and service dependencies.
dispatcher/redpanda/schemas/commands/.../*.avsc Added Avro schemas for update_applied_control_command and update_requirement_assessment_command to serialize command messages.
dispatcher/settings.py Introduced configuration management via Click and YAML with commands to initialize and check configuration and authentication status.
documentation/architecture/event-streaming.md Added documentation detailing the Kafka consumer architecture, message flow, Avro serialization, error handling, and deployment configurations.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant CLI as CLI Tool (auth)
    participant API as Authentication API
    participant File as Token YAML File
    U->>CLI: Provide email & password
    CLI->>API: Send authentication request
    API-->>CLI: Return token / error
    CLI->>File: Save token
    CLI-->>U: Display authentication result
Loading
sequenceDiagram
    participant CLI as CLI Tool (consume)
    participant Kafka as Kafka Broker
    participant Registry as Message Registry
    participant API as Backend API
    CLI->>Kafka: Subscribe to "observation" topic
    Kafka-->>CLI: Deliver message
    CLI->>CLI: Decode and validate message
    CLI->>Registry: Dispatch message to handler
    Registry->>API: Execute update/attachment upload
    API-->>Registry: Return update result
    Registry-->>CLI: Return processing status
Loading

Poem

Oh, what a hop in the codeland today,
Filters and CLI commands lead the way,
Kafka messages and schemas take flight,
Docker and settings shine so bright,
I, the rabbit, dance with each new byte –
In code and configuration, our path is light!
🐇✨


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ab-smith ab-smith changed the title feat: event streaming feat: kafka events consumer Mar 16, 2025
@nas-tabchiche nas-tabchiche force-pushed the experiment/kafka-consumer branch from 89c1801 to 65e706f Compare March 28, 2025 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants