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: add alerts to explorer link in notification #4446

Merged
merged 10 commits into from
Feb 2, 2024

Conversation

srikanthccv
Copy link
Member

@srikanthccv srikanthccv commented Jan 28, 2024

Summary

Part of #2765

Related Issues / PR's

Screenshots

NA

Affected Areas and Manually Tested Areas

Summary by CodeRabbit

  • New Features
    • Enhanced the default selection of columns in the Traces List View.
    • Introduced new query parameter types for improved query management.
    • Added new functionalities in the threshold rules to support dynamic linking to logs and traces based on specific conditions.
  • Tests
    • Implemented new tests for verifying the correct preparation of links to logs and traces.

Copy link

coderabbitai bot commented Jan 28, 2024

Walkthrough

The recent updates to the query service involve enhancing the handling of query parameters and options, refining the functionality for threshold rules, and improving the default selection of columns for trace list views. These changes collectively aim to improve the user experience by providing more tailored and efficient query capabilities, alongside better visualization and management of trace data.

Changes

Files Summary
.../constants/constants.go Updated default selected columns for traces list view.
.../rules/apiParams.go Introduced new types for managing query parameters and options.
.../rules/thresholdRule.go Enhanced threshold rule handling with new fields and methods for link preparation and filters.
.../rules/thresholdRule_test.go Added tests for new methods related to link preparation to logs and traces.

"In the world of code, where logic is king,
A rabbit hopped in, to change a few things.
🐾 With a tweak and a twist, and a hop so bold,
It left the query service, improved and gold." 🌟

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

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>.
    • Generate unit-tests for this file.
  • 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 tests 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 generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@github-actions github-actions bot added the enhancement New feature or request label Jan 28, 2024
@srikanthccv srikanthccv marked this pull request as ready for review January 30, 2024 07:48
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 6

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e977963 and 4836cfc.
Files selected for processing (4)
  • pkg/query-service/constants/constants.go (1 hunks)
  • pkg/query-service/rules/apiParams.go (1 hunks)
  • pkg/query-service/rules/thresholdRule.go (6 hunks)
  • pkg/query-service/rules/thresholdRule_test.go (2 hunks)
Additional comments: 11
pkg/query-service/rules/thresholdRule_test.go (1)
  • 12-12: The import of go.signoz.io/signoz/pkg/query-service/utils/labels is correctly added to support the new test functions that utilize labels. This change is appropriate and requires no further action.
pkg/query-service/constants/constants.go (1)
  • 356-387: The update to TracesListViewDefaultSelectedColumns adds a predefined set of columns for the Traces ListView. This change enhances the default data presentation and is a positive improvement. Ensure that the selected columns are relevant and useful for the majority of use cases. Additionally, consider documenting the rationale behind the selection of these specific columns for future reference.
pkg/query-service/rules/thresholdRule.go (9)
  • 6-6: The import of "encoding/json" is added.
  • 9-9: The import of "net/url" is added.
  • 65-65: A new field typ of type string is added to the ThresholdRule struct.
  • 104-104: The typ field is initialized in the NewThresholdRule function.
  • 632-696: The fetchFilters method has been modified. Ensure the logic correctly handles both cases where a label is present in the where clause and when it's not, adding missing labels as key-value pairs.
Verification successful

The search results indicate that the fetchFilters method is indeed used within the thresholdRule.go file, specifically in scenarios where filter items are being prepared for further processing. The method's integration points show its application in constructing URL data for shareable composite queries, which aligns with the method's purpose of preparing filter items based on provided labels and existing filter conditions.

Given this context, it appears that the fetchFilters method is correctly integrated and applied within the codebase, handling both cases where a label is present in the where clause and when it's not, by adding missing labels as key-value pairs. This confirms the method's logic as described in the review comment is being utilized as intended in the codebase.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify the logic of fetchFilters method by checking its usage in other parts of the codebase.
# This script is a placeholder for the actual verification process.
echo "Check fetchFilters method usage and ensure it's correctly applied."

Length of output: 145



Script:

#!/bin/bash
# Search for usages of the fetchFilters method within the codebase to verify its integration and correctness.
rg "fetchFilters" --context 5

Length of output: 2528

* 698-759: The `prepareLinksToLogs` method is introduced. Verify the correctness of URL construction and ensure that the method correctly handles the selected query and label filters. * 761-822: The `prepareLinksToTraces` method is introduced. Similar to `prepareLinksToLogs`, verify the correctness of URL construction and ensure that the method correctly handles the selected query and label filters. * 826-831: The `hostFromSource` method is introduced. Ensure that it correctly parses the hostname from the `source` URL. * 1054-1064: The logic to append links to related traces or logs based on the `typ` field in the `Eval` method. Ensure that the links are correctly formatted and appended to the labels.

pkg/query-service/rules/apiParams.go Show resolved Hide resolved
pkg/query-service/rules/apiParams.go Show resolved Hide resolved
pkg/query-service/rules/apiParams.go Show resolved Hide resolved
pkg/query-service/rules/apiParams.go Show resolved Hide resolved
pkg/query-service/rules/thresholdRule_test.go Show resolved Hide resolved
pkg/query-service/rules/thresholdRule_test.go Show resolved Hide resolved
Copy link
Member

@nityanandagohain nityanandagohain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! on the frontend we can add a popup or something saying that when formula queries are not supported.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 4836cfc and 9ba46c2.
Files selected for processing (1)
  • pkg/query-service/rules/thresholdRule.go (6 hunks)
Files skipped from review as they are similar to previous changes (1)
  • pkg/query-service/rules/thresholdRule.go

@ankitnayan ankitnayan self-requested a review February 2, 2024 15:06
@srikanthccv srikanthccv merged commit 00b111f into develop Feb 2, 2024
11 checks passed
@srikanthccv srikanthccv deleted the alert-to-explorer branch February 2, 2024 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants