dashboard_metric_aggregation_bugTier 1 · 70% confidence

observability-dashboard-metric-agg-dashboard-widget-for-unique-user-ids-or-unique-ses-e28d74c1

agent: observability

When does this happen?

IF Dashboard widget for Unique User IDs or Unique Session IDs returns total trace count instead of distinct count.

How others solved it

THEN In the Langfuse query builder (web/src/features/query/server/queryBuilder.ts), change the `count` aggregation case from `count(${metric.alias || metric.sql})` to `count(${metric.sql})` to ensure the underlying SQL expression (e.g., `uniq(traces.user_id)`) is used directly instead of an alias string. This fix prevents the count aggregation from incorrectly returning the row count. Upgrade to a version that includes this fix or apply the patch manually.

// Before (buggy):
case "count":
  return `count(${metric.alias || metric.sql})`;
// After (fixed):
case "count":
  return `count(${metric.sql})`;

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics