Skip to content

feat(ourlogs): Add auto-refresh to logs #94887

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

k-fish
Copy link
Member

@k-fish k-fish commented Jul 3, 2025

Summary

This adds an auto-refresh toggle behind the 'ourlogs-live-refresh' flag.

Auto-refresh can be enabled with filters so long as the sort is by time and descending. It works on 5 second polling, with a virtual time using RAF to emulate streaming. Filters are applied so data is queried in a ~30s second window behind our ingest delay.

Auto-refresh will automatically disable itself under the following conditions:

  • You've hit a rate limit consistently over 3 polls (>1k logs/s)
  • You've hit an api error for any reason
  • You've hit the absolute timeout cap (10 minutes), you can re-enable it if you're actively using it
  • You change sort / filter etc.

A subsequent PR will contain changes for the graph updates.

Other

  • Added some memos and callbacks for performance reasons since the virtual timestamp updates fairly quickly
  • Modified delayed data to follow already set delay in graphs (will be needed in the next PR)

@k-fish k-fish requested a review from a team as a code owner July 3, 2025 20:12
@k-fish k-fish requested a review from colin-sentry July 3, 2025 20:12
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 3, 2025
This adds an auto-refresh toggle behind the 'ourlogs-live-refresh' flag.

Auto-refresh can be enabled with filters so long as the sort is by time and descending. It works on 5 second polling, with a virtual time using RAF to emulate streaming. Filters are applied so data is queried in a ~30s second window behind our ingest delay.

Auto-refresh will automatically disable itself under the following conditions:
- You've hit a rate limit consistently over 3 polls (>1k logs/s)
- You've hit an api error for any reason
- You've hit the absolute timeout cap (10 minutes), you can re-enable it if you're actively using it
- You change sort / filter etc.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Time-Based Sort Logic Incorrect

The checkSortIsTimeBasedDescending function contains incorrect logic. It checks if a time-based sort exists and if any sort in the array is descending, rather than specifically verifying that the time-based sort itself is descending. This can lead to the function returning true even when the time-based sort is ascending, as long as another field is sorted in descending order.

static/app/views/explore/logs/utils.tsx#L202-L208

export function checkSortIsTimeBasedDescending(sortBys: Sort[]) {
return (
getTimeBasedSortBy(sortBys) !== undefined &&
sortBys.some(sortBy => sortBy.kind === 'desc')
);
}

Fix in CursorFix in Web


Bug: Operator Precedence Error in Query Filters

Incorrect operator precedence in the expression (pageParam.querySortDirection ?? pageParam.sortByDirection === 'asc') causes it to evaluate as pageParam.querySortDirection ?? (pageParam.sortByDirection === 'asc'). Since pageParam.querySortDirection is a truthy object when present, this incorrectly forces the comparison operator to '>=', regardless of the actual sort direction, leading to malformed query filters.

static/app/views/explore/logs/useLogsQuery.tsx#L399-L401

}
const comparison =
(pageParam.querySortDirection ?? pageParam.sortByDirection === 'asc') ? '>=' : '<=';

Fix in CursorFix in Web


Bug: Delayed Data Marking Fails on Re-evaluation

The markDelayedData function prematurely returns if datum.incomplete is already defined. This prevents re-evaluation of data points against the current delay parameter, leading to incorrect incomplete statuses, especially when the delay value changes.

static/app/utils/timeSeries/markDelayedData.tsx#L25-L28

if (defined(datum.incomplete)) {
return datum;
}

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant