Skip to content

experiments: promoted-vs-original traffic over time - #70

Merged
reflog merged 3 commits into
mainfrom
reflog/promoted-comparison-graph
Jul 22, 2026
Merged

experiments: promoted-vs-original traffic over time#70
reflog merged 3 commits into
mainfrom
reflog/promoted-comparison-graph

Conversation

@reflog

@reflog reflog commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

What

Adds a "Promoted vs original — traffic over time" section to the Experiments tab: one small-multiple card per promotion, showing the promoted track vs its control (original) as proxy.io throughput over time. Lets you watch the promoted line climb (and the control's market share fall) — i.e. is the promotion actually working?

Key design points

  • Traffic is scoped to each experiment's target market (geo.country.iso_code = targetCountry). A control is frequently a multi-market incumbent whose total traffic dwarfs a single-market challenger (e.g. hysteria2-oci-free-vps does ~5 MB/s globally but ~450 KB/s in MM) — only the target-market slice is a fair comparison. One proxy.io query per distinct market, keyed by (track, market).
  • Log-scale Y-axis by default, with a Linear toggle — a freshly-promoted KB/s challenger and an MB/s incumbent are otherwise not both visible.
  • A vertical marker shows the promotion time when it falls in-window.
  • Filters: country / protocol / provider + time window (6h/24h/7d/30d).

Also in this PR (from earlier review + a screenshot request):

  • Lifecycle pipeline cards are now toggle filters for the experiments list (all on except retired).
  • Accessibility: chips are <button>s; misc Copilot/CodeRabbit fixes.

Depends on

  • getlantern/lantern-cloud#3009 (the endpoint) — deploy before this renders live data.

Test plan

  • tsc -b ✅ · eslint (changed files) ✅ · vite build
  • Query shape (proxy.io / proxy.track / transmit, market-scoped) validated against live SigNoz for a real promoted pair.

Note: replaces an earlier median-goodput scatter revision — the traffic-over-time view answers "is it working?" far more directly.

Add a "Promoted vs original — median goodput" scatter to the Experiments
tab. Each point is a promoted track (an experiment's challenger) plotted
against the original it beat (the control), measured over a recent window
in the experiment's target market. A dashed parity line splits winning
(above) from losing (below) promotions, so regressions stand out.

Filters: country / protocol / provider dropdowns plus a time-range
selector (6h/24h/7d/30d). A point is plotted only when both arms have
live samples in the window; the rest are counted as hidden rather than
piled on the origin. Backed by the new
/v1/dashboard/experiments/promoted-comparison endpoint (one request,
server-side SigNoz query).
Copilot AI review requested due to automatic review settings July 22, 2026 09:35
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@reflog, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 46 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 90efd099-3637-43c7-a05a-b5414b775df1

📥 Commits

Reviewing files that changed from the base of the PR and between fd20522 and 367179c.

📒 Files selected for processing (2)
  • src/components/ExperimentsOverview.tsx
  • src/hooks/useExperiments.ts
📝 Walkthrough

Walkthrough

Changes

The experiments API now exposes promoted-versus-original comparison data. A hook fetches this data for selected time windows, and the Experiments view renders filtered goodput scatter comparisons with loading, error, empty, tooltip, and summary states.

Promoted comparison

Layer / File(s) Summary
Comparison API contract and request
src/api/client.ts
Adds comparison point and response types plus fetchPromotedComparison(hours) for the experiments comparison endpoint.
Comparison data hook
src/hooks/useExperiments.ts
Adds conditional request handling with loading, error, response, and cancellation state.
Experiments comparison chart
src/components/ExperimentsOverview.tsx
Adds comparison windows, filters, scatter visualization, tooltips, summary counts, and experiments-tab integration.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ExperimentsOverview
  participant usePromotedComparison
  participant fetchPromotedComparison
  participant ExperimentsPromotedComparisonEndpoint

  ExperimentsOverview->>usePromotedComparison: enable comparison with selected hours
  usePromotedComparison->>fetchPromotedComparison: request comparison data
  fetchPromotedComparison->>ExperimentsPromotedComparisonEndpoint: GET hours query parameter
  ExperimentsPromotedComparisonEndpoint-->>fetchPromotedComparison: return comparison response
  fetchPromotedComparison-->>usePromotedComparison: resolve response
  usePromotedComparison-->>ExperimentsOverview: provide data, loading, and error state
  ExperimentsOverview->>ExperimentsOverview: filter points and render scatter chart
Loading

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change: a promoted-vs-original goodput scatter chart for experiments.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch reflog/promoted-comparison-graph

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a new “Promoted vs original — median goodput” scatter visualization to the Experiments tab, backed by a single server-side query via a new dashboard endpoint, to quickly spot post-promotion regressions.

Changes:

  • Added GET /v1/dashboard/experiments/promoted-comparison client types + fetch helper and a React hook to load the comparison window.
  • Implemented a new Recharts-based scatter (parity line + win/loss coloring) with country/protocol/provider filters and selectable time windows.
  • Rendered the scatter between the lifecycle pipeline strip and the experiments table.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/api/client.ts Adds PromotedComparison* types and fetchPromotedComparison(hours) API call.
src/hooks/useExperiments.ts Adds usePromotedComparison(enabled, hours) hook to load scatter data.
src/components/ExperimentsOverview.tsx Adds the PromotedComparison UI (filters, windows, scatter chart) and mounts it in the Experiments view.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/hooks/useExperiments.ts
Comment thread src/components/ExperimentsOverview.tsx
Comment thread src/components/ExperimentsOverview.tsx Outdated
Comment thread src/components/ExperimentsOverview.tsx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/components/ExperimentsOverview.tsx (1)

623-625: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Time-window chips and Clear are not keyboard-accessible.

These are the only way to change the window, but as bare <div onClick> they can't be focused or activated via keyboard, and expose no role to assistive tech. Consider <button> (or add role="button", tabIndex={0}, and onKeyDown for Enter/Space). The native <select> filters below are already accessible.

Also applies to: 651-653

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/ExperimentsOverview.tsx` around lines 623 - 625, Update the
comparison-window chips in the COMPARISON_WINDOWS map and the Clear control to
use keyboard-accessible button elements, preserving their existing click
handlers and styling while exposing appropriate button semantics and supporting
Enter/Space activation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/ExperimentsOverview.tsx`:
- Line 602: Update the hidden count calculation in ExperimentsOverview to derive
from the already filtered points rather than allPoints, so it reflects only
country, protocol, and provider selections. Preserve the existing
promotedSamples and originalSamples exclusion criteria and the filtered track
summary behavior.

---

Nitpick comments:
In `@src/components/ExperimentsOverview.tsx`:
- Around line 623-625: Update the comparison-window chips in the
COMPARISON_WINDOWS map and the Clear control to use keyboard-accessible button
elements, preserving their existing click handlers and styling while exposing
appropriate button semantics and supporting Enter/Space activation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 24461598-1a9c-4e57-842b-c0effc4b2a3f

📥 Commits

Reviewing files that changed from the base of the PR and between 1e2595f and fd20522.

📒 Files selected for processing (3)
  • src/api/client.ts
  • src/components/ExperimentsOverview.tsx
  • src/hooks/useExperiments.ts

Comment thread src/components/ExperimentsOverview.tsx Outdated
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploying lantern-dashboard with  Cloudflare Pages  Cloudflare Pages

Latest commit: 367179c
Status: ✅  Deploy successful!
Preview URL: https://84ca91ab.lantern-dashboard.pages.dev
Branch Preview URL: https://reflog-promoted-comparison-g.lantern-dashboard.pages.dev

View logs

… filters

Turn the pipeline-strip stage cards into toggle buttons that show/hide
that status in the experiments list (accessible <button>s with
aria-pressed; off = dimmed + struck through). All stages on by default
except 'retired', which is the bulk of terminal history.

Also address CodeRabbit: the promoted-comparison "N hidden" count now
derives from points matching the active country/protocol/provider filters
(shared matchesFilters predicate), so it stays consistent with the
filtered track count instead of showing a global total.
@reflog
reflog merged commit 6a60932 into main Jul 22, 2026
2 checks passed
@reflog
reflog deleted the reflog/promoted-comparison-graph branch July 22, 2026 09:51
@reflog reflog changed the title experiments: promoted-vs-original goodput scatter experiments: promoted-vs-original traffic over time Jul 22, 2026
@reflog
reflog requested a review from Copilot July 22, 2026 10:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment on lines +642 to +645
<div style={{ ...sectionLabel, marginBottom: "0.15rem" }}>Promoted vs original — median goodput</div>
<div style={{ ...mono, fontSize: "0.55rem", color: "var(--text-muted)" }}>
Each point is a promoted track vs the original it beat, over the last {COMPARISON_WINDOWS.find((w) => w.hours === hours)?.label ?? `${hours}h`}, in its target market. Above the parity line = promotion still winning.
</div>
Comment on lines +584 to +593
const delta = p.originalGoodput > 0 ? ((p.promotedGoodput - p.originalGoodput) / p.originalGoodput) * 100 : 0;
const deltaColor = delta >= 0 ? WIN_COLOR : LOSS_COLOR;
return (
<div style={{ ...mono, fontSize: "0.62rem", background: "var(--bg-secondary)", border: "1px solid #ffffff14", borderRadius: "var(--radius-sm)", padding: "0.5rem 0.6rem", lineHeight: 1.5 }}>
<div style={{ color: "var(--text-muted)" }}>#{p.experimentId} · {p.targetCountry} · {p.protocolName || "—"}{p.providerName ? ` · ${p.providerName}` : ""}</div>
<div><span style={{ color: WIN_COLOR }}>{p.promotedTrackName}</span> <span style={{ color: "var(--text-muted)" }}>(promoted)</span></div>
<div><span style={{ color: CONTROL_COLOR }}>{p.originalTrackName}</span> <span style={{ color: "var(--text-muted)" }}>(original)</span></div>
<div style={{ marginTop: "0.25rem" }}>promoted: {formatBytesPerSec(p.promotedGoodput)} <span style={{ color: "var(--text-muted)" }}>({p.promotedSamples} sess)</span></div>
<div>original: {formatBytesPerSec(p.originalGoodput)} <span style={{ color: "var(--text-muted)" }}>({p.originalSamples} sess)</span></div>
<div style={{ color: deltaColor, marginTop: "0.15rem" }}>{delta >= 0 ? "+" : ""}{delta.toFixed(0)}% vs original</div>
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.

2 participants