Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(replay-vision): scan condition UI updates (#73108)

Hayne Ryu7537951763a0
diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerTriggers.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerTriggers.tsx
index f7c1c50f7842..d2b917e7b7ef 100644
--- a/products/replay_vision/frontend/replay_scanners/components/ScannerTriggers.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerTriggers.tsx
@@ -87,67 +87,6 @@ export function ScannerTriggers({ scannerId }: { scannerId: string }): JSX.Eleme
return (
<div className="space-y-6">
- <LemonField
- name="sampling_mode"
- label="Session coverage"
- info="How many of your matching sessions this scanner watches. Every recording gets a score for how much is happening in it (activity, errors, navigation). Focused and Balanced skip the quiet ones, so your observation budget goes to sessions worth watching."
- >
- {({ value, onChange }) => {
- const mode = (value ?? 'comprehensive') as SamplingMode
- const option = SAMPLING_MODE_OPTIONS.find((o) => o.value === mode)
- return (
- <div className="space-y-1">
- <LemonSegmentedButton
- value={mode}
- onChange={onChange}
- options={SAMPLING_MODE_OPTIONS.map((o) => ({ value: o.value, label: o.label }))}
- />
- <div className="text-xs text-muted">{option?.description}</div>
- </div>
- )
- }}
- </LemonField>
-
- <LemonField name="sampling_rate">
- {({ value, onChange }) => {
- const ratio = typeof value === 'number' ? value : 0
- const samplingPercent = Math.round(ratio * 1000) / 10
- return (
- <LemonCard hoverEffect={false} className="p-3 space-y-3">
- <div className="space-y-1">
- <LemonLabel>Sampling</LemonLabel>
- <div className="text-xs text-muted">
- Each observation counts against your monthly Vision quota.
- </div>
- </div>
- <div className="flex items-center gap-4">
- <div className="flex-1">
- <LemonSlider
- value={samplingPercent}
- onChange={(v) => onChange(v / 100)}
- min={0.1}
- max={100}
- step={0.1}
- />
- </div>
- <div className="w-24">
- <LemonInput
- type="number"
- value={samplingPercent}
- onChange={(v) => onChange(Math.min(100, Number(v) || 0) / 100)}
- min={0.1}
- max={100}
- step={0.1}
- suffix={<span>%</span>}
- status={samplingPercent < 0.1 ? 'danger' : undefined}
- />
- </div>
- </div>
- </LemonCard>
- )
- }}
- </LemonField>
-
<LemonField name="query">
{({ value, onChange }) => {
const query = value as RecordingsQuery | null
@@ -282,6 +221,70 @@ export function ScannerTriggers({ scannerId }: { scannerId: string }): JSX.Eleme
}}
</LemonField>
+ <LemonField name="sampling_rate">
+ {({ value, onChange }) => {
+ const ratio = typeof value === 'number' ? value : 0
+ const samplingPercent = Math.round(ratio * 1000) / 10
+ return (
+ <LemonCard hoverEffect={false} className="p-3 space-y-3">
+ <div className="space-y-1">
+ <LemonLabel>Sampling</LemonLabel>
+ <div className="text-xs text-muted">
+ Each observation counts against your monthly Vision quota.
+ </div>
+ </div>
+ <div className="flex items-center gap-4">
+ <div className="flex-1">
+ <LemonSlider
+ value={samplingPercent}
+ onChange={(v) => onChange(v / 100)}
+ min={0.1}
+ max={100}
+ step={0.1}
+ />
+ </div>
+ <div className="w-24">
+ <LemonInput
+ type="number"
+ value={samplingPercent}
+ onChange={(v) => onChange(Math.min(100, Number(v) || 0) / 100)}
+ min={0.1}
+ max={100}
+ step={0.1}
+ suffix={<span>%</span>}
+ status={samplingPercent < 0.1 ? 'danger' : undefined}
+ />
+ </div>
+ </div>
+ </LemonCard>
+ )
+ }}
+ </LemonField>
+
+ <LemonField name="sampling_mode">
+ {({ value, onChange }) => {
+ const mode = (value ?? 'comprehensive') as SamplingMode
+ const option = SAMPLING_MODE_OPTIONS.find((o) => o.value === mode)
+ return (
+ <LemonCard hoverEffect={false} className="p-3 space-y-3">
+ <div className="space-y-1">
+ <LemonLabel info="Filters which matching recordings this scanner watches, based on how much activity a recording has (interactions, errors, navigation). Narrower options skip low-activity recordings so your budget goes to recordings worth watching.">
+ Session coverage
+ </LemonLabel>
+ </div>
+ <div className="space-y-1">
+ <LemonSegmentedButton
+ value={mode}
+ onChange={onChange}
+ options={SAMPLING_MODE_OPTIONS.map((o) => ({ value: o.value, label: o.label }))}
+ />
+ <div className="text-xs text-muted">{option?.description}</div>
+ </div>
+ </LemonCard>
+ )
+ }}
+ </LemonField>
+
<ScannerQuotaForecast scannerId={scannerId} />
</div>
)
diff --git a/products/replay_vision/frontend/replay_scanners/types.ts b/products/replay_vision/frontend/replay_scanners/types.ts
index 7cefdd902884..5a46227a946f 100644
--- a/products/replay_vision/frontend/replay_scanners/types.ts
+++ b/products/replay_vision/frontend/replay_scanners/types.ts
@@ -239,18 +239,18 @@ export type SamplingMode = 'focused' | 'balanced' | 'comprehensive'
export const SAMPLING_MODE_OPTIONS: { value: SamplingMode; label: string; description: string }[] = [
{
value: 'focused',
- label: 'Focused',
- description: 'Only the most eventful sessions. Skips routine ones.',
+ label: 'Highest activity only',
+ description: 'Only scans the recordings with the most going on.',
},
{
value: 'balanced',
- label: 'Balanced',
- description: 'Skips the quietest sessions, keeps a broad mix.',
+ label: 'Skip lowest activity',
+ description: 'Skips the lowest-activity recordings, scans everything else.',
},
{
value: 'comprehensive',
- label: 'Comprehensive',
- description: 'Every session that matches your filters.',
+ label: 'All recordings',
+ description: 'Scans every recording that matches your filters, regardless of activity.',
},
]