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: update query builder to support spatial aggregations and functions #4569

Merged
merged 30 commits into from
Mar 1, 2024

Conversation

YounixM
Copy link
Collaborator

@YounixM YounixM commented Feb 18, 2024

UI Changes related to - #4016

Screenshot 2024-02-19 005732
image

Impacted Areas:

Dashboard
Alerts

Summary by CodeRabbit

  • New Features

    • Introduced support for multiple API versions, enabling queries with API v4.
    • Added new metrics operators for advanced data aggregation and analysis.
    • Implemented keyboard shortcuts for dashboard and query builder functionalities, enhancing user interaction efficiency.
    • Expanded query builder capabilities with new functions for complex data manipulation and analysis.
    • Enhanced dashboard components with new styling options and improved user interface elements.
  • Enhancements

    • Updated aggregation methods in metrics queries to use average instead of sum for more accurate data representation.
    • Improved tooltip functionality in graphs for better data visualization.
  • Bug Fixes

    • Addressed an issue with duplicate legend labels in tooltips, ensuring accurate data representation.
    • Fixed a bug in query parameter handling to correctly apply versioning in dashboard and metrics queries.
  • Refactor

    • Optimized query range parameter parsing for improved performance and accuracy in time-shifting functionalities.
    • Refactored the handling of metric limits to ensure consistent application across queries.

Copy link

coderabbitai bot commented Feb 18, 2024

Walkthrough

The updates across the frontend and backend systems introduce a new API version (v4) and enrich the query builder with additional metrics operators, functions, and keyboard shortcuts. These changes aim to provide more flexibility in querying metrics, improve user interaction with the platform, and enhance data aggregation capabilities.

Changes

File(s) Change Summary
frontend/src/api/apiV1.ts
frontend/src/api/index.ts
frontend/src/api/metrics/getQueryRange.ts
frontend/src/container/ListOfDashboard/DashboardsList.tsx
frontend/src/hooks/queryBuilder/useGetQueryRange.ts
Added support for a new API version (v4) and its configuration.
frontend/src/constants/... (multiple files)
frontend/src/container/QueryBuilder/components/... (multiple files)
Introduced new constants for query functions and metrics operators, integrated them into query builder components.
frontend/src/container/... (multiple files in GridCardLayout, NewDashboard, FormAlertRules, NewWidget) Implemented UI/UX enhancements such as tooltip additions, style adjustments, and keyboard shortcut integrations.
frontend/src/types/... (multiple files) Updated type definitions to include new fields for versioning, aggregations, and functions.
frontend/src/lib/... (multiple files)
pkg/query-service/app/... (multiple files)
Backend and library modifications to support new query functionalities and handle API versioning effectively.

Related issues

  • Metrics query builder improvements #4016: The changes align with the objectives outlined in this issue by enhancing the query builder, introducing new metrics operators, and expanding the functionality to support various aggregations and functions.

Poem

In the realm of code and logic, a rabbit did roam,
Through metrics and functions, it made its home.
New API paths and query delights,
A dance of progress in digital heights.
🐇 With keystrokes light and changes profound,
A tale of innovation, in code unbound.
🌌 "To the future," it whispered, "we forge ahead,
With each line crafted, a new path we tread."

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 Feb 18, 2024
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: 8

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c4bbbf3 and e8b3ced.
Files selected for processing (25)
  • frontend/src/api/apiV1.ts (1 hunks)
  • frontend/src/api/index.ts (2 hunks)
  • frontend/src/api/metrics/getQueryRange.ts (2 hunks)
  • frontend/src/constants/queryBuilder.ts (4 hunks)
  • frontend/src/constants/queryBuilderOperators.ts (1 hunks)
  • frontend/src/constants/queryFunctionOptions.ts (1 hunks)
  • frontend/src/container/ListOfDashboard/DashboardsList.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/components/Query/Query.tsx (7 hunks)
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.styles.scss (1 hunks)
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/components/SpaceAggregationOptions/SpaceAggregationOptions.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/OptionRenderer.tsx (3 hunks)
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/QueryBuilderSearch.styles.scss (1 hunks)
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/style.ts (1 hunks)
  • frontend/src/container/TraceDetail/SelectedSpanDetails/config.ts (1 hunks)
  • frontend/src/hooks/queryBuilder/useGetQueryRange.ts (3 hunks)
  • frontend/src/hooks/queryBuilder/useQueryBuilderOperations.ts (7 hunks)
  • frontend/src/lib/dashboard/getQueryResults.ts (2 hunks)
  • frontend/src/lib/newQueryBuilder/getMetricsOperatorsByAttributeType.ts (1 hunks)
  • frontend/src/types/api/dashboard/create.ts (1 hunks)
  • frontend/src/types/api/dashboard/getAll.ts (1 hunks)
  • frontend/src/types/api/queryBuilder/queryBuilderData.ts (1 hunks)
  • frontend/src/types/common/operations.types.ts (2 hunks)
  • frontend/src/types/common/queryBuilder.ts (2 hunks)
  • frontend/tests/dashboards/utils.ts (3 hunks)
Files skipped from review due to trivial changes (2)
  • frontend/src/api/apiV1.ts
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/style.ts
Additional comments: 23
frontend/src/types/api/dashboard/create.ts (1)
  • 7-7: The addition of an optional version field to the Props type is a good approach to support API versioning. This change allows for flexibility in specifying the version of the dashboard being created, which aligns with the PR's objective to introduce enhanced query capabilities through versioning. Ensure that the consuming functions and components that utilize Props are updated accordingly to handle this new field.
frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/QueryBuilderSearch.styles.scss (1)
  • 1-11: The added styling for .selectOptionContainer in QueryBuilderSearch.styles.scss enhances the visual presentation of the select options within the QueryBuilderSearch component. The use of flex display, gap, and alignment properties improves the layout, while the scrollbar customization ensures a better user experience in cases of overflow. Ensure these styles are scoped appropriately to avoid unintended effects on other components and that they adhere to the application's design guidelines.
frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.styles.scss (1)
  • 1-34: The styling added for .add-function-btn and .query-functions-list in QueryFunctions.styles.scss is well-structured, enhancing the UI for managing query functions. The use of flex display, gap, and custom margins improves the layout and usability. Additionally, the styling for inputs and the visual connection between query function elements is thoughtfully designed. As with other style changes, ensure these styles are scoped correctly to prevent any unintended effects on other parts of the application.
frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/OptionRenderer.tsx (2)
  • 1-2: The refactoring to import QueryBuilderSearch.styles.scss in OptionRenderer.tsx is appropriate for applying the new styles to the SelectOptionContainer component. This change ensures that the component benefits from the styling enhancements made for select options within the QueryBuilderSearch context.
  • 13-19: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [16-28]

The structural adjustments made to the SelectOptionContainer component, including the addition of option-value and option-meta-data-container divs, enhance the presentation of option labels and metadata. This change improves the readability and user experience by clearly distinguishing between the value and additional information such as type and data type. Ensure that these changes are tested across different browsers to maintain consistency in appearance and functionality.

frontend/src/hooks/queryBuilder/useGetQueryRange.ts (1)
  • 15-24: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [18-36]

The integration of useDashboard to fetch selectedDashboard data and determine the version for the query in the useGetQueryRange hook is a smart approach to dynamically select the API version based on the dashboard context. This ensures that queries are executed against the correct API version, aligning with the dashboard's configuration. However, ensure that there's a fallback mechanism or default version defined (as done here with 'v4') to handle cases where the dashboard data might not specify a version. This approach enhances the flexibility and robustness of the query execution process.

frontend/src/api/index.ts (1)
  • 126-134: The addition of a new API instance ApiV4Instance with axios V4 configuration is a crucial step in supporting the new version of the API. This change allows for the separation of concerns between different API versions, enabling more granular control over API requests and responses. Ensure that the base URL and any necessary configurations specific to the V4 API are correctly set up to avoid any issues with API communication.
frontend/tests/dashboards/utils.ts (1)
  • 173-174: The addition of the comment // eslint-disable-next-line sonarjs/no-identical-functions in the getTimeSeriesQueryData function is a minor change aimed at addressing a specific linting rule. While addressing linting issues is important, ensure that this comment is necessary and that there isn't a more appropriate way to address the underlying issue (e.g., refactoring to remove duplicate code if applicable).

The addition of the linting comment is acceptable given the context. However, consider reviewing the necessity of duplicate code that triggered this linting rule.

frontend/src/types/common/queryBuilder.ts (1)
  • 147-163: The addition of the QueryFunctionsTypes enum introduces various query function types such as CUTOFF_MIN, CUTOFF_MAX, etc. This is a positive enhancement for type safety and code readability. Consider the following points:
  • Correctness and Logic: The enum correctly defines various query function types, which will likely be used throughout the application to ensure consistency in function naming and usage.
  • Best Practices: The enum is well-defined and follows naming conventions. Ensure that all uses of these function types in the application are updated to leverage this enum for improved type safety and maintainability.

The addition of the QueryFunctionsTypes enum is a good practice for maintaining consistency and type safety in the application. Ensure its usage is consistently applied across the application.

frontend/src/constants/queryBuilderOperators.ts (1)
  • 306-422: The addition of various sets of options for different metric aggregate operators (e.g., metricsSumAggregateOperatorOptions, metricsGuageAggregateOperatorOptions, etc.) enhances the application's flexibility in handling different types of aggregations. Consider the following points:
  • Correctness and Logic: The options are correctly defined and categorized by different types such as Space, Gauge, and Histogram. This categorization aligns with the application's requirements for handling different aggregation scenarios.
  • Consistency: Ensure that these new sets of options are consistently used throughout the application wherever metric aggregate operators are needed. This includes updating any existing code that manually defines these options to use the new constants instead.
  • Best Practices: The structure and naming conventions of the options follow best practices. Consider adding documentation/comments to describe each category's use case and applicability to aid in maintainability and understanding for future developers.

The addition of categorized sets of options for metric aggregate operators is a valuable enhancement. Ensure consistent usage throughout the application and consider adding documentation for clarity.

frontend/src/constants/queryBuilder.ts (2)
  • 168-170: The addition of timeAggregation, spaceAggregation, and functions fields to the initialQueryBuilderFormValues object is a significant enhancement. It aligns with the PR's objective to support spatial aggregations and functions. However, ensure that the rest of the application correctly handles these new fields, especially in areas where IBuilderQuery objects are consumed.

Ensure that the application logic that consumes IBuilderQuery objects has been updated to handle the new timeAggregation, spaceAggregation, and functions fields appropriately.

  • 291-296: The introduction of ATTRIBUTE_TYPES enum is a good practice for maintaining a clear and manageable set of attribute types. This approach enhances code readability and maintainability by providing a centralized definition of attribute types used throughout the application.
frontend/src/hooks/queryBuilder/useQueryBuilderOperations.ts (3)
  • 10-14: The import of new constants for metrics space aggregate operator options is correctly done. This ensures that the hook can utilize these options for space aggregations, aligning with the PR's objectives to enhance spatial data processing capabilities.
  • 125-135: The addition of handleSpaceAggregationChange function is a good practice. It encapsulates the logic for handling changes to space aggregation in a dedicated function, improving code readability and maintainability. Ensure that this function is properly integrated and called in the relevant UI components where space aggregation options are presented to the user.

Verify that the UI components which allow users to select space aggregation options correctly call handleSpaceAggregationChange upon changes.

  • 263-276: The handleQueryFunctionsUpdates function is a valuable addition for handling updates to query functions. This aligns with the PR's objective to support advanced query functions. Ensure that this function is properly integrated and called in the relevant UI components where users can define or modify query functions.

Verify that the UI components which allow users to define or modify query functions correctly call handleQueryFunctionsUpdates upon changes.

frontend/src/container/ListOfDashboard/DashboardsList.tsx (1)
  • 214-214: Adding the version: 'v4' property to the dashboard creation request aligns with the PR's objective to introduce versioning in API endpoints. This change ensures that the newly created dashboards are compatible with the enhanced query capabilities introduced in this PR. Ensure that the backend API correctly handles this version parameter.

Verify that the backend API has been updated to handle the version parameter correctly and that it supports the functionalities introduced in version 4.

frontend/src/container/QueryBuilder/components/Query/Query.tsx (7)
  • 5-5: The import of ATTRIBUTE_TYPES from constants/queryBuilder is correctly added to support the new spatial aggregation features. This aligns with the PR's objective to enhance query capabilities.
  • 40-41: The addition of QueryFunctions and SpaceAggregationOptions components is a significant enhancement, enabling users to leverage advanced query functions and spatial aggregation options. This change directly supports the PR's goal of improving data analysis and visualization capabilities.
  • 68-70: The introduction of handleSpaceAggregationChange and handleQueryFunctionsUpdates functions is crucial for managing the state and behavior of the new spatial aggregation and query functions features. It's important to ensure these handlers are thoroughly tested, especially for edge cases and error handling.
  • 288-290: The logic to disable the operator selector based on the presence of an aggregateAttribute.key is a thoughtful addition. It ensures that operators are only selectable when relevant, improving the user experience by preventing invalid configurations.
  • 331-340: The conditional rendering of the OperatorsSelect component based on the availability of operators and the new disableOperatorSelector logic is well-implemented. This change enhances the UI's responsiveness to the query's context, aligning with the PR's objectives to improve the query builder's flexibility and user experience.
  • 388-401: The conditional rendering between FilterLabel and SpaceAggregationOptions based on isMetricsDataSource is a key update. It dynamically adjusts the UI to accommodate different data sources and aggregation types. However, ensure that the aggregatorAttributeType prop correctly handles all possible ATTRIBUTE_TYPES values, especially in edge cases where the type might not be directly mapped or is undefined.
Verification successful

The SpaceAggregationOptions component is designed to handle specific ATTRIBUTE_TYPES values (HISTOGRAM, SUM, and GAUGE) with explicit logic for each. For any other types or if aggregatorAttributeType is null, it defaults to handling for GAUGE types. This implementation suggests that the component has considered the handling of all expected ATTRIBUTE_TYPES values, with a default behavior for any unspecified types. The concern in the original review comment about ensuring correct handling of all possible ATTRIBUTE_TYPES values, especially in edge cases, appears to be addressed by the component's design and implementation.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Suggest verifying the handling of all ATTRIBUTE_TYPES values in SpaceAggregationOptions component.
echo "Please verify that the SpaceAggregationOptions component correctly handles all possible ATTRIBUTE_TYPES values, especially for edge cases."

Length of output: 286



Script:

#!/bin/bash
# Search for the SpaceAggregationOptions component definition in the codebase
rg "SpaceAggregationOptions" --files-with-matches

Length of output: 272



Script:

#!/bin/bash
# Display the contents of SpaceAggregationOptions.tsx for review
cat "frontend/src/container/QueryBuilder/components/SpaceAggregationOptions/SpaceAggregationOptions.tsx"

Length of output: 1354

* 418-424: The integration of the `QueryFunctions` component for metrics data sources is a significant enhancement, allowing users to apply various functions to their queries. This addition is crucial for supporting advanced data analysis scenarios. Ensure that the component's `onChange` handler properly updates the query state and that the UI reflects these changes accurately.

frontend/src/constants/queryBuilder.ts Outdated Show resolved Hide resolved
frontend/src/constants/queryBuilder.ts Outdated Show resolved Hide resolved
frontend/src/constants/queryBuilder.ts Outdated Show resolved Hide resolved
frontend/src/api/metrics/getQueryRange.ts Outdated Show resolved Hide resolved
frontend/tests/dashboards/utils.ts Outdated Show resolved Hide resolved
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 e8b3ced and 1dad966.
Files selected for processing (1)
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.tsx

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: 3

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 1dad966 and ec405fa.
Files ignored due to path filters (2)
  • frontend/public/locales/en-GB/dashboard.json is excluded by: !**/*.json
  • frontend/public/locales/en/dashboard.json is excluded by: !**/*.json
Files selected for processing (31)
  • frontend/src/constants/queryBuilder.ts (4 hunks)
  • frontend/src/constants/queryBuilderOperators.ts (1 hunks)
  • frontend/src/constants/queryFunctionOptions.ts (1 hunks)
  • frontend/src/constants/shortcuts/DashboardShortcuts.ts (1 hunks)
  • frontend/src/constants/shortcuts/QBShortcuts.ts (1 hunks)
  • frontend/src/container/FormAlertRules/QuerySection.tsx (2 hunks)
  • frontend/src/container/GridCardLayout/GridCardLayout.styles.scss (1 hunks)
  • frontend/src/container/GridCardLayout/GridCardLayout.tsx (2 hunks)
  • frontend/src/container/GridCardLayout/styles.ts (1 hunks)
  • frontend/src/container/ListOfDashboard/DashboardsList.tsx (2 hunks)
  • frontend/src/container/NewDashboard/ComponentsSlider/index.tsx (2 hunks)
  • frontend/src/container/NewDashboard/ComponentsSlider/menuItems.tsx (1 hunks)
  • frontend/src/container/NewDashboard/ComponentsSlider/styles.ts (1 hunks)
  • frontend/src/container/NewDashboard/DashboardDescription/Description.styles.scss (1 hunks)
  • frontend/src/container/NewDashboard/DashboardDescription/SettingsDrawer.tsx (2 hunks)
  • frontend/src/container/NewDashboard/DashboardDescription/index.tsx (5 hunks)
  • frontend/src/container/NewWidget/LeftContainer/QuerySection/index.tsx (4 hunks)
  • frontend/src/container/NewWidget/index.tsx (5 hunks)
  • frontend/src/container/QueryBuilder/components/QBEntityOptions/QBEntityOptions.styles.scss (3 hunks)
  • frontend/src/container/QueryBuilder/components/QBEntityOptions/QBEntityOptions.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/components/Query/Query.tsx (7 hunks)
  • frontend/src/container/QueryBuilder/components/QueryFunctions/Function.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.styles.scss (1 hunks)
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/OptionRenderer.tsx (2 hunks)
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/QueryBuilderSearch.styles.scss (1 hunks)
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/style.ts (1 hunks)
  • frontend/src/hooks/hotkeys/useKeyboardHotkeys.tsx (1 hunks)
  • frontend/src/hooks/queryBuilder/useQueryBuilderOperations.ts (7 hunks)
  • frontend/src/lib/newQueryBuilder/getMetricsOperatorsByAttributeType.ts (1 hunks)
  • frontend/src/types/api/queryBuilder/queryBuilderData.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • frontend/src/container/GridCardLayout/styles.ts
Files skipped from review as they are similar to previous changes (13)
  • frontend/src/constants/queryBuilder.ts
  • frontend/src/constants/queryBuilderOperators.ts
  • frontend/src/constants/queryFunctionOptions.ts
  • frontend/src/container/ListOfDashboard/DashboardsList.tsx
  • frontend/src/container/QueryBuilder/components/Query/Query.tsx
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.styles.scss
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.tsx
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/OptionRenderer.tsx
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/QueryBuilderSearch.styles.scss
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/style.ts
  • frontend/src/hooks/queryBuilder/useQueryBuilderOperations.ts
  • frontend/src/lib/newQueryBuilder/getMetricsOperatorsByAttributeType.ts
  • frontend/src/types/api/queryBuilder/queryBuilderData.ts
Additional comments: 13
frontend/src/container/GridCardLayout/GridCardLayout.styles.scss (1)
  • 3-3: The change from a specific margin-top to a shorthand margin property affects all four margins of the .fullscreen-grid-container. Ensure this adjustment aligns with the intended layout design, as it could impact the spacing and alignment within the UI.
frontend/src/constants/shortcuts/QBShortcuts.ts (1)
  • 5-17: The implementation of keyboard shortcuts for the query builder, with consideration for different operating systems, is a good enhancement. Ensure to verify that these shortcuts do not conflict with any browser or system-level shortcuts that could interfere with the intended functionality.
frontend/src/constants/shortcuts/DashboardShortcuts.ts (1)
  • 5-17: The addition of keyboard shortcuts for dashboard actions, with operating system consideration, enhances user experience. As with any keyboard shortcuts, verify that these do not conflict with browser or system-level shortcuts.
frontend/src/container/NewDashboard/ComponentsSlider/menuItems.tsx (1)
  • 5-29: The menu items for the components slider, including icons and display names, are well-defined. Verify the visual consistency and accessibility of the icons to ensure they are easily recognizable and align with the overall UI design.
frontend/src/container/NewDashboard/ComponentsSlider/styles.ts (1)
  • 12-34: The style enhancements to the Card component, including adjustments to min-height, the addition of a transition property, and modifications to hover states, aim to improve visual appeal and interactivity. Verify the smoothness of the animations and the responsiveness of the hover states to ensure a positive user experience.
frontend/src/container/FormAlertRules/QuerySection.tsx (2)
  • 6-6: The import of QBShortcuts from 'constants/shortcuts/QBShortcuts' is correctly added to support keyboard shortcuts functionality.
  • 8-8: The import of useKeyboardHotkeys from 'hooks/hotkeys/useKeyboardHotkeys' is correctly added to enable the use of keyboard shortcuts within this component.
frontend/src/container/GridCardLayout/GridCardLayout.tsx (1)
  • 148-156: The addition of the Tooltip component from 'antd' around the Button component with the title "Open in Full Screen" is a good UX improvement. It provides users with a clear indication of the button's functionality, enhancing the overall user experience.
frontend/src/container/NewWidget/LeftContainer/QuerySection/index.tsx (2)
  • 6-6: The import of QBShortcuts from 'constants/shortcuts/QBShortcuts' is correctly added to support keyboard shortcuts functionality within this component.
  • 10-10: The import of useKeyboardHotkeys from 'hooks/hotkeys/useKeyboardHotkeys' is correctly added to enable the use of keyboard shortcuts within this component.
frontend/src/container/NewWidget/index.tsx (3)
  • 8-8: The import of DashboardShortcuts from 'constants/shortcuts/DashboardShortcuts' is correctly added to support keyboard shortcuts functionality within this component.
  • 10-10: The import of useKeyboardHotkeys from 'hooks/hotkeys/useKeyboardHotkeys' is correctly added to enable the use of keyboard shortcuts within this component.
  • 413-413: The update of the text key for translation from 'dashboar_ok_confirm' to 'dashboard_ok_confirm' corrects a typo and ensures consistency in the translation keys used across the application.

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 ec405fa and d2b243b.
Files selected for processing (1)
  • frontend/src/hooks/queryBuilder/useGetQueryRange.ts (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • frontend/src/hooks/queryBuilder/useGetQueryRange.ts

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 d2b243b and c83a1b1.
Files selected for processing (1)
  • frontend/src/container/OnboardingContainer/Steps/LogsConnectionStatus/LogsConnectionStatus.tsx (1 hunks)
Additional comments: 1
frontend/src/container/OnboardingContainer/Steps/LogsConnectionStatus/LogsConnectionStatus.tsx (1)
  • 75-77: The addition of timeAggregation, spaceAggregation, and functions fields with default empty values ('' for strings and [] for arrays) in the requestData object is noted. However, it's important to ensure that these fields are appropriately handled downstream, especially since they are initialized with placeholder values. If these fields are expected to be populated or modified elsewhere in the code, consider adding validation or default handling logic to prevent potential issues with query execution or data fetching.
  • For timeAggregation and spaceAggregation, if there are specific default values that make sense for the application's logic or if these fields are mandatory for certain queries, it might be beneficial to set more meaningful defaults or add checks to ensure they are populated before executing a query.
  • For functions, since it's initialized as an empty array, ensure that the consuming logic is capable of handling an empty array without causing errors or unintended behavior, especially in the context of building or executing queries.

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: 8

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c83a1b1 and c67caf0.
Files ignored due to path filters (4)
  • frontend/tests/fixtures/api/dashboard/dashboardGetCallWithTimeSeriesWidget200.json is excluded by: !**/*.json
  • frontend/tests/fixtures/api/dashboard/putDashboardWithTimeSeries200.json is excluded by: !**/*.json
  • frontend/tests/fixtures/api/traces/traceExplorerViews200.json is excluded by: !**/*.json
  • go.sum is excluded by: !**/*.sum
Files selected for processing (10)
  • frontend/src/constants/queryBuilder.ts (5 hunks)
  • frontend/src/container/MetricsApplication/MetricsPageQueries/MetricsPageQueriesFactory.ts (2 hunks)
  • frontend/src/container/TraceDetail/SelectedSpanDetails/config.ts (1 hunks)
  • frontend/tests/dashboards/utils.ts (3 hunks)
  • pkg/query-service/app/clickhouseReader/reader.go (5 hunks)
  • pkg/query-service/app/limit.go (1 hunks)
  • pkg/query-service/app/metrics/v4/query_builder.go (2 hunks)
  • pkg/query-service/app/parser.go (2 hunks)
  • pkg/query-service/common/metrics.go (2 hunks)
  • pkg/query-service/model/v3/v3.go (5 hunks)
Files skipped from review as they are similar to previous changes (3)
  • frontend/src/constants/queryBuilder.ts
  • frontend/src/container/TraceDetail/SelectedSpanDetails/config.ts
  • frontend/tests/dashboards/utils.ts
Additional comments: 10
pkg/query-service/common/metrics.go (1)
  • 22-24: The implementation of PastDayRoundOff correctly calculates the start of the current day in UTC time. However, if your application operates in specific time zones or requires time zone awareness, consider adjusting this function to account for the desired time zone.
frontend/src/container/MetricsApplication/MetricsPageQueries/MetricsPageQueriesFactory.ts (2)
  • 51-51: The change to use average aggregation (reduceTo: 'avg') in getQueryBuilderQueries is noted. Ensure this change aligns with the intended data representation and verify its impact on the UI and the correctness of the displayed metrics.
  • 89-89: Similarly, the update to average aggregation (reduceTo: 'avg') in getQueryBuilderQuerieswithFormula should be verified for its impact on the UI and the correctness of the displayed metrics, ensuring it aligns with the intended data representation.
pkg/query-service/app/metrics/v4/query_builder.go (2)
  • 31-32: The exclusion of MetricTypeExponentialHistogram from certain quantile calculations appears to be a deliberate refinement. Ensure this aligns with the intended logic for handling different types of metric aggregations and does not inadvertently exclude necessary calculations for exponential histograms.
  • 86-86: The conditional logic for handling fixed-bucket histogram quantiles with UDF, excluding MetricTypeExponentialHistogram, should be verified to ensure it correctly implements the intended behavior for quantile calculations across different metric types.
pkg/query-service/model/v3/v3.go (2)
  • 512-516: Renaming the SpaceAggregation constants for percentiles to a more concise format (pXX) improves readability and consistency with common percentile notation. This change should be reflected in all parts of the codebase where these constants are used to ensure compatibility.
  • 695-695: The validation logic that requires a non-noop or non-rate AggregateOperator when GroupBy is used with DataSourceMetrics and SpaceAggregation is unspecified is a good practice. It ensures that meaningful aggregations are performed when grouping metrics data. This validation enhances the query's logical consistency and prevents potential user errors.
pkg/query-service/app/clickhouseReader/reader.go (3)
  • 4041-4045: In the method GetMetricAttributeValues, the use of sql.NullFloat64 and sql.NullInt64 for handling potential null values from the database is noted. This is a good practice for robustly handling nullable columns. However, ensure that the logic for checking .Valid before appending to the result list is consistently applied across all types and that there's proper error handling for any unexpected null values that might impact the application logic.
  • 4006-4010: The method GetMetricAutocompleteTagKey performs a query to fetch distinct tag keys matching a pattern. It's important to ensure that the pattern matching via ILIKE is efficient and does not lead to performance bottlenecks, especially with a potentially large number of tags. Consider verifying if the underlying database schema and indexes support efficient pattern matching queries. If performance issues are observed, consider alternative approaches such as caching common queries or adjusting the database schema to better support these operations.
  • 3970-3991: The handling of the temporality field in GetMetricAggregateAttributes to determine the type of a metric (e.g., converting non-monotonic cumulative sums to gauges) is a critical piece of logic that directly affects how metrics are categorized and interpreted. Ensure that this logic is thoroughly tested with various metric types and temporality values to prevent any misclassification. Additionally, consider adding more detailed comments explaining the reasoning behind these conversions for future maintainers.

pkg/query-service/app/parser.go Show resolved Hide resolved
pkg/query-service/model/v3/v3.go Show resolved Hide resolved
pkg/query-service/model/v3/v3.go Show resolved Hide resolved
pkg/query-service/app/limit.go Show resolved Hide resolved
pkg/query-service/model/v3/v3.go Show resolved Hide resolved
pkg/query-service/model/v3/v3.go Show resolved Hide resolved
@srikanthccv
Copy link
Member

  • If the version is not present default version to v3
  • With the above fallback in place, whenever the dashboard version is v3, let's continue to show the old UI for metrics builder.
  • With some recent commit, the endpoint logic is not working properly. All requests are going to /v3
  • For the table type, the column for aggregation should be <SpaceAggregator>(metric_name) for v4, instead of the count(metric_name)
  • Changing the metric name doesn't properly update the time and space aggregation operators
  • When there are two lines with the same labels, the legend has duplicate values.

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 c67caf0 and b6a5cea.
Files selected for processing (8)
  • frontend/src/api/metrics/getQueryRange.ts (2 hunks)
  • frontend/src/container/NewDashboard/ComponentsSlider/index.tsx (3 hunks)
  • frontend/src/container/QueryBuilder/components/Formula/Formula.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/components/QBEntityOptions/QBEntityOptions.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/components/Query/Query.tsx (8 hunks)
  • frontend/src/container/QueryBuilder/components/SpaceAggregationOptions/SpaceAggregationOptions.tsx (1 hunks)
  • frontend/src/hooks/queryBuilder/useQueryBuilderOperations.ts (7 hunks)
  • frontend/src/lib/dashboard/getQueryResults.ts (2 hunks)
Files skipped from review as they are similar to previous changes (7)
  • frontend/src/api/metrics/getQueryRange.ts
  • frontend/src/container/NewDashboard/ComponentsSlider/index.tsx
  • frontend/src/container/QueryBuilder/components/QBEntityOptions/QBEntityOptions.tsx
  • frontend/src/container/QueryBuilder/components/Query/Query.tsx
  • frontend/src/container/QueryBuilder/components/SpaceAggregationOptions/SpaceAggregationOptions.tsx
  • frontend/src/hooks/queryBuilder/useQueryBuilderOperations.ts
  • frontend/src/lib/dashboard/getQueryResults.ts
Additional comments: 1
frontend/src/container/QueryBuilder/components/Formula/Formula.tsx (1)
  • 149-149: The addition of showFunctions={false} to the QBEntityOptions component effectively hides function options within the formula entity. This change aligns with the PR's objectives to enhance the query builder's capabilities while maintaining a clean and user-friendly UI. Ensure that this behavior is consistent across all relevant components and that it aligns with user expectations for the new and existing API versions. It might be beneficial to verify if this change has been communicated clearly in the UI, especially for users transitioning between different versions of the query builder.

@YounixM
Copy link
Collaborator Author

YounixM commented Feb 20, 2024

If the version is not present default version to v3 ✅
With the above fallback in place, whenever the dashboard version is v3, let's continue to show the old UI for the metrics builder. ✅
With some recent commits, the endpoint logic is not working properly. All requests are going to /v3 ✅
Changing the metric name doesn't properly update the time and space aggregation operators ✅

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: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between b6a5cea and e5edc71.
Files selected for processing (1)
  • frontend/src/lib/uPlotLib/plugins/tooltipPlugin.ts (4 hunks)
Additional comments: 2
frontend/src/lib/uPlotLib/plugins/tooltipPlugin.ts (2)
  • 21-21: Adding queryName: string to the UplotTooltipDataProps interface is a good enhancement for providing more context in tooltips. This change aligns with the PR's objective to enhance data analysis capabilities.
  • 39-39: The introduction of duplicatedLegendLabels as a Record<string, true> is a smart way to track duplicated labels. This approach is efficient for checking the existence of labels without maintaining a list or array of seen labels.

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 ecd5ce9 and 656a93d.
Files ignored due to path filters (6)
  • frontend/public/locales/en-GB/dashboard.json is excluded by: !**/*.json
  • frontend/public/locales/en/dashboard.json is excluded by: !**/*.json
  • frontend/tests/fixtures/api/dashboard/dashboardGetCallWithTimeSeriesWidget200.json is excluded by: !**/*.json
  • frontend/tests/fixtures/api/dashboard/putDashboardWithTimeSeries200.json is excluded by: !**/*.json
  • frontend/tests/fixtures/api/traces/traceExplorerViews200.json is excluded by: !**/*.json
  • go.sum is excluded by: !**/*.sum
Files selected for processing (54)
  • frontend/src/api/apiV1.ts (1 hunks)
  • frontend/src/api/index.ts (2 hunks)
  • frontend/src/api/metrics/getQueryRange.ts (2 hunks)
  • frontend/src/constants/queryBuilder.ts (5 hunks)
  • frontend/src/constants/queryBuilderOperators.ts (1 hunks)
  • frontend/src/constants/queryFunctionOptions.ts (1 hunks)
  • frontend/src/constants/shortcuts/DashboardShortcuts.ts (1 hunks)
  • frontend/src/constants/shortcuts/QBShortcuts.ts (1 hunks)
  • frontend/src/container/FormAlertRules/QuerySection.tsx (2 hunks)
  • frontend/src/container/GridCardLayout/GridCardLayout.styles.scss (1 hunks)
  • frontend/src/container/GridCardLayout/GridCardLayout.tsx (2 hunks)
  • frontend/src/container/GridCardLayout/styles.ts (1 hunks)
  • frontend/src/container/ListOfDashboard/DashboardsList.tsx (2 hunks)
  • frontend/src/container/MetricsApplication/MetricsPageQueries/MetricsPageQueriesFactory.ts (2 hunks)
  • frontend/src/container/NewDashboard/ComponentsSlider/index.tsx (4 hunks)
  • frontend/src/container/NewDashboard/ComponentsSlider/menuItems.tsx (1 hunks)
  • frontend/src/container/NewDashboard/ComponentsSlider/styles.ts (1 hunks)
  • frontend/src/container/NewDashboard/DashboardDescription/Description.styles.scss (1 hunks)
  • frontend/src/container/NewDashboard/DashboardDescription/SettingsDrawer.tsx (2 hunks)
  • frontend/src/container/NewDashboard/DashboardDescription/index.tsx (5 hunks)
  • frontend/src/container/NewWidget/LeftContainer/QuerySection/index.tsx (4 hunks)
  • frontend/src/container/NewWidget/index.tsx (5 hunks)
  • frontend/src/container/OnboardingContainer/Steps/LogsConnectionStatus/LogsConnectionStatus.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/components/Formula/Formula.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/components/QBEntityOptions/QBEntityOptions.styles.scss (3 hunks)
  • frontend/src/container/QueryBuilder/components/QBEntityOptions/QBEntityOptions.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/components/Query/Query.tsx (7 hunks)
  • frontend/src/container/QueryBuilder/components/QueryFunctions/Function.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.styles.scss (1 hunks)
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/components/SpaceAggregationOptions/SpaceAggregationOptions.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/filters/AggregatorFilter/AggregatorFilter.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/OptionRenderer.tsx (2 hunks)
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/QueryBuilderSearch.styles.scss (1 hunks)
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/style.ts (1 hunks)
  • frontend/src/container/TraceDetail/SelectedSpanDetails/config.ts (1 hunks)
  • frontend/src/hooks/hotkeys/useKeyboardHotkeys.tsx (1 hunks)
  • frontend/src/hooks/queryBuilder/useGetQueryRange.ts (3 hunks)
  • frontend/src/hooks/queryBuilder/useQueryBuilderOperations.ts (7 hunks)
  • frontend/src/lib/dashboard/getQueryResults.ts (2 hunks)
  • frontend/src/lib/newQueryBuilder/getMetricsOperatorsByAttributeType.ts (1 hunks)
  • frontend/src/lib/uPlotLib/plugins/tooltipPlugin.ts (4 hunks)
  • frontend/src/types/api/dashboard/create.ts (1 hunks)
  • frontend/src/types/api/dashboard/getAll.ts (1 hunks)
  • frontend/src/types/api/queryBuilder/queryBuilderData.ts (1 hunks)
  • frontend/src/types/common/operations.types.ts (2 hunks)
  • frontend/src/types/common/queryBuilder.ts (2 hunks)
  • frontend/tests/dashboards/utils.ts (3 hunks)
  • pkg/query-service/app/clickhouseReader/reader.go (5 hunks)
  • pkg/query-service/app/limit.go (1 hunks)
  • pkg/query-service/app/metrics/v4/query_builder.go (2 hunks)
  • pkg/query-service/app/parser.go (2 hunks)
  • pkg/query-service/common/metrics.go (2 hunks)
  • pkg/query-service/model/v3/v3.go (5 hunks)
Files skipped from review as they are similar to previous changes (53)
  • frontend/src/api/apiV1.ts
  • frontend/src/api/index.ts
  • frontend/src/api/metrics/getQueryRange.ts
  • frontend/src/constants/queryBuilder.ts
  • frontend/src/constants/queryBuilderOperators.ts
  • frontend/src/constants/queryFunctionOptions.ts
  • frontend/src/constants/shortcuts/DashboardShortcuts.ts
  • frontend/src/constants/shortcuts/QBShortcuts.ts
  • frontend/src/container/FormAlertRules/QuerySection.tsx
  • frontend/src/container/GridCardLayout/GridCardLayout.styles.scss
  • frontend/src/container/GridCardLayout/GridCardLayout.tsx
  • frontend/src/container/GridCardLayout/styles.ts
  • frontend/src/container/ListOfDashboard/DashboardsList.tsx
  • frontend/src/container/MetricsApplication/MetricsPageQueries/MetricsPageQueriesFactory.ts
  • frontend/src/container/NewDashboard/ComponentsSlider/index.tsx
  • frontend/src/container/NewDashboard/ComponentsSlider/menuItems.tsx
  • frontend/src/container/NewDashboard/ComponentsSlider/styles.ts
  • frontend/src/container/NewDashboard/DashboardDescription/Description.styles.scss
  • frontend/src/container/NewDashboard/DashboardDescription/SettingsDrawer.tsx
  • frontend/src/container/NewDashboard/DashboardDescription/index.tsx
  • frontend/src/container/NewWidget/LeftContainer/QuerySection/index.tsx
  • frontend/src/container/NewWidget/index.tsx
  • frontend/src/container/OnboardingContainer/Steps/LogsConnectionStatus/LogsConnectionStatus.tsx
  • frontend/src/container/QueryBuilder/components/Formula/Formula.tsx
  • frontend/src/container/QueryBuilder/components/QBEntityOptions/QBEntityOptions.styles.scss
  • frontend/src/container/QueryBuilder/components/QBEntityOptions/QBEntityOptions.tsx
  • frontend/src/container/QueryBuilder/components/Query/Query.tsx
  • frontend/src/container/QueryBuilder/components/QueryFunctions/Function.tsx
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.styles.scss
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.tsx
  • frontend/src/container/QueryBuilder/components/SpaceAggregationOptions/SpaceAggregationOptions.tsx
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/OptionRenderer.tsx
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/QueryBuilderSearch.styles.scss
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/style.ts
  • frontend/src/container/TraceDetail/SelectedSpanDetails/config.ts
  • frontend/src/hooks/hotkeys/useKeyboardHotkeys.tsx
  • frontend/src/hooks/queryBuilder/useGetQueryRange.ts
  • frontend/src/hooks/queryBuilder/useQueryBuilderOperations.ts
  • frontend/src/lib/dashboard/getQueryResults.ts
  • frontend/src/lib/newQueryBuilder/getMetricsOperatorsByAttributeType.ts
  • frontend/src/lib/uPlotLib/plugins/tooltipPlugin.ts
  • frontend/src/types/api/dashboard/create.ts
  • frontend/src/types/api/dashboard/getAll.ts
  • frontend/src/types/api/queryBuilder/queryBuilderData.ts
  • frontend/src/types/common/operations.types.ts
  • frontend/src/types/common/queryBuilder.ts
  • frontend/tests/dashboards/utils.ts
  • pkg/query-service/app/clickhouseReader/reader.go
  • pkg/query-service/app/limit.go
  • pkg/query-service/app/metrics/v4/query_builder.go
  • pkg/query-service/app/parser.go
  • pkg/query-service/common/metrics.go
  • pkg/query-service/model/v3/v3.go
Additional comments: 1
frontend/src/container/QueryBuilder/filters/AggregatorFilter/AggregatorFilter.tsx (1)
  • 114-114: The addition of the optional chaining operator (?.) before accessing attributeKeys is a good practice to handle potential null or undefined values in payload. This change enhances the robustness of the code by preventing runtime errors that could occur if payload were null or undefined. It's a small but significant improvement in error handling within the application.

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 656a93d and 7452fc9.
Files selected for processing (1)
  • frontend/src/container/QueryBuilder/components/SpaceAggregationOptions/SpaceAggregationOptions.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • frontend/src/container/QueryBuilder/components/SpaceAggregationOptions/SpaceAggregationOptions.tsx

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 7452fc9 and 16704f3.
Files selected for processing (1)
  • pkg/query-service/app/parser.go (5 hunks)
Files skipped from review as they are similar to previous changes (1)
  • pkg/query-service/app/parser.go

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 f2d5d21 and b04dead.
Files ignored due to path filters (6)
  • frontend/public/locales/en-GB/dashboard.json is excluded by: !**/*.json
  • frontend/public/locales/en/dashboard.json is excluded by: !**/*.json
  • frontend/tests/fixtures/api/dashboard/dashboardGetCallWithTimeSeriesWidget200.json is excluded by: !**/*.json
  • frontend/tests/fixtures/api/dashboard/putDashboardWithTimeSeries200.json is excluded by: !**/*.json
  • frontend/tests/fixtures/api/traces/traceExplorerViews200.json is excluded by: !**/*.json
  • go.sum is excluded by: !**/*.sum
Files selected for processing (54)
  • frontend/src/api/apiV1.ts (1 hunks)
  • frontend/src/api/index.ts (2 hunks)
  • frontend/src/api/metrics/getQueryRange.ts (2 hunks)
  • frontend/src/constants/queryBuilder.ts (5 hunks)
  • frontend/src/constants/queryBuilderOperators.ts (1 hunks)
  • frontend/src/constants/queryFunctionOptions.ts (1 hunks)
  • frontend/src/constants/shortcuts/DashboardShortcuts.ts (1 hunks)
  • frontend/src/constants/shortcuts/QBShortcuts.ts (1 hunks)
  • frontend/src/container/FormAlertRules/QuerySection.tsx (2 hunks)
  • frontend/src/container/GridCardLayout/GridCardLayout.styles.scss (1 hunks)
  • frontend/src/container/GridCardLayout/GridCardLayout.tsx (2 hunks)
  • frontend/src/container/GridCardLayout/styles.ts (1 hunks)
  • frontend/src/container/ListOfDashboard/DashboardsList.tsx (2 hunks)
  • frontend/src/container/MetricsApplication/MetricsPageQueries/MetricsPageQueriesFactory.ts (2 hunks)
  • frontend/src/container/NewDashboard/ComponentsSlider/index.tsx (4 hunks)
  • frontend/src/container/NewDashboard/ComponentsSlider/menuItems.tsx (1 hunks)
  • frontend/src/container/NewDashboard/ComponentsSlider/styles.ts (1 hunks)
  • frontend/src/container/NewDashboard/DashboardDescription/Description.styles.scss (1 hunks)
  • frontend/src/container/NewDashboard/DashboardDescription/SettingsDrawer.tsx (2 hunks)
  • frontend/src/container/NewDashboard/DashboardDescription/index.tsx (5 hunks)
  • frontend/src/container/NewWidget/LeftContainer/QuerySection/index.tsx (4 hunks)
  • frontend/src/container/NewWidget/index.tsx (5 hunks)
  • frontend/src/container/OnboardingContainer/Steps/LogsConnectionStatus/LogsConnectionStatus.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/components/Formula/Formula.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/components/QBEntityOptions/QBEntityOptions.styles.scss (3 hunks)
  • frontend/src/container/QueryBuilder/components/QBEntityOptions/QBEntityOptions.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/components/Query/Query.tsx (7 hunks)
  • frontend/src/container/QueryBuilder/components/QueryFunctions/Function.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.styles.scss (1 hunks)
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/components/SpaceAggregationOptions/SpaceAggregationOptions.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/filters/AggregatorFilter/AggregatorFilter.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/OptionRenderer.tsx (2 hunks)
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/QueryBuilderSearch.styles.scss (1 hunks)
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/style.ts (1 hunks)
  • frontend/src/container/TraceDetail/SelectedSpanDetails/config.ts (1 hunks)
  • frontend/src/hooks/hotkeys/useKeyboardHotkeys.tsx (1 hunks)
  • frontend/src/hooks/queryBuilder/useGetQueryRange.ts (3 hunks)
  • frontend/src/hooks/queryBuilder/useQueryBuilderOperations.ts (7 hunks)
  • frontend/src/lib/dashboard/getQueryResults.ts (2 hunks)
  • frontend/src/lib/newQueryBuilder/getMetricsOperatorsByAttributeType.ts (1 hunks)
  • frontend/src/lib/uPlotLib/plugins/tooltipPlugin.ts (4 hunks)
  • frontend/src/types/api/dashboard/create.ts (1 hunks)
  • frontend/src/types/api/dashboard/getAll.ts (1 hunks)
  • frontend/src/types/api/queryBuilder/queryBuilderData.ts (1 hunks)
  • frontend/src/types/common/operations.types.ts (2 hunks)
  • frontend/src/types/common/queryBuilder.ts (2 hunks)
  • frontend/tests/dashboards/utils.ts (3 hunks)
  • pkg/query-service/app/clickhouseReader/reader.go (5 hunks)
  • pkg/query-service/app/limit.go (1 hunks)
  • pkg/query-service/app/metrics/v4/query_builder.go (2 hunks)
  • pkg/query-service/app/parser.go (5 hunks)
  • pkg/query-service/common/metrics.go (2 hunks)
  • pkg/query-service/model/v3/v3.go (5 hunks)
Files skipped from review as they are similar to previous changes (54)
  • frontend/src/api/apiV1.ts
  • frontend/src/api/index.ts
  • frontend/src/api/metrics/getQueryRange.ts
  • frontend/src/constants/queryBuilder.ts
  • frontend/src/constants/queryBuilderOperators.ts
  • frontend/src/constants/queryFunctionOptions.ts
  • frontend/src/constants/shortcuts/DashboardShortcuts.ts
  • frontend/src/constants/shortcuts/QBShortcuts.ts
  • frontend/src/container/FormAlertRules/QuerySection.tsx
  • frontend/src/container/GridCardLayout/GridCardLayout.styles.scss
  • frontend/src/container/GridCardLayout/GridCardLayout.tsx
  • frontend/src/container/GridCardLayout/styles.ts
  • frontend/src/container/ListOfDashboard/DashboardsList.tsx
  • frontend/src/container/MetricsApplication/MetricsPageQueries/MetricsPageQueriesFactory.ts
  • frontend/src/container/NewDashboard/ComponentsSlider/index.tsx
  • frontend/src/container/NewDashboard/ComponentsSlider/menuItems.tsx
  • frontend/src/container/NewDashboard/ComponentsSlider/styles.ts
  • frontend/src/container/NewDashboard/DashboardDescription/Description.styles.scss
  • frontend/src/container/NewDashboard/DashboardDescription/SettingsDrawer.tsx
  • frontend/src/container/NewDashboard/DashboardDescription/index.tsx
  • frontend/src/container/NewWidget/LeftContainer/QuerySection/index.tsx
  • frontend/src/container/NewWidget/index.tsx
  • frontend/src/container/OnboardingContainer/Steps/LogsConnectionStatus/LogsConnectionStatus.tsx
  • frontend/src/container/QueryBuilder/components/Formula/Formula.tsx
  • frontend/src/container/QueryBuilder/components/QBEntityOptions/QBEntityOptions.styles.scss
  • frontend/src/container/QueryBuilder/components/QBEntityOptions/QBEntityOptions.tsx
  • frontend/src/container/QueryBuilder/components/Query/Query.tsx
  • frontend/src/container/QueryBuilder/components/QueryFunctions/Function.tsx
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.styles.scss
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.tsx
  • frontend/src/container/QueryBuilder/components/SpaceAggregationOptions/SpaceAggregationOptions.tsx
  • frontend/src/container/QueryBuilder/filters/AggregatorFilter/AggregatorFilter.tsx
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/OptionRenderer.tsx
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/QueryBuilderSearch.styles.scss
  • frontend/src/container/QueryBuilder/filters/QueryBuilderSearch/style.ts
  • frontend/src/container/TraceDetail/SelectedSpanDetails/config.ts
  • frontend/src/hooks/hotkeys/useKeyboardHotkeys.tsx
  • frontend/src/hooks/queryBuilder/useGetQueryRange.ts
  • frontend/src/hooks/queryBuilder/useQueryBuilderOperations.ts
  • frontend/src/lib/dashboard/getQueryResults.ts
  • frontend/src/lib/newQueryBuilder/getMetricsOperatorsByAttributeType.ts
  • frontend/src/lib/uPlotLib/plugins/tooltipPlugin.ts
  • frontend/src/types/api/dashboard/create.ts
  • frontend/src/types/api/dashboard/getAll.ts
  • frontend/src/types/api/queryBuilder/queryBuilderData.ts
  • frontend/src/types/common/operations.types.ts
  • frontend/src/types/common/queryBuilder.ts
  • frontend/tests/dashboards/utils.ts
  • pkg/query-service/app/clickhouseReader/reader.go
  • pkg/query-service/app/limit.go
  • pkg/query-service/app/metrics/v4/query_builder.go
  • pkg/query-service/app/parser.go
  • pkg/query-service/common/metrics.go
  • pkg/query-service/model/v3/v3.go

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 b04dead and 2638d45.
Files selected for processing (8)
  • frontend/src/container/CreateAlertRule/defaults.ts (1 hunks)
  • frontend/src/container/FormAlertRules/QuerySection.tsx (5 hunks)
  • frontend/src/container/FormAlertRules/index.tsx (4 hunks)
  • frontend/src/container/QueryBuilder/QueryBuilder.interfaces.ts (1 hunks)
  • frontend/src/container/QueryBuilder/QueryBuilder.tsx (3 hunks)
  • frontend/src/container/QueryBuilder/components/Query/Query.interfaces.ts (1 hunks)
  • frontend/src/container/QueryBuilder/components/Query/Query.tsx (6 hunks)
  • frontend/src/types/api/alerts/def.ts (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • frontend/src/container/FormAlertRules/QuerySection.tsx
  • frontend/src/container/QueryBuilder/components/Query/Query.tsx
Additional comments: 9
frontend/src/container/QueryBuilder/components/Query/Query.interfaces.ts (1)
  • 10-10: The addition of showFunctions?: boolean; to QueryProps is a good enhancement for conditional UI rendering based on the presence of functions in the query builder. Ensure that all components consuming QueryProps properly handle this new optional property.
frontend/src/types/api/alerts/def.ts (1)
  • 25-25: The addition of version?: string; to the AlertDef interface aligns with the PR's objectives regarding version handling. Ensure that the version field is correctly utilized and handled in the logic that processes AlertDef instances.
frontend/src/container/QueryBuilder/QueryBuilder.interfaces.ts (1)
  • 30-30: The addition of showFunctions?: boolean; to QueryBuilderProps is a positive step towards enhancing the query builder's functionality. Ensure that all components consuming QueryBuilderProps properly handle this new optional property.
frontend/src/container/CreateAlertRule/defaults.ts (1)
  • 28-28: The hardcoded addition of version: 'v4' to alertDefaults aligns with the PR's objectives regarding API versioning. Ensure that this version is consistently used and handled correctly across the application, especially in areas related to alert definitions.
frontend/src/container/QueryBuilder/QueryBuilder.tsx (2)
  • 28-28: The addition of the showFunctions prop to the QueryBuilder component and its subsequent passing to child components is consistent with the PR's objectives. Ensure that this prop is correctly utilized and handled in all child components that receive it.
  • 170-170: The usage of showFunctions in child Query components to conditionally render UI elements based on the presence of functions is a good implementation detail. Verify that the showFunctions prop is correctly handled in all scenarios within these components.

Also applies to: 189-189

frontend/src/container/FormAlertRules/index.tsx (3)
  • 295-295: Renaming isAlertAvialable to isAlertAvailable corrects a typo and improves code readability. This is a good practice for maintaining clean and understandable code.
  • 447-448: The logic for determining isAlertAvailableToSave based on isAlertAvailable, the query type, and the alert type is a thoughtful addition. Ensure that this logic aligns with the intended behavior and user experience in the alert rule form.
  • 510-518: The update to the tooltip title based on isAlertAvailableToSave is a good user experience enhancement. It helps provide contextual information to the user based on the current state of the form.

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 2638d45 and 9f4fa2f.
Files selected for processing (3)
  • frontend/src/container/QueryBuilder/components/QueryFunctions/Function.tsx (1 hunks)
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.styles.scss (1 hunks)
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • frontend/src/container/QueryBuilder/components/QueryFunctions/Function.tsx
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.styles.scss
  • frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.tsx

@srikanthccv
Copy link
Member

I'd appreciate it if you don't force push and avoid it. Since the commits get squashed you can simply merge instead of rebase if that's what making you do that.

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: 4

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 9f4fa2f and 8da74c4.
Files selected for processing (3)
  • pkg/query-service/constants/constants.go (1 hunks)
  • pkg/query-service/rules/apiParams.go (1 hunks)
  • pkg/query-service/rules/thresholdRule.go (10 hunks)
Additional comments: 7
pkg/query-service/rules/apiParams.go (1)
  • 53-54: The addition of the Version field to the PostableRule struct with the JSON tag version,omitempty is a good practice for supporting API versioning. This allows for backward compatibility and future enhancements without breaking existing functionality. Ensure that the rest of the codebase properly handles this new field, especially in serialization/deserialization logic and when making decisions based on the version specified in rules.
pkg/query-service/constants/constants.go (1)
  • 216-216: The addition of the SIGNOZ_TIMESERIES_v4_1DAY_TABLENAME constant with the value "distributed_time_series_v4_1day" is consistent with the naming convention of other table name constants in the file. This addition supports the backend adjustments for the new spatial aggregation functionalities introduced in the PR. Ensure that this constant is used correctly in the SQL queries and parsing logic in the query service to support the new functionalities.
pkg/query-service/rules/thresholdRule.go (5)
  • 21-21: The import of github.com/ClickHouse/clickhouse-go/v2/lib/driver is added to support database interactions for fetching temporality information. Ensure that this library version is compatible with the rest of the project's dependencies.
  • 35-35: The import of go.signoz.io/signoz/pkg/query-service/app/metrics/v4 indicates the introduction of version 4 metrics handling. Verify that all necessary functionalities and interfaces required by ThresholdRule for version 4 are implemented in this package.
  • 129-134: The creation of a new query builder for version 4 (queryBuilderV4) using metricsV4.PrepareMetricQuery is a significant change. Ensure that the PrepareMetricQuery function is correctly implemented to handle spatial aggregations and functions.
  • 737-756: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [728-753]

The modifications in prepareBuilderQueries to handle version-specific query preparation and temporality population are significant. Ensure that the version check (r.version == "v4") correctly routes the query preparation through the appropriate query builder and that temporality information is accurately applied to the queries.

  • 1062-1068: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1065-1071]

The changes in buildAndRunQuery to accommodate version-specific query execution are crucial. Ensure that the method correctly handles the execution of queries based on the specified version and that any errors during query execution are properly logged and handled.

pkg/query-service/rules/thresholdRule.go Show resolved Hide resolved
pkg/query-service/rules/thresholdRule.go Show resolved Hide resolved
pkg/query-service/rules/thresholdRule.go Outdated Show resolved Hide resolved
pkg/query-service/rules/thresholdRule.go Outdated Show resolved Hide resolved
@srikanthccv
Copy link
Member

@YounixM please fix the removed list view from panel types.

@YounixM
Copy link
Collaborator Author

YounixM commented Feb 28, 2024

Yes @srikanthccv, aware of this issue. I have to verify the file with develop to make sure existing changes are not removed. That work is pending

@srikanthccv srikanthccv merged commit 1a62a13 into develop Mar 1, 2024
11 checks passed
@srikanthccv srikanthccv deleted the metrics-qb-change branch March 1, 2024 09:21
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