Repository navigation
Show an estimated savings opportunity with a code-fix CTA - #84
Open
DanielAronovich wants to merge 5 commits into
Open
DanielAronovich wants to merge 5 commits into
DanielAronovich wants to merge 5 commits into
Conversation
dev.sh wraps the common local workflows: running an example job, the hot-reload UI, deploying the UI into the plugin, a history server with the plugin, and a local standalone cluster (cluster-job / cluster-stop). DevPlayground runs a mix of workloads so most views and alerts have data, then waits for Enter so the live UI stays up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In local mode Spark reports the driver's totalDuration as its uptime rather than its task time, so the idle cores rate was always 1 - 1/cores (87.5% on local[8]). Use the stages' task time instead. The per-query "Idle Cores" value was computed as task time / core time, i.e. the busy share; it now reports the idle share its label describes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Estimates the share of the app's compute cost (DCU) that could be saved: alerted queries save their DCU times a per-alert runtime reduction (compounding when a query has several alerts), then idle cores and over-provisioned memory are right-sized on the cost that is left. Skew fixes are taken out of the idle pool so reclaimed idle isn't counted twice. The calibrated factors come from SavingsFixDemo before/after runs on a local standalone cluster. The estimate shows as a Savings tile on the summary page, a banner on the status page, and per-alert chips and buttons on the alerts tab. Clicks open the book-a-demo page with UTM tags for placement and percentage and are tracked in Mixpanel. Hidden in the DataFlint SaaS UI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Lead with the outcome ("Get the code fix") instead of "Fix it with AI",
explain how in a secondary line (DataFlint's agent opens the PR from the
IDE via MCP), keep "Book a demo" on every button so the destination is
clear, and swap the sparkles icon for a code icon. The label and pitch
are shared from BookDemo.ts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the Status-page banner with a quiet "Get the code fix" card in the drawer's empty space, shown on every page (an icon when collapsed), and say "See it live" instead of "Book a demo" on all savings CTAs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DanielAronovich
requested review from
menishmueli
and
a balanced review from Copilot
November 3, 2026 14:03
|
|
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved issues overstate and double-count savings, prevent keyboard access to the demo CTA, and override the submitted Spark master, leaving the intended cluster unused.
5 open issues
What changed in this PR
Adds estimated compute-cost savings to the OSS Spark UI, with tracked code-fix demo CTAs. It also corrects idle-core metrics and introduces local development workflows.
Changes:
- Estimates query, idle-core, and memory savings, displayed in the summary, sidebar, and alerts.
- Corrects local-mode and per-query idle-core calculations.
- Adds development commands, sample workloads, and before/after calibration scenarios.
| File | Description |
|---|---|
spark-ui/src/utils/BookDemo.ts |
Shared CTA styling, formatting, tracking, and demo links. |
spark-ui/src/tabs/AlertsTab.tsx |
Adds savings chips and per-alert CTAs. |
spark-ui/src/reducers/StatusReducer.ts |
Uses stage task time for local-mode idle cores. |
spark-ui/src/reducers/StatusReducer.spec.ts |
Tests local-mode idle-core calculation and fallback. |
spark-ui/src/reducers/SparkSlice.ts |
Passes stage task time into executor status calculation. |
spark-ui/src/reducers/SavingsOpportunityReducer.ts |
Computes app-level and per-alert savings estimates. |
spark-ui/src/reducers/SavingsOpportunityReducer.spec.ts |
Tests savings calculations and missing-data handling. |
spark-ui/src/reducers/MetricsReducer.ts |
Corrects per-query idle percentage. |
spark-ui/src/reducers/AlertsReducer.ts |
Integrates savings estimation after alert filtering. |
spark-ui/src/interfaces/Mixpanel.ts |
Defines the savings CTA click event. |
spark-ui/src/interfaces/AppStore.ts |
Adds savings types and optional estimate fields. |
spark-ui/src/components/SummaryBar.tsx |
Displays the OSS savings tile. |
spark-ui/src/components/SavingsOpportunityBox.tsx |
Adds the savings tile, breakdown tooltip, and CTA. |
spark-ui/src/components/AppDrawer/DrawerSavingsCard.tsx |
Adds expanded and collapsed sidebar CTAs. |
spark-ui/src/components/AppDrawer/AppDrawer.tsx |
Integrates the sidebar savings card. |
spark-plugin/example_3_5_1/src/main/scala/io/dataflint/example/SavingsFixDemo.scala |
Adds before/after savings calibration workloads. |
spark-plugin/example_3_5_1/src/main/scala/io/dataflint/example/DevPlayground.scala |
Adds varied workloads for live UI development. |
dev.sh |
Provides job, cluster, UI, and history-server commands. |
CONTRIBUTING.md |
Documents the local development workflow. |
Review effort: Balanced
| .config("spark.eventLog.enabled", "true") | ||
| .config("spark.eventLog.dir", eventLogDir) | ||
| .config("spark.sql.maxMetadataStringLength", "10000") | ||
| .master("local[*]") |
Comment on lines
+43
to
+46
| <Paper | ||
| onClick={() => openBookDemo("summary-tile", savings.totalPercentage)} | ||
| sx={{ | ||
| p: 2, |
| if (IDLE_RECLAIMING_ALERTS.has(alert.name)) { | ||
| idleReclaimingDCUBySqlId.set( | ||
| sqlId, | ||
| Math.max(idleReclaimingDCUBySqlId.get(sqlId) ?? 0, savingsDCU), |
Comment on lines
+93
to
+97
| remainingRuntimeBySqlId.forEach( | ||
| (remainingRuntime, sqlId) => | ||
| (queriesDCU += (sqlDCUBySqlId.get(sqlId) ?? 0) * (1 - remainingRuntime)), | ||
| ); | ||
| queriesDCU = Math.min(queriesDCU, totalDCU); |
Comment on lines
+69
to
+72
| grouped[alert.name].savingsPercentage = Math.min( | ||
| 100, | ||
| grouped[alert.name].savingsPercentage + (alert.savingsPercentage ?? 0), | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds a rough savings estimate to the OSS Spark UI: how much of the app's compute cost (DCU) looks recoverable, with a low-key "Get the code fix · See it live" CTA to the DataFlint demo page. It also fixes the idle cores rate in local mode and adds a local dev loop.
Savings estimate (
SavingsOpportunityReducer)SavingsFixDemo), rounded down. The other alert reductions are heuristics.savingsPercentage, shown on the Alerts tab.UI
isDataFlintSaaSUI).SavingsBookDemoClicked. The link carries UTM tags, including the placement:summary-tile,sidebaroralert-<name>.Idle cores fix
totalDurationis its uptime, so the rate was stuck at1 - 1/cores.Dev loop
dev.sh:job,cluster-job,cluster-stop,ui,deploy-ui,shsandshs-ui, documented in CONTRIBUTING.md.DevPlaygroundand theSavingsFixDemobefore/after scenarios.Test plan
npm test: 19 suites and 102 tests pass, including new specs for the estimator and the local-mode idle rate.tscis clean.SavingsFixDemoscenario, local and on a standalone cluster, compared the estimate with the real cost difference.