Skip to content

Commit 41a9a46

Browse files
fix over-count for anonymous uploads
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent dc1c039 commit 41a9a46

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

profile-long-calls/long-calls-analyzer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,13 +332,14 @@ function printStats(db: DatabaseType): void {
332332
SELECT
333333
lc.call_name,
334334
COUNT(*) AS occurrences,
335-
COUNT(DISTINCT lc.source_id) AS affected_users,
335+
COUNT(DISTINCT s.username) AS affected_users,
336336
ROUND(AVG(lc.total_ms)) AS avg_ms,
337337
p95.p95_ms,
338338
MAX(lc.total_ms) AS max_ms,
339339
SUM(lc.is_freeze) AS freezes,
340340
ROUND(SUM(lc.total_ms) / 1000.0, 1) AS total_sec
341341
FROM long_calls lc
342+
LEFT JOIN sources s ON s.id = lc.source_id
342343
LEFT JOIN p95 ON p95.call_name = lc.call_name
343344
GROUP BY lc.call_name
344345
ORDER BY total_sec DESC

0 commit comments

Comments
 (0)