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.

feat(llma): make sentiment column hideable in traces tab (#61130)

posthog[bot]ad43d5523955
diff --git a/products/ai_observability/frontend/AIObservabilityTracesScene.tsx b/products/ai_observability/frontend/AIObservabilityTracesScene.tsx
index 9d6f0fade19b..0a02c737ae7e 100644
--- a/products/ai_observability/frontend/AIObservabilityTracesScene.tsx
+++ b/products/ai_observability/frontend/AIObservabilityTracesScene.tsx
@@ -88,12 +88,13 @@ export function AIObservabilityTraces(): JSX.Element {
function TracesOptionsMenu(): JSX.Element | null {
const { featureFlags } = useValues(featureFlagLogic)
- const { showInputOutputColumns } = useValues(aiObservabilityTracesTabLogic)
- const { setShowInputOutputColumns } = useActions(aiObservabilityTracesTabLogic)
+ const { showInputOutputColumns, showSentimentColumn } = useValues(aiObservabilityTracesTabLogic)
+ const { setShowInputOutputColumns, setShowSentimentColumn } = useActions(aiObservabilityTracesTabLogic)
const showInputOutputToggleEnabled = !!featureFlags[FEATURE_FLAGS.LLM_OBSERVABILITY_SHOW_INPUT_OUTPUT]
+ const showSentimentToggleEnabled = !!featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_SENTIMENT]
- if (!showInputOutputToggleEnabled) {
+ if (!showInputOutputToggleEnabled && !showSentimentToggleEnabled) {
return null
}
@@ -103,14 +104,26 @@ function TracesOptionsMenu(): JSX.Element | null {
placement="bottom-end"
overlay={
<div className="flex flex-col gap-2 py-1 px-2 min-w-64">
- <LemonSwitch
- checked={showInputOutputColumns}
- onChange={setShowInputOutputColumns}
- label="Show input/output"
- fullWidth
- tooltip="Preview each trace's first input and last output in the table. Turn off for a denser view."
- data-attr="llm-traces-show-input-output-toggle"
- />
+ {showInputOutputToggleEnabled && (
+ <LemonSwitch
+ checked={showInputOutputColumns}
+ onChange={setShowInputOutputColumns}
+ label="Show input/output"
+ fullWidth
+ tooltip="Preview each trace's first input and last output in the table. Turn off for a denser view."
+ data-attr="llm-traces-show-input-output-toggle"
+ />
+ )}
+ {showSentimentToggleEnabled && (
+ <LemonSwitch
+ checked={showSentimentColumn}
+ onChange={setShowSentimentColumn}
+ label="Show sentiment"
+ fullWidth
+ tooltip="Show the sentiment column. Turn off to skip computing sentiment for traces in the table."
+ data-attr="llm-traces-show-sentiment-toggle"
+ />
+ )}
</div>
}
>
diff --git a/products/ai_observability/frontend/tabs/aiObservabilityTracesTabLogic.ts b/products/ai_observability/frontend/tabs/aiObservabilityTracesTabLogic.ts
index 31197ad3e654..875c771de5d4 100644
--- a/products/ai_observability/frontend/tabs/aiObservabilityTracesTabLogic.ts
+++ b/products/ai_observability/frontend/tabs/aiObservabilityTracesTabLogic.ts
@@ -45,6 +45,7 @@ export const aiObservabilityTracesTabLogic = kea<aiObservabilityTracesTabLogicTy
actions({
setTracesQuery: (query: DataTableNode) => ({ query }),
setShowInputOutputColumns: (show: boolean) => ({ show }),
+ setShowSentimentColumn: (show: boolean) => ({ show }),
}),
reducers({
@@ -61,6 +62,13 @@ export const aiObservabilityTracesTabLogic = kea<aiObservabilityTracesTabLogicTy
setShowInputOutputColumns: (_, { show }) => show,
},
],
+ showSentimentColumn: [
+ true as boolean,
+ { persist: true },
+ {
+ setShowSentimentColumn: (_, { show }) => show,
+ },
+ ],
}),
selectors({
@@ -81,6 +89,7 @@ export const aiObservabilityTracesTabLogic = kea<aiObservabilityTracesTabLogicTy
s.featureFlags,
s.user,
s.showInputOutputColumns,
+ s.showSentimentColumn,
],
(
dateFilter: { dateFrom: string | null; dateTo: string | null },
@@ -92,7 +101,8 @@ export const aiObservabilityTracesTabLogic = kea<aiObservabilityTracesTabLogicTy
groupsTaxonomicTypes: TaxonomicFilterGroupType[],
featureFlags: { [flag: string]: boolean | string | undefined },
user: { is_impersonated?: boolean } | null,
- showInputOutputColumns: boolean
+ showInputOutputColumns: boolean,
+ showSentimentColumn: boolean
): DataTableNode => {
// For impersonated users (support agents), default to showing support traces
// For regular users, always filter out support traces
@@ -121,7 +131,9 @@ export const aiObservabilityTracesTabLogic = kea<aiObservabilityTracesTabLogicTy
? ['inputState', 'outputState']
: []),
'person',
- ...(featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_SENTIMENT] ? ['__llm_sentiment'] : []),
+ ...(featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_SENTIMENT] && showSentimentColumn
+ ? ['__llm_sentiment']
+ : []),
...(featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_TOOLS_TAB] ? ['__llm_tools'] : []),
'errorCount',
'totalLatency',