Skip to content

[DERCBOT-1822] Fix 'number of messages' chart in custom metrics#2046

Open
scezen wants to merge 2 commits into
theopenconversationkit:masterfrom
CreditMutuelArkea:fix/message-number-graph/DERCBOT-1822
Open

[DERCBOT-1822] Fix 'number of messages' chart in custom metrics#2046
scezen wants to merge 2 commits into
theopenconversationkit:masterfrom
CreditMutuelArkea:fix/message-number-graph/DERCBOT-1822

Conversation

@scezen
Copy link
Copy Markdown
Member

@scezen scezen commented Apr 29, 2026

Ticket : DERCBOT-1822

Goal

Fix the “Number of user messages” chart in Custom Metrics so it counts real user messages, instead of relying on flow transition stats that can overcount messages.

Details

  • Count user messages from dialog user actions, which is the same source of truth used by dialog stats
  • Add a dedicated endpoint for user messages by date: /dialogs/stats/messages-by-date
  • Keep the chart response compatible with the existing Custom Metrics chart format
  • Preserve date range filtering and daily aggregation
  • Exclude test configurations from the chart in REC/PROD

Why

The previous chart used flow transition stats. In some cases, especially with RAG dialogs, a single user message can create multiple flow transition stat entries, which makes the chart display more messages than actually exist.
Counting dialog user actions directly avoids this overcount and aligns the chart with the “Total user messages” stats.

Copy link
Copy Markdown
Contributor

@assouktim assouktim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's an alternative approach: Right now, the data you need is already being retrieved, but it's not grouped by date. You just need to add date grouping to the output.

Comment thread bot/admin/web/src/app/metrics/metrics-board/metrics-board.component.ts Outdated
Comment thread bot/admin/server/src/main/kotlin/BotAdminService.kt Outdated
Comment thread bot/admin/server/src/main/kotlin/BotAdminService.kt Outdated
Comment thread bot/engine/src/main/kotlin/admin/dialog/DialogStatsQuery.kt Outdated
Comment thread bot/storage-mongo/src/main/kotlin/UserTimelineMongoDAO.kt Outdated
@scezen
Copy link
Copy Markdown
Member Author

scezen commented May 11, 2026

Addressed the review points:

  • Removed the custom messages endpoint/query
  • Reused the existing dialog stats flow instead
  • Kept the usual prod/test split and frontend merge behavior
  • Fixed the refresh when toggling “Display tests”
  • Fixed the 3D range display (it showed only last 2 days before that)

@scezen scezen requested a review from assouktim May 11, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants