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

[docs] [Query Performance] #5136

Merged
merged 10 commits into from
Nov 21, 2024
Merged

[docs] [Query Performance] #5136

merged 10 commits into from
Nov 21, 2024

Conversation

minhtuev
Copy link
Contributor

@minhtuev minhtuev commented Nov 18, 2024

What changes are proposed in this pull request?

Added documentation for Query Performance panel

How is this patch tested? If it is not, please explain why.

  • Local testing

Release Notes

Is this a user-facing change that should be mentioned in the release notes?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release
    notes for FiftyOne users.

(Details in 1-2 sentences. You can just refer to another PR with a description
if this PR is part of a larger change.)

What areas of FiftyOne does this PR affect?

  • App: FiftyOne application changes
  • Build: Build and test infrastructure changes
  • Core: Core fiftyone Python library changes
  • Documentation: FiftyOne documentation changes
  • Other

Summary by CodeRabbit

  • New Features

    • Introduced a "Query Performance" section in the documentation, detailing enhancements for sidebar and background queries.
    • Added a toast notification system to alert users about potential query performance improvements.
    • Users can create and manage indexes and summary fields through the new Query Performance panel.
  • Documentation

    • Enhanced FiftyOne Teams documentation for better navigation with a new entry in the table of contents.
    • Updated FiftyOne App documentation to clarify index management for Teams customers, highlighting the use of the built-in Query Performance panel.

Copy link
Contributor

coderabbitai bot commented Nov 18, 2024

Walkthrough

This pull request introduces enhancements to the FiftyOne Teams documentation by adding a new section on "Query Performance" and updating existing documentation to reflect these changes. A new entry is included in the table of contents, and detailed descriptions of the Query Performance feature, including its functionalities and user interactions, are provided. Additionally, the documentation for managing dataset indexes in the FiftyOne App is updated to guide Teams customers on utilizing the built-in Query Performance panel.

Changes

File Path Change Summary
docs/source/teams/index.rst Added new entry to the table of contents: Query Performance <query_performance>
docs/source/teams/query_performance.rst Introduced new section "Query Performance" with multiple subsections detailing features like toggling performance, toast notifications, and index management.
docs/source/user_guide/app.rst Updated note regarding dataset index management to reference the Query Performance panel instead of a plugin.

Possibly related PRs

Suggested labels

documentation

Suggested reviewers

  • brimoor
  • findtopher

Poem

In the land of queries, swift and bright,
New docs emerge, a guiding light.
With panels and toasts, all set to go,
FiftyOne Teams, now watch it flow!
So hop along, dear friends, don’t delay,
Query Performance is here to stay! 🐇✨

Warning

Rate limit exceeded

@minhtuev has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 23 minutes and 23 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 5387a43 and 11c78e7.


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>, 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 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.

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.

Copy link
Contributor

@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.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (3)
docs/source/teams/query_performance.rst (3)

3-9: Improve title and introduction clarity

A few suggestions to enhance readability and maintain brand consistency:

  1. Remove "(NEW)" from the title as it's temporary and will become outdated
  2. Consider replacing "subsumed" with "replaced" for clarity
  3. Fix the product name: "Fiftyone's" should be "FiftyOne's"
-Query Performance (NEW)
+Query Performance
=======================

Query Performance is a feature built into the :ref:`FiftyOne Teams App <teams-app>`
which allows users to use FiftyOne to improve the performance of sidebar and background
-queries through the use of indexes and summary fields. Query Performance subsumed and
-expanded the capabilities of the previous Fiftyone's Lightning Mode (LM).
+queries through the use of indexes and summary fields. Query Performance replaced and
+expanded the capabilities of the previous FiftyOne's Lightning Mode (LM).

42-44: Improve environment variables documentation

The environment variables section needs consistent formatting:

  1. Use inline code formatting for environment variables
  2. Add missing punctuation
  3. Use consistent quotation marks
-Admins users can change the default setting for all users in the Teams App by setting
-`FIFTYONE_APP_DEFAULT_QUERY_PERFORMANCE` to `false`. Admin users can also completely disable
-query performance for all users by setting the `FIFTYONE_APP_ENABLE_QUERY_PERFORMANCE` to `false`.
+Admin users can change the default setting for all users in the Teams App by setting
+``FIFTYONE_APP_DEFAULT_QUERY_PERFORMANCE`` to ``false``. Admin users can also completely disable
+query performance for all users by setting ``FIFTYONE_APP_ENABLE_QUERY_PERFORMANCE`` to ``false``.

53-54: Fix grammatical error

There's a grammatical error in the sentence.

-example you can click on a label filter on the sidebar, and if the filter takes too longer
+example you can click on a label filter on the sidebar, and if the filter takes too long
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9a13da7 and 4bddbd3.

⛔ Files ignored due to path filters (8)
  • docs/source/images/teams/qp_config.png is excluded by !**/*.png, !**/*.png
  • docs/source/images/teams/qp_create_index.png is excluded by !**/*.png, !**/*.png
  • docs/source/images/teams/qp_create_summary_field.png is excluded by !**/*.png, !**/*.png
  • docs/source/images/teams/qp_home.png is excluded by !**/*.png, !**/*.png
  • docs/source/images/teams/qp_tableview.png is excluded by !**/*.png, !**/*.png
  • docs/source/images/teams/qp_toast.png is excluded by !**/*.png, !**/*.png
  • docs/source/images/teams/qp_toggle.png is excluded by !**/*.png, !**/*.png
  • docs/source/images/teams/qp_tooltip.png is excluded by !**/*.png, !**/*.png
📒 Files selected for processing (2)
  • docs/source/teams/index.rst (1 hunks)
  • docs/source/teams/query_performance.rst (1 hunks)
🔇 Additional comments (3)
docs/source/teams/index.rst (1)

147-147: LGTM! Let's verify the referenced file.

The new entry follows the documentation structure and integrates well with the existing toctree.

Let's verify that the referenced documentation file exists:

✅ Verification successful

The referenced documentation file exists at the expected location

The query_performance.rst file is present at docs/source/teams/query_performance.rst, confirming that the toctree entry is correctly linked to an existing documentation file.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the query_performance.rst file exists in the correct location
# Expected: File should exist in the teams directory

fd -t f "query_performance.rst" docs/source/teams

Length of output: 89

docs/source/teams/query_performance.rst (2)

95-98: Well-structured warning messages

The warning sections effectively communicate important operational considerations about index creation and summary field operations. They provide valuable guidance for users working with large datasets.

Also applies to: 118-121


71-73: Clarify default indexes

The documentation mentions "default indexes" but doesn't specify what these are. Consider adding details about which indexes are created by default and their purpose.

docs/source/teams/query_performance.rst Outdated Show resolved Hide resolved
For dataset with a large number of samples, creating, updating and deleting a summary field can take a long time to
complete.

For more information on summary fields, see :ref:`_summary-fields`.
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix broken cross-reference syntax

The cross-reference syntax is incorrect. Remove the underscore prefix from the reference target.

-For more information on summary fields, see :ref:`_summary-fields`.
+For more information on summary fields, see :ref:`summary-fields`.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
For more information on summary fields, see :ref:`_summary-fields`.
For more information on summary fields, see :ref:`summary-fields`.

docs/source/teams/query_performance.rst Outdated Show resolved Hide resolved
docs/source/teams/query_performance.rst Outdated Show resolved Hide resolved
Copy link

@mdecarlo mdecarlo left a comment

Choose a reason for hiding this comment

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

A few grammatical changes, and suggestions to remove certain paragraphs.

docs/source/teams/query_performance.rst Outdated Show resolved Hide resolved
docs/source/teams/query_performance.rst Outdated Show resolved Hide resolved
docs/source/teams/query_performance.rst Outdated Show resolved Hide resolved
docs/source/teams/query_performance.rst Show resolved Hide resolved
docs/source/teams/query_performance.rst Outdated Show resolved Hide resolved
Comment on lines 46 to 54
Query Performance Toast
-----------------------

When you open the FiftyOne Teams App with Query Performance enabled, you will see a toast
notification whenever a query is run that could benefit from Query Performance. The query
can be part of the background sampling process or a query that you run manually from the
side bar. Sidebar queries are queries that you run by clicking on the sidebar filters; for
example you can click on a label filter on the sidebar, and if the filter takes too longer
the toast will be opened.

Choose a reason for hiding this comment

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

I don't think we need to document the toast.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we need to document the Dismiss behavior?

docs/source/teams/query_performance.rst Outdated Show resolved Hide resolved
docs/source/teams/query_performance.rst Outdated Show resolved Hide resolved
docs/source/teams/query_performance.rst Outdated Show resolved Hide resolved
minhtuevo and others added 2 commits November 19, 2024 20:59
Copy link
Contributor

@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.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
app/packages/core/src/plugins/SchemaIO/components/TableView.tsx (1)

Line range hint 282-290: Consider improving type safety and performance of formatCellValue.

  1. The value parameter is typed as string but could receive any type from item[key]. Consider using a more accurate type.
  2. The function would benefit from memoization since it's called frequently during table renders.

Consider this improvement:

-function formatCellValue(value: string, props: ViewPropsType) {
+function formatCellValue(value: string | number | null | undefined, props: ViewPropsType): string {
   const round = props?.schema?.view?.round;
   const valueAsFloat = parseFloat(String(value));
   if (!Number.isNaN(valueAsFloat) && typeof round === "number") {
     return valueAsFloat.toFixed(round);
   }
-  return value;
+  return String(value ?? '');
 }

And wrap the function with React.useCallback when used in the component:

const memoizedFormatCellValue = useCallback(
  (value, props) => formatCellValue(value, props),
  [props?.schema?.view?.round]
);
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 4bddbd3 and 9625027.

📒 Files selected for processing (2)
  • app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx (1 hunks)
  • app/packages/core/src/plugins/SchemaIO/components/TableView.tsx (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx
🧰 Additional context used
📓 Path-based instructions (1)
app/packages/core/src/plugins/SchemaIO/components/TableView.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

🔇 Additional comments (2)
app/packages/core/src/plugins/SchemaIO/components/TableView.tsx (2)

186-186: LGTM! Performance optimization through memoization.

The introduction of the content variable prevents redundant calls to formatCellValue, as the value is now computed once per cell render.


200-202: LGTM! Improved tooltip rendering logic.

The simplified conditional rendering with pre-computed content enhances code readability and maintains the same functionality.

Copy link
Contributor

@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.

Actionable comments posted: 4

🧹 Outside diff range and nitpick comments (3)
docs/source/teams/query_performance.rst (3)

6-8: Simplify the feature description

The introduction can be more concise and direct.

-Query Performance is a feature built into the :ref:`FiftyOne Teams App <teams-app>`
-which allows users to use FiftyOne to improve the performance of the sidebar and background
-queries through the use of indexes and summary fields.
+The :ref:`FiftyOne Teams App <teams-app>` includes Query Performance, a feature that
+improves sidebar and background query performance through indexes and summary fields.

90-93: Enhance performance impact warning

The warning about performance impact should be more specific.

-For large, complex datasets, index creation can have an impact on the performance of the database.
-It is recommended to consult and communicate with your database administrator and teammates
-before attempting such an operation.
+.. warning::
+
+   Index creation on large datasets can:
+   
+   - Temporarily increase database load
+   - Impact query performance during creation
+   - Require additional storage space
+   
+   Consult your database administrator before creating indexes on:
+   
+   - Datasets larger than 100GB
+   - Collections with high write volumes
+   - Production databases

136-136: Add troubleshooting section

Consider adding a troubleshooting section to help users diagnose and resolve common issues.

Example addition:

Troubleshooting
--------------

Common Issues
~~~~~~~~~~~~

1. **Slow Index Creation**
   
   - Ensure adequate disk space
   - Check for concurrent operations
   - Monitor system resources

2. **Missing Performance Improvements**
   
   - Verify index creation completion
   - Check query patterns match indexes
   - Review MongoDB explain plans

3. **Summary Field Updates**
   
   - Confirm dataset modifications
   - Check for schema changes
   - Verify field dependencies
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9625027 and 4086fd2.

📒 Files selected for processing (2)
  • docs/source/teams/query_performance.rst (1 hunks)
  • docs/source/user_guide/app.rst (1 hunks)
🔇 Additional comments (2)
docs/source/teams/query_performance.rst (2)

33-35: Remove tooltip documentation

As per previous feedback, the tooltip documentation should be removed as it's not essential information.


45-63: Remove toast notification section

As per previous feedback, the toast notification documentation should be removed as it's not necessary to document this UI element.

docs/source/teams/query_performance.rst Outdated Show resolved Hide resolved
docs/source/teams/query_performance.rst Outdated Show resolved Hide resolved
docs/source/teams/query_performance.rst Outdated Show resolved Hide resolved
docs/source/user_guide/app.rst Outdated Show resolved Hide resolved
Copy link
Contributor

@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.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 4086fd2 and fdc984c.

📒 Files selected for processing (1)
  • docs/source/user_guide/app.rst (1 hunks)
🔇 Additional comments (1)
docs/source/user_guide/app.rst (1)

578-579: Documentation addition looks good

The added note provides valuable information to Teams customers about the Query Performance panel functionality and includes a helpful reference link for more details.

docs/source/user_guide/app.rst Outdated Show resolved Hide resolved
Copy link
Contributor Author

@minhtuev minhtuev left a comment

Choose a reason for hiding this comment

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

Addressed feedback

CamronStaley
CamronStaley previously approved these changes Nov 21, 2024
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@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.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (3)
docs/source/teams/query_performance.rst (3)

3-4: Remove "(NEW)" from the title

The "(NEW)" marker in the title is not standard RST practice and should be removed. The newness of the feature should be communicated through release notes or change logs instead.

-Query Performance (NEW)
+Query Performance

99-102: Enhance the warning message with specific impacts

The warning message could be more specific about the types of performance impacts users might experience.

 .. warning::
-For large, complex datasets, index creation can have an impact on the performance of the database.
-It is recommended to consult and communicate with your database administrator and teammates
-before attempting such an operation.
+For large, complex datasets, index creation can:
+
+- Temporarily increase CPU and memory usage
+- Slow down write operations during index building
+- Require additional storage space
+
+Consult your database administrator and teammates before creating indexes, and schedule index
+creation during off-peak hours.

110-113: Add more specific examples of summary fields

Consider adding more concrete examples of summary fields to help users better understand their applications.

 The Query Performance panel also allows users to create a summary field. Summary fields are sample-level fields that
 are computed and stored in the database. For example, users can create a summary field for objects detected in every
-frame. This allows users to filter quickly across the dataset to find samples with the desired objects.
+frame. This allows users to filter quickly across the dataset to find samples with the desired objects. Other examples include:
+
+- Count of detected objects per frame
+- Presence of specific object classes
+- Aggregated confidence scores
+- Custom metadata computations
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 025b49d and 5387a43.

📒 Files selected for processing (1)
  • docs/source/teams/query_performance.rst (1 hunks)
🔇 Additional comments (5)
docs/source/teams/query_performance.rst (5)

33-35: Remove tooltip documentation

As suggested in previous reviews, this tooltip documentation is not necessary for the user guide.


46-64: Remove toast notification section

As suggested in previous reviews, the toast notification documentation is not necessary for the user guide. This level of UI detail is better suited for internal documentation or user onboarding materials.


68-82: LGTM! Well-structured content

The section is well-organized with clear bullet points and follows the suggested structure from previous reviews.


122-138: LGTM! Well-organized performance considerations

The section effectively consolidates all performance-related warnings and provides clear guidance for users.


139-147: LGTM! Concise operational instructions

The sections provide clear and concise instructions for updating and deleting operations.

Copy link
Contributor

@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.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (3)
docs/source/teams/query_performance.rst (3)

3-4: Remove "(NEW)" from the title

The "(NEW)" marker in the title should be removed as it's not a standard documentation practice. Version control already tracks new additions, and this marker would become outdated over time.

-Query Performance (NEW)
+Query Performance

99-102: Enhance the performance impact warning

The warning about performance impact should be more specific and actionable.

 .. warning::
-For large, complex datasets, index creation can have an impact on the performance of the database.
-It is recommended to consult and communicate with your database administrator and teammates
-before attempting such an operation.
+Index creation on large, complex datasets can significantly impact database performance:
+
+- Memory usage may increase during index creation
+- Write operations may be slower until index creation completes
+- Database storage requirements will increase
+
+Best practices:
+
+- Consult your database administrator before creating indexes
+- Schedule index creation during off-peak hours
+- Monitor system resources during the operation

110-113: Add a concrete example of summary field usage

The explanation would benefit from a specific example showing the performance improvement.

 The Query Performance panel also allows users to create a summary field. Summary fields are sample-level fields that
 are computed and stored in the database. For example, users can create a summary field for objects detected in every
-frame. This allows users to filter quickly across the dataset to find samples with the desired objects.
+frame. This allows users to filter quickly across the dataset to find samples with the desired objects. For instance:
+
+.. code-block:: python
+
+    # Without summary field - slower
+    # Scans all frames in all videos
+    dataset.match("frames.detections.label == 'person'")
+
+    # With summary field - faster
+    # Uses pre-computed summary and index
+    dataset.match("detected_objects_summary.labels == 'person'")
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5387a43 and 11c78e7.

📒 Files selected for processing (1)
  • docs/source/teams/query_performance.rst (1 hunks)
🔇 Additional comments (2)
docs/source/teams/query_performance.rst (2)

33-35: Remove tooltip documentation

As previously suggested, we should remove the tooltip documentation as it's not necessary to document this level of UI detail.


46-64: Remove toast notification section

As previously suggested, we should remove the toast notification documentation as it's too detailed for this level of documentation. Users will naturally discover these UI elements while using the application.

@minhtuev minhtuev merged commit c5a74a5 into release/v1.1.0 Nov 21, 2024
13 checks passed
@minhtuev minhtuev deleted the doc/qp-panel branch November 21, 2024 23:15
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.

4 participants