Skip to content

Conversation stats script from structured logs #4

Description

@vgpastor

Goal / Objetivo

EN: Add a small script that reads the structured conversation logs and prints
usage stats (conversations, turns, unique chats, errors, median turn time) over a
date range. Useful for observability without external tooling.

ES: Añadir un script que lea los logs estructurados de conversación e imprima
estadísticas de uso (conversaciones, turnos, chats únicos, errores, tiempo medio
por turno) en un rango de fechas. Útil para observabilidad sin herramientas
externas.

Context / Contexto

The bot already emits one JSON line per event to stdout/logs via
src/infrastructure/observability/conversation-logger.ts (each line is
prefixed with a date, then {"t":"conv", ...}). This task is a read-only
consumer of those lines.

Acceptance / Aceptación

  • A scripts/stats.ts (run with tsx) that takes a log file and prints a summary.
  • Ignores/parses the date prefix correctly.
  • A tiny test with a sample log fixture.

Good first issue — pure parsing, no external services.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions