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(aio): keep long evaluation names apart in the overview charts (#125591)

Bernat Torresefca4625e7c7
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 65914ed77a3e..a280bfc473c5 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -9022,6 +9022,10 @@ snapshots:
hash: v1.k794b7964.0a716fd857838f8c6d836fb271ba27bc8b03807f9d14392528f487fcdb85f2b3.9Y-HU-8rkjlq8f0YS7rS69uE3-ckqDr27mH0TukD6mo
scenes-app-ai-observability-evaluations-overview--rate-limited--light:
hash: v1.k794b7964.48bfc1d4c5823c8a5494cf5bf79ef910d1c06d77315f5b28810570b3b26a2109.NnZNfIuP_J5KMBwtFMEqT1boYiKsI4StZzd62NQzys0
+ scenes-app-ai-observability-evaluations-overview--similar-names--dark:
+ hash: v1.k794b7964.b2ad6807e9e946d305b6f48c052c13f5a397e7535aa98e5becbc88c075797cc0.krdDAabN1UpzRmcbKfqgl_bymQR4lcOT1uCfkolTbh0
+ scenes-app-ai-observability-evaluations-overview--similar-names--light:
+ hash: v1.k794b7964.0f3d4d1bbc4bed0b3a1ebf82bffcc594e3a52ed22cb836f0f921a418b3bd53d4.WqQf--g75GXcExGSwJ2CC2uItZM1V1KaQkfEvM5x9XM
scenes-app-ai-observability-evaluations-overview--two-evaluations--dark:
hash: v1.k794b7964.24177f3a0ab02c226de812af2a7236ca39efa20130a5e3f90b7eb8b9ef8b9fda.4fFcQQuS2W_Ge3tRrUxO5y8iC3h0XcVIp3VQw02oAjE
scenes-app-ai-observability-evaluations-overview--two-evaluations--light:
diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationCompareItem.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationCompareItem.tsx
index e31c0858532c..4b7b600d21a7 100644
--- a/products/ai_observability/frontend/evaluations/overview/EvaluationCompareItem.tsx
+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationCompareItem.tsx
@@ -68,7 +68,9 @@ export function EvaluationCompareItem({
style={color ? { backgroundColor: color } : undefined}
/>
<span className="flex flex-col min-w-0">
- <span className="font-semibold truncate">{row.name}</span>
+ <span className="font-semibold line-clamp-3 break-words" title={row.name}>
+ {row.name}
+ </span>
<span className={cn('text-xs', (reason && ATTENTION_CLASSES[reason]) || 'text-secondary')}>
{caption(row, timezone)}
</span>
diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationPassRateCompareChart.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationPassRateCompareChart.tsx
index d9c117a7f488..de583b0969e9 100644
--- a/products/ai_observability/frontend/evaluations/overview/EvaluationPassRateCompareChart.tsx
+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationPassRateCompareChart.tsx
@@ -7,6 +7,7 @@ import type { Series, TimeSeriesLineChartConfig, TooltipContext } from '@posthog
import { useChartTheme } from 'lib/charts/hooks'
import { getColorVar } from 'lib/colors'
import { humanFriendlyNumber } from 'lib/utils/numbers'
+import { midEllipsis } from 'lib/utils/strings'
import { EvaluationBackfillHint } from './EvaluationBackfillHint'
import {
@@ -20,6 +21,8 @@ import {
import { evaluationsOverviewLogic } from './evaluationsOverviewLogic'
const MEDIAN_KEY = '__median'
+// Fits the tooltip name column and cuts in the middle, so the end that tells similar names apart stays visible.
+const TOOLTIP_NAME_CHARS = 30
export function EvaluationPassRateCompareChart({ colors }: { colors: Map<string, string> }): JSX.Element {
const theme = useChartTheme()
@@ -89,7 +92,7 @@ export function EvaluationPassRateCompareChart({ colors }: { colors: Map<string,
<Fragment key={row.id}>
<span className="flex items-center gap-2 min-w-0">
<TooltipSwatch color={colors.get(row.id) ?? ''} />
- <span className="truncate max-w-72">{row.name}</span>
+ <span className="truncate max-w-72">{midEllipsis(row.name, TOOLTIP_NAME_CHARS)}</span>
</span>
{/* The value stays short, so the name gets the rest of the tooltip's fixed width. */}
<span className="text-right whitespace-nowrap tabular-nums">
diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationResultTrendChart.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationResultTrendChart.tsx
index ccbad613e8a5..3e5e9bfcf5b4 100644
--- a/products/ai_observability/frontend/evaluations/overview/EvaluationResultTrendChart.tsx
+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationResultTrendChart.tsx
@@ -6,6 +6,7 @@ import type { Series, TimeSeriesComboChartConfig, TooltipContext } from '@postho
import { useChartTheme } from 'lib/charts/hooks'
import { getColorVar } from 'lib/colors'
import { humanFriendlyNumber } from 'lib/utils/numbers'
+import { midEllipsis } from 'lib/utils/strings'
import type { EvaluationResultApi } from '../../generated/api.schemas'
import {
@@ -19,6 +20,8 @@ import {
// The volume axis is hidden, so the chart needs no room for labels on the right.
const CHART_MARGINS = { right: 16 }
+// Fits max-w-60 and cuts in the middle, so the end that tells similar labels apart stays visible.
+const LABEL_CHARS = 28
const VOLUME_KEY = 'volume'
const PASSED_KEY = 'passed'
const FAILED_KEY = 'failed'
@@ -181,7 +184,7 @@ export function EvaluationResultTrendChart({
Number.isFinite(entry.values[ctx.dataIndex]) ? (
<div key={entry.key} className="flex items-center gap-2 mt-1">
<TooltipSwatch color={breakdownColor(theme.colors, index)} />
- <span className="truncate max-w-60">{entry.label}</span>
+ <span className="truncate max-w-60">{midEllipsis(entry.label, LABEL_CHARS)}</span>
<strong className="ml-auto tabular-nums">
{isScore
? entry.values[ctx.dataIndex].toFixed(2)
@@ -262,7 +265,9 @@ export function EvaluationResultTrendChart({
// eslint-disable-next-line react/forbid-dom-props
style={{ backgroundColor: breakdownColor(theme.colors, index) }}
/>
- <span className="truncate max-w-60">{entry.label}</span>
+ <span className="truncate max-w-60" title={entry.label}>
+ {midEllipsis(entry.label, LABEL_CHARS)}
+ </span>
</span>
))}
</div>
diff --git a/products/ai_observability/frontend/evaluations/overview/EvaluationsOverview.stories.tsx b/products/ai_observability/frontend/evaluations/overview/EvaluationsOverview.stories.tsx
index ef2ada77701a..8fd3c48f2fde 100644
--- a/products/ai_observability/frontend/evaluations/overview/EvaluationsOverview.stories.tsx
+++ b/products/ai_observability/frontend/evaluations/overview/EvaluationsOverview.stories.tsx
@@ -105,6 +105,12 @@ const HELPFULNESS = passRateResult(uuid(1), 'Helpfulness', 91.4, 92.0, 140)
const GROUNDEDNESS = passRateResult(uuid(2), 'Answer is grounded in context', 78.2, 86.5, 90, 4)
const TONE = passRateResult(uuid(3), 'Polite tone', 97.1, 96.4, 60, 1)
const NEW_CHECK = passRateResult(uuid(4), 'Refuses off-topic requests', 70, null, 1)
+// Names that only differ at the end, which a plain truncation hides.
+const SIMILAR_NAMES = [
+ passRateResult(uuid(21), 'Answer is grounded in the retrieved tool results', 61.5, 63.0, 80, 3),
+ passRateResult(uuid(22), 'Answer is grounded in the retrieved tool results (fast model)', 82.4, 81.0, 70, 2),
+ passRateResult(uuid(23), 'Answer is grounded in the retrieved tool results (decision model)', 90.2, 89.5, 60, 2),
+]
const SENTIMENT_VALUES = wave(14, 3, 1)
const SENTIMENT = result({
@@ -429,3 +435,5 @@ export const RateLimited: Story = { decorators: [scene(MANY, { rateLimited: true
export const TwoEvaluations: Story = { decorators: [scene([GROUNDEDNESS, TONE])] }
export const NothingGraded: Story = { decorators: [scene([SILENT, PAUSED])] }
+
+export const SimilarNames: Story = { decorators: [scene(SIMILAR_NAMES)] }