-
Notifications
You must be signed in to change notification settings - Fork 715
perf: dashboard trellis chart performance improvement #8835
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
perf: dashboard trellis chart performance improvement #8835
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Summary
Improved dashboard trellis chart performance by optimizing series limiting logic in both PromQL and SQL data converters.
Key changes:
- convertPromQLData.ts: Replaced sequential "waterfall" series limiting (where later queries get fewer series) with equal distribution across all queries. This ensures fair allocation when multiple y-axes are present.
- convertSQLData.ts: Added logic to divide the series limit by the number of y-axes when multiple y-axes AND breakdown fields exist, preventing series explosion in trellis charts.
Both changes ensure total series count stays at or below max_dashboard_series configuration value while distributing the limit more fairly across multiple queries/axes.
Confidence Score: 4/5
- This PR is safe to merge with minimal risk - the changes are focused and improve performance for trellis charts
- The changes are well-scoped and address a specific performance issue with trellis charts. The logic is straightforward: distributing series limits more fairly across queries/axes. The score is 4 (not 5) because the PR lacks a description and there are no associated tests visible in the changeset to verify the new behavior, though the changes themselves appear sound.
- No files require special attention - both changes are straightforward performance optimizations
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| web/src/utils/dashboard/convertPromQLData.ts | 4/5 | Changed series limiting from sequential waterfall approach to equal distribution across queries; improves fairness and performance for multi y-axis charts |
| web/src/utils/dashboard/convertSQLData.ts | 4/5 | Added logic to divide series limit by number of y-axes when multiple y-axes and breakdown fields exist; prevents series explosion in trellis charts |
Sequence Diagram
sequenceDiagram
participant Dashboard
participant convertPromQLData
participant convertSQLData
participant Store
Dashboard->>Store: Get max_dashboard_series config
Store-->>Dashboard: Return maxSeries (default: 100)
alt PromQL Data Path
Dashboard->>convertPromQLData: searchQueryData, panelSchema
convertPromQLData->>convertPromQLData: Count queries with results
convertPromQLData->>convertPromQLData: Calculate limitPerQuery<br/>(maxSeries / numberOfQueries)
convertPromQLData->>convertPromQLData: Apply equal limit to each query
convertPromQLData-->>Dashboard: Return limited series data
else SQL Data Path
Dashboard->>convertSQLData: data, panelSchema
convertSQLData->>convertSQLData: Get limitSeries from config
alt Multi Y-Axis with Breakdown
convertSQLData->>convertSQLData: Divide limitSeries<br/>by yAxisKeys.length
end
convertSQLData->>convertSQLData: Apply limit per y-axis
convertSQLData-->>Dashboard: Return limited series data
end
Dashboard->>Dashboard: Render chart with limited series
2 files reviewed, no comments
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 364 | 342 | 0 | 19 | 3 | 94% | 4m 38s |
### **PR Type**
Bug fix, Enhancement
___
### **Description**
- Cap series per query for PromQL
- Split SQL series limit across y-axes
- Prevent multi y-axis performance regressions
___
### Diagram Walkthrough
```mermaid
flowchart LR
Config["Dashboard config: max_dashboard_series"]
PromQL["convertPromQLData: per-query cap"]
SQL["convertSQLData: per-axis cap with breakdown"]
Performance["Reduced series -> better performance"]
Config -- "read max limit" --> PromQL
Config -- "read max/top_results" --> SQL
PromQL -- "divide by active queries" --> Performance
SQL -- "divide by yAxisKeys when breakdowns" --> Performance
```
<details> <summary><h3> File Walkthrough</h3></summary>
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>convertPromQLData.ts</strong><dd><code>Per-query series
limiting for PromQL results</code>
</dd></summary>
<hr>
web/src/utils/dashboard/convertPromQLData.ts
<ul><li>Replace global series cap with per-query cap.<br> <li> Compute
active query count and divide max limit.<br> <li> Slice each query's
results by per-query limit.<br> <li> Remove decremental cross-query
limiting logic.</ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8835/files#diff-68d70ba6c622911d48cdb567940dc404a4a6468b86c6d24fb54e5f1d8aa5ca2a">+10/-4</a>
</td>
</tr>
</table></td></tr><tr><td><strong>Bug fix</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>convertSQLData.ts</strong><dd><code>Per-axis series cap
for SQL with breakdowns</code>
</dd></summary>
<hr>
web/src/utils/dashboard/convertSQLData.ts
<ul><li>Introduce adaptive limit for multi y-axis charts.<br> <li>
Divide series limit by y-axis count when breakdowns present.<br> <li>
Preserve top_results and max_dashboard_series constraints.</ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8835/files#diff-88c0e865040a20b2c8bb7d77e7f6bd187a5b07c1645c120223bc9d59603752c3">+8/-1</a>
</td>
</tr>
</table></td></tr></tr></tbody></table>
</details>
___
PR Type
Bug fix, Enhancement
Description
Cap series per query for PromQL
Split SQL series limit across y-axes
Prevent multi y-axis performance regressions
Diagram Walkthrough
File Walkthrough
convertPromQLData.ts
Per-query series limiting for PromQL resultsweb/src/utils/dashboard/convertPromQLData.ts
convertSQLData.ts
Per-axis series cap for SQL with breakdownsweb/src/utils/dashboard/convertSQLData.ts