Skip to content

Conversation

@nikhilsaikethe
Copy link
Contributor

@nikhilsaikethe nikhilsaikethe commented Jul 31, 2024

  1. Logs count fix when moving back and forth (this was the issue that came up when I have fixed the different logs count showing at first )
  2. Fixed another issue that onMount in histogram mode when we move to any other page and comeback to first page it shows 0 total count.

Summary by CodeRabbit

  • New Features

    • Enhanced handling of query results for improved accuracy in data representation.
    • Introduced dynamic time parameters for queries based on pagination, optimizing data retrieval.
  • Bug Fixes

    • Addressed potential discrepancies in the total count of query results.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 31, 2024

Walkthrough

The recent modifications to the useLogs function refine how query results are managed, particularly in terms of total count and time parameters. By consistently setting the total number of query results and enabling dynamic assignment of start and end times based on pagination, these updates enhance data accuracy and improve the overall user experience when interacting with logs.

Changes

Files Change Summary
web/src/composables/useLogs.ts Revised handling of searchObj.data.queryResults.total and introduced dynamic time parameter setting based on pagination state.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Pagination
    participant QueryHandler
    participant Logger

    User->>Pagination: Request next page
    Pagination->>QueryHandler: Update start_time and end_time
    QueryHandler->>Logger: Fetch query results with updated time
    Logger-->>QueryHandler: Return query results
    QueryHandler-->>Pagination: Display updated results
Loading

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 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

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

CodeRabbit Configuration File (.coderabbit.yaml)

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

Documentation and Community

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

@github-actions github-actions bot added the ☢️ Bug Something isn't working label Jul 31, 2024
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between db1ca05 and dbbaeb6.

Files selected for processing (1)
  • web/src/composables/useLogs.ts (4 hunks)
Additional comments not posted (5)
web/src/composables/useLogs.ts (5)

800-800: Ensure searchObj.data.queryResults.hits is correctly handled.

Setting searchObj.data.queryResults.hits to an empty array before updating req.query.sql ensures that previous query results do not interfere with the new query. This is a good practice to maintain data consistency.


1198-1199: Verify the initialization of searchObj.data.queryResults.total.

Setting searchObj.data.queryResults.total to 0 ensures that the total count is reset before processing new partitions. This helps avoid inaccuracies in the total count.


2247-2254: Ensure correct handling of start_time and end_time for pagination.

Setting queryReq.query.start_time and queryReq.query.end_time based on the current pagination state ensures that the histogram data is accurately retrieved for the correct time range.


2251-2254: Ensure correct handling of start_time and end_time for pagination in getQueryData.

Updating queryReq.query.start_time and queryReq.query.end_time based on the current pagination state ensures that the query data is accurately retrieved for the correct time range.


2251-2254: Ensure correct handling of start_time and end_time for pagination in getPaginatedData.

Updating queryReq.query.start_time and queryReq.query.end_time based on the current pagination state ensures that the paginated data is accurately retrieved for the correct time range.

@nikhilsaikethe
Copy link
Contributor Author

Need to test it with huge data that onmounted I am appending the start time and end time so is it correct or not

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between dbbaeb6 and 489aa68.

Files selected for processing (1)
  • web/src/composables/useLogs.ts (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • web/src/composables/useLogs.ts

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 489aa68 and 7910722.

Files selected for processing (1)
  • web/src/composables/useLogs.ts (4 hunks)
Additional comments not posted (2)
web/src/composables/useLogs.ts (2)

2379-2386: LGTM! Verify the dynamic assignment of time parameters.

The code changes are approved.

However, ensure that the dynamic assignment of start_time and end_time for the query request works correctly in all scenarios.

Verification successful

Let's re-run the search for queryReq.query.start_time and queryReq.query.end_time without specifying the file type.


The dynamic assignment of start_time and end_time for the query request appears to be correctly implemented.

The assignments are consistent across different parts of the codebase, and no issues were found with the current implementation.

  • web/src/composables/useLogs.ts
  • web/src/plugins/traces/Index.vue
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the dynamic assignment of `start_time` and `end_time` for the query request.

# Test: Search for the usage of `queryReq.query.start_time` and `queryReq.query.end_time` in the codebase. Expect: Ensure that the dynamic assignment works correctly in all scenarios.
rg --type javascript -A 5 $'queryReq.query.start_time'

Length of output: 88


Script:

#!/bin/bash
# Description: Verify the dynamic assignment of `start_time` and `end_time` for the query request.

# Test: Search for the usage of `queryReq.query.start_time` and `queryReq.query.end_time` in the codebase. Expect: Ensure that the dynamic assignment works correctly in all scenarios.
rg -A 5 'queryReq.query.start_time'

Length of output: 5325


1213-1214: Ensure total count logic is correct.

Setting searchObj.data.queryResults.total to 0 might impact the total count logic. Verify that this change does not cause issues with the total count calculation elsewhere in the code.

@bjp232004 bjp232004 merged commit 5724ba1 into main Aug 5, 2024
@bjp232004 bjp232004 deleted the pagination-fix branch August 5, 2024 12:25
abvarun226 pushed a commit to abvarun226/openobserve that referenced this pull request Aug 8, 2024
1. Logs count fix when moving back and forth (this was the issue that
came up when I have fixed the different logs count showing at first )
2. Fixed another issue that onMount in histogram mode when we move to
any other page and comeback to first page it shows 0 total count.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **New Features**
- Enhanced handling of query results for improved accuracy in data
representation.
- Introduced dynamic time parameters for queries based on pagination,
optimizing data retrieval.

- **Bug Fixes**
- Addressed potential discrepancies in the total count of query results.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@coderabbitai coderabbitai bot mentioned this pull request Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

☢️ Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants