Skip to content

bugfixes for target separation #1365

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

Merged
merged 2 commits into from
Jul 4, 2025
Merged

Conversation

parmesant
Copy link
Contributor

@parmesant parmesant commented Jul 3, 2025

Fixes include-

  • Removal of duplication check
  • Proper loading of targets on server init
  • Masking of sensitive information (slack URL, alert manager auth credentials)
  • Error on modifying name
  • Renaming repeat to notificationConfig and setting least count of interval to 1 minute

Description


This PR has:

  • been tested to ensure log ingestion and log query works.
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added documentation for new or modified features or behaviors.

Summary by CodeRabbit

  • New Features

    • Sensitive information in target data is now masked in all relevant API responses.
    • Added a new resource that is loaded during application initialization.
  • Bug Fixes

    • Improved error handling for invalid modifications to target configurations, including clearer error messages when attempting to change a target's name.
  • Refactor

    • Unified and simplified notification configuration fields and interval handling for targets.
    • Updated naming conventions for notification settings to improve clarity.

Copy link
Contributor

coderabbitai bot commented Jul 3, 2025

Walkthrough

This update refactors alert target notification configuration, renaming and simplifying fields, switching interval units to integer minutes, and adding masking for sensitive target data in HTTP responses. It removes duplicate target validation, updates error handling, and introduces a new resource load step for targets during initialization.

Changes

File(s) Change Summary
src/alerts/mod.rs Refactored validation to use new notification config fields and interval logic; replaced DuplicateTargetConfig error with InvalidTargetModification(String); updated error handling accordingly.
src/alerts/target.rs Renamed and retyped notification config fields; replaced duration types with integer minutes; added mask() for sensitive data; removed duplicate target check; updated related structs and verifiers.
src/handlers/http/modal/mod.rs Added loading of TARGETS resource during initialization, updating async logic to handle five concurrent loads.
src/handlers/http/targets.rs Applied .mask() to all Target responses to hide sensitive fields; added name immutability check in update handler.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant HTTP_Handler
    participant TargetStore

    Client->>HTTP_Handler: POST/GET/UPDATE/DELETE /targets
    HTTP_Handler->>TargetStore: Fetch/Update Target(s)
    TargetStore-->>HTTP_Handler: Target object(s)
    HTTP_Handler->>HTTP_Handler: Mask sensitive fields via .mask()
    HTTP_Handler-->>Client: Return masked Target(s)
Loading
sequenceDiagram
    participant App
    participant Alerts
    participant Targets

    App->>Alerts: load_on_init()
    Alerts->>Alerts: Load ALERTS, ALERT_HISTORY, ALERT_RULES, ALERT_GROUPS
    Alerts->>Targets: Load TARGETS
    Targets-->>Alerts: TARGETS loaded or error
    Alerts-->>App: Initialization complete (logs errors if any)
Loading

Suggested reviewers

  • nikhilsinhaparseable

Poem

In fields of code where targets dwell,
A rabbit hops, with secrets to quell.
Now masked and safe, the data flows,
With minutes clear, and error shows.
Five loads at dawn, a gentle start—
Refactored well, with rabbit heart! 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Clippy (1.86.0)
Updating crates.io index
Updating git repository `https://github.com/parseablehq/opentelemetry-rust`

error: failed to get opentelemetry-proto as a dependency of package parseable v2.3.5 ()

Caused by:
failed to load source for dependency opentelemetry-proto

Caused by:
Unable to update https://github.com/parseablehq/opentelemetry-rust?branch=fix-metrics-u64-serialization#7e84c98d

Caused by:
failed to create directory /usr/local/git/db/opentelemetry-rust-e71049053dacb49f

Caused by:
Permission denied (os error 13)


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f7b4afd and 7d0d519.

📒 Files selected for processing (1)
  • src/alerts/target.rs (8 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/alerts/target.rs
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: coverage
  • GitHub Check: Quest Smoke and Load Tests for Distributed deployments
  • GitHub Check: Quest Smoke and Load Tests for Standalone deployments
  • GitHub Check: Build Default x86_64-pc-windows-msvc
  • GitHub Check: Build Default aarch64-apple-darwin
  • GitHub Check: Build Default x86_64-apple-darwin
  • GitHub Check: Build Default x86_64-unknown-linux-gnu
  • GitHub Check: Build Default aarch64-unknown-linux-gnu
  • GitHub Check: Build Kafka aarch64-apple-darwin
  • GitHub Check: Build Kafka x86_64-unknown-linux-gnu
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 3, 2025
@nitisht nitisht merged commit 33ed89c into parseablehq:main Jul 4, 2025
14 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Aug 4, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants